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

Use correct source label for metrics #142

Merged
merged 1 commit into from
Mar 10, 2024
Merged

Conversation

tomhughes
Copy link
Contributor

This is built on #141 to avoid conflicts.

As go captures by reference the callbacks hold pinger by reference and they will all wind up taking the source from the last pinger the loop processes.

Assigning source to a local variable that ensures that each pinger's callbacks capture a reference to that variable which is unique to each pinger and hence that the correct source is reported.

As go captures by reference we need to ensure each pinger's callbacks
uses the source the current pinger or they will all wind up reporting
the source from the last pinger.

Signed-off-by: Tom Hughes <tom@compton.nu>
Copy link
Owner

@SuperQ SuperQ left a comment

Choose a reason for hiding this comment

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

Makes sense, thanks!

@SuperQ SuperQ closed this Mar 10, 2024
@SuperQ SuperQ reopened this Mar 10, 2024
@SuperQ
Copy link
Owner

SuperQ commented Mar 10, 2024

Close/Open to fix the CI triggers.

@SuperQ SuperQ merged commit ce8b45c into SuperQ:master Mar 10, 2024
5 checks passed
SuperQ added a commit that referenced this pull request Mar 10, 2024
* [BUGFIX] Fix incorrect label setting #141 #142

Signed-off-by: SuperQ <superq@gmail.com>
@SuperQ SuperQ mentioned this pull request Mar 10, 2024
@tomhughes tomhughes deleted the source-label branch March 10, 2024 16:29
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.

None yet

2 participants