-
Notifications
You must be signed in to change notification settings - Fork 201
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
Prometheus Metrics for Mux Router #321
Conversation
Signed-off-by: hfuss <haydenfuss@gmail.com>
Codecov Report
@@ Coverage Diff @@
## main #321 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 231 231
Lines 12542 12560 +18
=========================================
+ Hits 12542 12560 +18
Continue to review full report at Codecov.
|
Signed-off-by: hfuss <haydenfuss@gmail.com>
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 looks great @hfuss 👍
Feels like the next step would be the first internal metric. I don't know if you have any pointers to @shorsher or others who might want to add in metrics, for how to use the framework you've added.
I see there's metrics.Registry()
to get the Prometheus registry object. Should code simply use that directly? Or should there be some internal wrapper interface to do things like increment/add statistics/counters?
@peterbroadhurst yep would love to do / help with the first internal metric for something like
I think we'd only want to create our own wrappers for metrics primitives if we want to support exporting metrics to other formats / publishers like StatsD. Otherwise, in the next PR I'm thinking we'll add functions like But figured when we go to add the first few internal metrics that will best inform us how to organize / refactor the metrics package. |
Fantastic - thanks @hfuss. |
TODOs
/metrics
to separate port / mux routerprometheus.Registry
to its own packageinternal/metrics
similar tointernal/log
. Write unit testsDescription
Closes #189
Provides useful histograms for measuring API endpoint latency. for example:
Really just a prototype PR to get simple metrics working and exposed. Next PR would be to actually try to instrument something like
batchPin
or a plugin and see what refactoring would need to be done around how the Prometheus registryis handled and provided.
Should there be a test in
server_test.go
that actually asserts the/metrics
route is present or returns a response?