Skip to content
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

update merics' labelset if needed #628

Merged
merged 2 commits into from
Jul 15, 2024
Merged

update merics' labelset if needed #628

merged 2 commits into from
Jul 15, 2024

Conversation

miklezzzz
Copy link
Contributor

@miklezzzz miklezzzz commented Jul 10, 2024

Overview

This pr update the way metrics with different label sets and the same name are stored in a collector.
If a new metric has a new label, this new label is added to the collector and all previous metrics in the collector get it with an empty string as its value.

What this PR does / why we need it

Closes #616

Special notes for your reviewer

Signed-off-by: Mikhail Scherba <[email protected]>
@miklezzzz miklezzzz added the enhancement New feature or request label Jul 10, 2024
@miklezzzz miklezzzz requested a review from yalosev July 10, 2024 12:58
@miklezzzz miklezzzz self-assigned this Jul 10, 2024
@miklezzzz miklezzzz requested a review from nabokihms July 10, 2024 13:02
Comment on lines +63 to +64
} else if !LabelNamesEqual(collector.LabelNames(), labelNames) {
collector.UpdateLabels(labelNames)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure how to make it less noisy, maybe it makes sense to store all the collector's labels in a map alongside the slice so that it would be faster to check if any new labels are provided

Signed-off-by: Mikhail Scherba <[email protected]>
@yalosev yalosev merged commit 7c38e30 into main Jul 15, 2024
8 checks passed
@yalosev yalosev deleted the fix-lost-metrics branch July 15, 2024 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lost metrics/wrong labels when same metric name has different labels
3 participants