Add cluster label to SLM metrics #1046
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new feature to the SLM collector, making it cluster-aware (#889)
Previously, the metrics exposed by the SLM collector did not include any cluster-specific labels. This made it difficult to distinguish SLM statistics in multi-cluster environments, as it was not possible to filter them by cluster name.
These changes address this limitation by adding a
cluster
label to all metrics collected by the SLM collector. This is achieved by injecting theclusterinfo.Retriever
into the collector, which then provides the necessary cluster information.On a more technical approach:
1st, I'm not an heavy go programmer, tried to do my best 😄 .
My main thoughts are on the 1st work that I had to do, injecting
clusterInfo.Retriever
dependency to thefactortyFunc
, so each collector can register itself as a cluster info retriever consumer, if needed.I saw that another technical approach was used with the shards & indices collectors, but they are not implementing the collector interface so I thought my approach was "ok". Also, it means that shards & indices collectors can probably be migrated more easily now that collector implementations can get clusterInfo (?).
Please let me know if you think on some improvements.