-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Adding node_count to ML Usage (#33850) #33863
Adding node_count to ML Usage (#33850) #33863
Conversation
Pinging @elastic/ml-core |
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.
I left one idea.
Also, if you find that the PR build fails in the BWC tests because an ML usage object is getting serialized on the wire between 6.5 and 7.0 before your backport, the solution is to change the BWC constants from 6.5.0 to 7.0.0 in this PR, then change back to 6.5.0 when you backport to 6.x, and finally push another commit to master setting master to 6.5.0 again.
} | ||
|
||
public MachineLearningFeatureSetUsage(StreamInput in) throws IOException { | ||
super(in); | ||
this.jobsUsage = in.readMap(); | ||
this.datafeedsUsage = in.readMap(); | ||
if (in.getVersion().onOrAfter(Version.V_6_5_0)) { | ||
this.nodeCount = in.readInt(); | ||
} |
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.
Rather than use 0
in the case of "unknown" in a mixed version cluster it would be nicer to have a specific "unknown" value, say -1
, and then not include the count in the JSON output if it's unknown.
For example:
if (in.getVersion().onOrAfter(Version.V_6_5_0)) {
this.nodeCount = in.readInt();
} else {
this.nodeCount = -1;
}
|
||
private final Map<String, Object> jobsUsage; | ||
private final Map<String, Object> datafeedsUsage; | ||
private int nodeCount; |
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.
This can be final
too
@@ -57,6 +67,7 @@ protected void innerXContent(XContentBuilder builder, Params params) throws IOEx | |||
if (datafeedsUsage != null) { | |||
builder.field(DATAFEEDS_FIELD, datafeedsUsage); | |||
} | |||
builder.field(NODE_COUNT, nodeCount); |
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.
Going with the approach of not printing "unknown", this can be:
if (nodeCount >= 0) {
builder.field(NODE_COUNT, nodeCount);
}
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.
LGTM
Relates: elastic/elasticsearch#33863 Add usage remarks.
Relates: elastic/elasticsearch#33863 Add usage remarks.
Relates: elastic/elasticsearch#33863 Add usage remarks.
Relates: elastic/elasticsearch#33863 Add usage remarks. (cherry picked from commit 8b31b27)
Non-intrusive way to add node_count for the ML telemetry.
Closes #33850