-
Notifications
You must be signed in to change notification settings - Fork 811
Description
Title: Add node label to elasticsearch_nodes_roles for better correlation
Background
The elasticsearch_nodes_roles metric currently exposes these labels:
clusterhostnamerole
Proposal
Extend elasticsearch_nodes_roles with a node label that contains the Elasticsearch node ID:
ql
Current
elasticsearch_nodes_roles{cluster="prod",host="172.17.0.2",name="es-node-1",role="master"} 1
Proposed
elasticsearch_nodes_roles{cluster="prod",host="172.17.0.2",name="es-node-1",node="49nZYKtiQdGg7Nl_sVsI1A",role="master"} 1Implementation notes:
-
The node ID is already available as the key in the
nodesmap returned by/_nodes/_all/stats, so no extra API calls are needed. -
In code this is essentially changing:
for nodeID, node := range nodeStatsResp.Nodes {
// ...
labels := []string{
nodeStatsResp.ClusterName,
node.Host,
node.Name,
nodeID, // new label
role,
}
}Why this helps
-
Makes it possible to reliably join
elasticsearch_nodes_roleswith node-ID–keyed metrics (e.g. shard-level indices metrics once they exposenodetoo). -
Enables queries such as “shards per role” or “docs per role” by joining on
node(e.g. shard-level indices metrics once they exposenodetoo). -
No behavioral or performance impact beyond adding one label; all data comes from existing responses.