-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Refactor Prometheus exporter #3239
Refactor Prometheus exporter #3239
Conversation
This change will automatically register the exporter with prometheus, and provides an httpHandler for triggering collect
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3239 +/- ##
=====================================
Coverage 77.7% 77.7%
=====================================
Files 163 164 +1
Lines 11238 11263 +25
=====================================
+ Hits 8737 8762 +25
Misses 2303 2303
Partials 198 198
|
When I remove both the WithGatherer and the ServceHTTP, we run into a problem that this is trying to solve. In the default path you must either use the client_go/prometheus to do create a registry, I will go back to having a WithGatherer option and keeping the exporter as an HttpHandler. |
Don't use prometheus.NewRegistry? The example should use promhttp.Handler(). No need to reference prometheus |
(not promhttp.HandlerFor()) |
I see. That does solve that problem. Another unintended consequence of this change is by using the DefaultRegister we are now collecting the default prom metrics (go runtime stuff like |
For a simple example it is probably OK, but it might cause confusion if someone used the otel runtime metrics at the same time. With our package being named An alternative would be to define our own NewRegistry() method which points at the upstream one so that users don't encounter import collisions when making their own registry. This is additive if we want to do it. |
This change will automatically register the created exporter with prometheus, and provides a
httpHandler
for triggering collect.This also adds the ability to choose which reader is used, defaulting to a Manual Reader.
Fix #3200, #3172