-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add prometheus metrics emitter #187
Conversation
The core of this package is a prometheus.Collector implementation that exposes the metrics of an rcrowley/go-metrics registry. It also provides a convenience function for creating a collector, registering it with a Prometheus registry, and exposing it on a HTTP endpoint. If you need to customize any of the Prometheus options, you can use the Collector directly. I ended up writing my own emitter because the existing exporters I found had some limitations: * Don't understand our custom tag/label format * Report at fixed intervals intead of implementing Collector * Export histograms incorrectly
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.
This seems pretty straightforward, thanks for implementing it! Do you think we should also add some basic functionality tests as well?
Yeah, some basic tests would be good. I started writing some and discovered an issue with the Prometheus testing library, so I'm trying to decide how to best work around that. |
Per https://prometheus.io/docs/instrumenting/writing_exporters/, remove less useful statistics that can be computed in Prometheus, add simple help text to indicate the original metric type, add "seconds" to the names of timer metrics, and improve the santize function to avoid long runs of underscores.
Updated to add tests. I also made some other changes:
|
e556def
to
e13ccd6
Compare
e13ccd6
to
d0c128d
Compare
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.
LGTM
The core of this package is a
prometheus.Collector
implementation that exposes the metrics of anrcrowley/go-metrics
registry. It also provides a convenience function for creating a collector, registering it with a Prometheus registry, and exposing it on a HTTP endpoint. If you need to customize any of the Prometheus options, you can use the Collector directly.I ended up writing my own emitter because the existing exporters I found had some limitations:
Collector
Because this is a new emitter, I tried to stay closer to Prometheus conventions rather than matching the Datadog emitter. Specifically:
go-metrics
terminology0.5
quantile instead of as a separate named metricBut I could be convinced it's better to match the Datadog emitter for easier migration.