-
Notifications
You must be signed in to change notification settings - Fork 570
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 #604
Conversation
Are the vendor and gofmt changes required for this pr? Seems excessive |
The vendor changes are due to pulling in |
Just that the vendor additions did +47,426 −1,303 changes |
The |
@tidwall - right, you could remove vendoring the dependencies but that's a bigger change and definitely out of scope for this PR (if you even want to remove vendoring at all). |
@tidwall - what would be helpful is know if this PR is going in the right direction. If you're ok with this approach then I'll clean this PR up a bit, add a few more metrics and a test or so and get this ready for a real review. |
A cursory look is a-ok. I'll take a deeper dive in the morning. |
The tests are failing at tests/mock_test.go:55. Your new The |
Other than the broken |
Thanks @tidwall ! |
@tidwall - addressed your comments, added a few more metrics and also tests, this is ready for a real review now. One more question: should I add a blurb to the README about how to enable Prometheus metrics? Don't really see a section where command line flags are covered so not really sure where this would fit. Maybe a short section right after |
I think that would be useful. Perhaps above the Network protocols section. It would also make a great topic on the documentation page There's one test failure, but otherwise your code looks good. |
Fixed the tests and added instructions on how to expose the metrics (added it as a sub-item to the "Running" section). I'll see that I get the documentation page updated later this week, or next. |
Thanks again. I plan on including it in a new version next week. |
This PR adds a flag to the tile38 server to expose Prometheus metrics via a configurable http endpoint. By default, it's disabled and no metrics are exposed.
The changes in main.go here add a new http listener if the cmd line flag is set.
You can run it like this:
go run cmd/tile38-server/main.go --metrics-addr=0.0.0.0:4321
I utilized the existing code from stats.go to boostrap some basic metrics and then broke out the strings/objects/point counts per collection to show what's possible. I've not yet exposed all existing
SERVER EXT
metrics but the path forward is pretty clear.You can get see the metrics by running:
I added measuring of cmd processing time here - it uses a Prometheus summary to record the timings of each cmd processed and exposes them in 50%, 90%, 95%, and 99% quantiles.
Example (I ran
scan
only once so the data exposed is not that exciting):This is a start but I think a lot more metrics can be exposed similar to the way it's done in this PR.
Let me know what you think!