-
Notifications
You must be signed in to change notification settings - Fork 510
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
Fix target_info labels #2546
Fix target_info labels #2546
Conversation
modules/generator/registry/gauge.go
Outdated
for _, s := range g.series { | ||
t := time.UnixMilli(timeMs) | ||
lbls := make(labels.Labels, 1+len(externalLabels)+len(s.labels.names)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to keep the allocations outside of the loop. I think I saw a Reset()
method on the lb object that might empty this out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's missing a test to ensure the bug is fixed. Otherwise, LGTM
added test and made sure they failed before the fix and passed after the fix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGMT, nice fix
What this PR does: The
labels
variable in the gauge & countercollectMetrics
function was created outside the for loop and so we were constantly adding labels to metrics after metrics.Which issue(s) this PR fixes:
Fixes #
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]