-
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
Prevent excessive ES version warnings #8865
Conversation
sinon.assert.callCount(server.log, 4); | ||
expect(server.log.getCall(2).args[0]).to.contain('debug'); | ||
expect(server.log.getCall(3).args[0]).to.contain('warning'); | ||
}); |
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.
Sweet tests brah
I marked this as a 5.0.1 as well - it's a pretty big deal from an operational perspective if we're spamming logs with unnecessary data, especially when you consider things like multi-tenant setups. |
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.
Looks great overall, just had a couple small suggestions.
getHumanizedNodeNames, | ||
nodes: simplifiedNodes, | ||
}); | ||
const warningNodeNames = getHumanizedNodeNames(simplifiedNodes).join(', '); |
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.
nodes: simplifiedNodes, | ||
}); | ||
const warningNodeNames = getHumanizedNodeNames(simplifiedNodes).join(', '); | ||
if (lastWarnedAboutNodes.get(server) !== warningNodeNames) { |
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.
Is server a reference to the same object every time this function is called? If so maybe a weakMap
is overkill, and we just cache a reference with a regular variable, e.g. prevWarningNodeNames !== warningNodeNames
.
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.
Not in multi-tenancy situations
}); | ||
// Don't show the same warning over and over again. | ||
const warningNodeNames = getHumanizedNodeNames(simplifiedNodes).join(', '); | ||
if (lastWarnedNodesForServer.get(server) !== warningNodeNames) { |
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe such a comment belongs where lastWarnedNodesForServer
is defined.
One comment above, LGTM otherwise. |
--------- **Commit 1:** [es/versionCheck] prevent spamming logs with compatibility warnings * Original sha: bb95cf8 * Authored by spalger <[email protected]> on 2016-10-27T20:48:36Z **Commit 2:** [es/versionCheck] clarify new var and reason for check * Original sha: cda9594 * Authored by spalger <[email protected]> on 2016-10-27T22:36:43Z **Commit 3:** [es/versionCheck] explain why we need to track per-server * Original sha: 5eb9ccd * Authored by spalger <[email protected]> on 2016-10-27T23:30:41Z
--------- **Commit 1:** [es/versionCheck] prevent spamming logs with compatibility warnings * Original sha: bb95cf8 * Authored by spalger <[email protected]> on 2016-10-27T20:48:36Z **Commit 2:** [es/versionCheck] clarify new var and reason for check * Original sha: cda9594 * Authored by spalger <[email protected]> on 2016-10-27T22:36:43Z **Commit 3:** [es/versionCheck] explain why we need to track per-server * Original sha: 5eb9ccd * Authored by spalger <[email protected]> on 2016-10-27T23:30:41Z
--------- **Commit 1:** [es/versionCheck] prevent spamming logs with compatibility warnings * Original sha: bb95cf8 * Authored by spalger <[email protected]> on 2016-10-27T20:48:36Z **Commit 2:** [es/versionCheck] clarify new var and reason for check * Original sha: cda9594 * Authored by spalger <[email protected]> on 2016-10-27T22:36:43Z **Commit 3:** [es/versionCheck] explain why we need to track per-server * Original sha: 5eb9ccd * Authored by spalger <[email protected]> on 2016-10-27T23:30:41Z
--------- **Commit 1:** [es/versionCheck] prevent spamming logs with compatibility warnings * Original sha: bb95cf8 * Authored by spalger <[email protected]> on 2016-10-27T20:48:36Z **Commit 2:** [es/versionCheck] clarify new var and reason for check * Original sha: cda9594 * Authored by spalger <[email protected]> on 2016-10-27T22:36:43Z **Commit 3:** [es/versionCheck] explain why we need to track per-server * Original sha: 5eb9ccd * Authored by spalger <[email protected]> on 2016-10-27T23:30:41Z
* [es/versionCheck] prevent spamming logs with compatibility warnings * [es/versionCheck] clarify new var and reason for check * [es/versionCheck] explain why we need to track per-server
--------- **Commit 1:** [es/versionCheck] prevent spamming logs with compatibility warnings * Original sha: bb95cf8 * Authored by spalger <[email protected]> on 2016-10-27T20:48:36Z **Commit 2:** [es/versionCheck] clarify new var and reason for check * Original sha: cda9594 * Authored by spalger <[email protected]> on 2016-10-27T22:36:43Z **Commit 3:** [es/versionCheck] explain why we need to track per-server * Original sha: 5eb9ccd * Authored by spalger <[email protected]> on 2016-10-27T23:30:41Z Former-commit-id: 236557b
Warnings are currently spamming the log if we detect a possible compatibility issue, repeating the same warning on every health check