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
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[es/versionCheck] clarify new var and reason for check
  • Loading branch information
spalger committed Oct 27, 2016
commit cda95948594dd5071706c12de3fddce466de7923
9 changes: 6 additions & 3 deletions src/core_plugins/elasticsearch/lib/check_es_version.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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(', ');
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.

if (lastWarnedAboutNodes.get(server) !== warningNodeNames) {
lastWarnedAboutNodes.set(server, warningNodeNames);
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.

lastWarnedNodesForServer.set(server, warningNodeNames);
server.log(['warning'], {
tmpl: (
`You're running Kibana ${kibanaVersion} with some newer versions of ` +
Expand Down