-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Registry Counter panic: duplicate metrics collector registration attempted #716
Comments
Hi 👋 This is expected, as you used promauto which automatically registers the metric. (: You have few options (you can choose any of those three):
Let us know if you have more questions! 🤗 Otherwise closing (: |
It makes more sense to ask questions like this on the prometheus-users mailing list rather than in a GitHub issue. On the mailing list, more people are available to potentially respond to your question, and the whole community can benefit from the answers provided. |
@beorn7 GitHub is easier to find for someone not on the mailing list and benefits more people |
@1a1a11a - Fully agree with this |
that's used to give more control and therefore create unique registers per tests avoiding the "duplicate metrics collector registration attempted" panic message see prometheus/client_golang#716 (comment)
that's used to give more control and therefore create unique registers per tests avoiding the "duplicate metrics collector registration attempted" panic message see prometheus/client_golang#716 (comment)
* metrics: inline all counter references remove all calls to metrics.Counter and instead inline using the prometheus/promauto package * metrics: inject prometheus register dependency that's used to give more control and therefore create unique registers per tests avoiding the "duplicate metrics collector registration attempted" panic message see prometheus/client_golang#716 (comment) * metrics: inline gauge calls * metrics: inline all gauge calls in debug reporter couple things: 1 - semantics have changed, ie the metrics are initialized to 0 even if we can't ever generate metrics data so think in a dashboard a 0 value vs simply nothing showing up 2 - some of the metrics generated were dynamic, for example, based on files in a directory that has been hardcoded * metrics: inline timing calls and remove metrics pkg * metrics: bring back type assertions * metrics: create basic playground to compare metrics * metrics: convert timing metrics to nanoseconds * metrics: improve metrics-comparison docker-compose * metrics: fixes /benchmark * metrics: fix broken test * metrics: make missing metrics greppable
* metrics: inline all counter references remove all calls to metrics.Counter and instead inline using the prometheus/promauto package * metrics: inject prometheus register dependency that's used to give more control and therefore create unique registers per tests avoiding the "duplicate metrics collector registration attempted" panic message see prometheus/client_golang#716 (comment) * metrics: inline gauge calls * metrics: inline all gauge calls in debug reporter couple things: 1 - semantics have changed, ie the metrics are initialized to 0 even if we can't ever generate metrics data so think in a dashboard a 0 value vs simply nothing showing up 2 - some of the metrics generated were dynamic, for example, based on files in a directory that has been hardcoded * metrics: inline timing calls and remove metrics pkg * metrics: bring back type assertions * metrics: create basic playground to compare metrics * metrics: convert timing metrics to nanoseconds * metrics: improve metrics-comparison docker-compose * metrics: fixes /benchmark * metrics: fix broken test * dashboard: initial version created with jsonnet * metrics: add pyroscope_ suffix * metrics: make missing metrics greppable * metrics: prepend pyroscope_ to missing metrics * metrics: refactor storage and cache counters * metrics: rename pyroscope_disk and pyroscope_cache_size * metrics: rename _count suffix to _total * metrics: timers are now histograms * metrics: refactor cache writes/misses metrics * metrics: rename a bunch of metrics * metrics: add dashboard row for go metrics * metrics: cleanup dashboard * metrics: add help text to benchmark metrics
and its google searchable |
Going to just add my notes in case it's helpful for anyone else. I think @bwplotka gave a solid answer but I'll add to it. Bottom Line UpfrontUse prometheus client instead of promauto to handle fallible registry of new prometheus metrics.
Why?I was using promauto but as the notes in the code suggests:
|
client version
github.com/prometheus/client_golang v1.4.1
go.mod
Problem
when I Registry
prometheus.Counter
withprometheus
must be panic withduplicate metrics collector registration attempted
source code
The text was updated successfully, but these errors were encountered: