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

Fix behavior when adding a custom Gauge or Counter with a custom Registry #39

Merged
merged 2 commits into from
Apr 12, 2023

Conversation

mlevieux
Copy link
Contributor

Before that, the AddCustomGauge and AddCustomCounter would both register the respective Gauge and Counter in the default prometheus Registry, even if a custom one was set.

This PR also adds tests to make sure that the new behavior is correct.

…d Value in the correct registry

Before that, the AddCustomGauge and AddCustomCounter would both register the respective Gauge and Counter in the default prometheus Registry, even if a custom one was set.
Also, since this commit introduced a new simple mustRegister method on *Prometheus, it seemed logical to use it in the register function.
@codecov
Copy link

codecov bot commented Apr 12, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.04 🎉

Comparison is base (a01318c) 94.97% compared to head (1789d4d) 95.02%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #39      +/-   ##
==========================================
+ Coverage   94.97%   95.02%   +0.04%     
==========================================
  Files           2        2              
  Lines         239      241       +2     
==========================================
+ Hits          227      229       +2     
  Misses          6        6              
  Partials        6        6              
Impacted Files Coverage Δ
prom.go 94.71% <100.00%> (+0.04%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@depado depado merged commit 9398269 into depado:master Apr 12, 2023
@depado
Copy link
Owner

depado commented Apr 12, 2023

Amazing, thanks a lot!

@mlevieux mlevieux deleted the mich/fix-custom-registry branch April 20, 2023 08:49
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.

2 participants