-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent excessive ES version warnings #8865
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,9 @@ import semver from 'semver'; | |
import isEsCompatibleWithKibana from './is_es_compatible_with_kibana'; | ||
import SetupError from './setup_error'; | ||
|
||
const lastWarnedAboutNodes = new WeakMap(); | ||
// tracks the node descriptions that get logged in warnings so | ||
// that we don't spam the log with the same message over and over | ||
const lastWarnedNodesForServer = new WeakMap(); | ||
|
||
module.exports = function checkEsVersion(server, kibanaVersion) { | ||
server.log(['plugin', 'debug'], 'Checking Elasticsearch version'); | ||
|
@@ -52,9 +54,10 @@ module.exports = function checkEsVersion(server, kibanaVersion) { | |
ip: node.ip, | ||
})); | ||
|
||
// Don't show the same warning over and over again. | ||
const warningNodeNames = getHumanizedNodeNames(simplifiedNodes).join(', '); | ||
if (lastWarnedAboutNodes.get(server) !== warningNodeNames) { | ||
lastWarnedAboutNodes.set(server, warningNodeNames); | ||
if (lastWarnedNodesForServer.get(server) !== warningNodeNames) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably worth some sort of comment here about how multi-tenancy comes into play... if it's written in a way so that even I can understand it, then it's a foolproof comment. :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or maybe such a comment belongs where |
||
lastWarnedNodesForServer.set(server, warningNodeNames); | ||
server.log(['warning'], { | ||
tmpl: ( | ||
`You're running Kibana ${kibanaVersion} with some newer versions of ` + | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a comment?
// Don't show the same warning over and over again.