Adding node_count to ML Usage (#33850)#33863
Conversation
|
Pinging @elastic/ml-core |
droberts195
left a comment
There was a problem hiding this comment.
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.
| this.datafeedsUsage = in.readMap(); | ||
| if (in.getVersion().onOrAfter(Version.V_6_5_0)) { | ||
| this.nodeCount = in.readInt(); | ||
| } |
There was a problem hiding this comment.
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; |
| if (datafeedsUsage != null) { | ||
| builder.field(DATAFEEDS_FIELD, datafeedsUsage); | ||
| } | ||
| builder.field(NODE_COUNT, nodeCount); |
There was a problem hiding this comment.
Going with the approach of not printing "unknown", this can be:
if (nodeCount >= 0) {
builder.field(NODE_COUNT, nodeCount);
}
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