Skip to content

Add cluster label to SLM metrics - #1239

Open
locker95 wants to merge 1 commit into
prometheus-community:masterfrom
locker95:add-cluster-label-slm
Open

Add cluster label to SLM metrics#1239
locker95 wants to merge 1 commit into
prometheus-community:masterfrom
locker95:add-cluster-label-slm

Conversation

@locker95

@locker95 locker95 commented Sep 1, 2026

Copy link
Copy Markdown

This adds a cluster label (the cluster name) to all elasticsearch_slm_stats_* metrics, making SLM metrics distinguishable when scraping multiple clusters.

It supersedes #1046 — thanks to @rneuter for the original work there. That PR predates #1052; this one instead builds on the UpdateContext.GetClusterInfo API introduced there, as one of its first consumers: the cluster name is resolved once at the start of Update and appended to the existing metric labels, following the same pattern as the snapshots collector change proposed for #629.

The shared test mock now returns a fixed cluster name (test-cluster), and the SLM test asserts the label on every metric.

Fixes #889

Resolve the cluster name through the UpdateContext introduced in prometheus-community#1052
and attach it as a "cluster" label to all slm_stats metrics, so SLM
metrics from multiple clusters can be told apart.

Fixes prometheus-community#889

Signed-off-by: Dean Chen <862469039@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing cluster label on SLM information

1 participant