Skip to content
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

Merged
merged 3 commits into from
Oct 28, 2016

Conversation

spalger
Copy link
Contributor

@spalger spalger commented Oct 27, 2016

Warnings are currently spamming the log if we detect a possible compatibility issue, repeating the same warning on every health check

2016-10-27 13_59_30

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');
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet tests brah

@epixa epixa added the v5.0.1 label Oct 27, 2016
@epixa
Copy link
Contributor

epixa commented Oct 27, 2016

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.

Copy link
Contributor

@cjcenizal cjcenizal left a 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(', ');
Copy link
Contributor

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) {
Copy link
Contributor

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.

Copy link
Contributor Author

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) {
Copy link
Contributor

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. :)

Copy link
Contributor

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.

@jbudz
Copy link
Member

jbudz commented Oct 28, 2016

One comment above, LGTM otherwise.

@spalger spalger changed the title Limit es version warnings Prevent excessive ES version warnings Oct 28, 2016
@spalger spalger merged commit c5ca160 into elastic:master Oct 28, 2016
elastic-jasper added a commit that referenced this pull request Oct 28, 2016
---------

**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
elastic-jasper added a commit that referenced this pull request Oct 28, 2016
---------

**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
spalger pushed a commit that referenced this pull request Oct 28, 2016
---------

**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
spalger pushed a commit that referenced this pull request Oct 28, 2016
---------

**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
nreese pushed a commit to nreese/kibana that referenced this pull request Nov 10, 2016
* [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
@epixa epixa added v5.1.1 and removed v5.1.0 labels Dec 8, 2016
airow pushed a commit to airow/kibana that referenced this pull request Feb 16, 2017
---------

**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
@spalger spalger deleted the fix/limit-es-version-warnings branch October 18, 2019 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants