-
Notifications
You must be signed in to change notification settings - Fork 20.4k
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
metrics/prometheus: added prometheus metrics #17077
Conversation
There's no reason to start up a new HTTP server for Prometheus. The metrics are already exposed on the pprof server, you can just add an additional endpoint there to expose further metrics. |
Thanks @karalabe! I'm looks to #1697, metrics flags put in a separate block. Looks like all metrics settings need to be there. Several reasons to start up a new HTTP server:
In my case it would be great to enable the Prometheus handler when Separate settings look more obvious for configuring |
0a29635
to
ed9ae6c
Compare
@karalabe what you think about it #17077 (comment)? |
This would be greatly appreciated! |
Why would that not be possible? We're planning to include this into 1.9, but it needs to be reworked to use the same endpoint as pprof (not a separate http server) and also needs licensing headers. @chapsuk are you willing to work more on this? Otherwise we'll put it into the backlog to try and finish it ourselves. |
Thanks for replay @holiman. |
Done, PTAL |
Hey @chapsuk, thanks a lot for this. I've been playing around with it a bit and have a few questions though. Prometheus generally has each metric as its separate instance:
However, you grouped all everything under 4 metrics (
I don't have much experience with Prometheus, but this seems the wrong way to approach it, since then all these data points will be pushed into the same table of the time series database, instead of separate ones per metric. It also seems to make Grafana charting more complex, since you need to fetch Instead of creating these grouping, which imho only add complexity but don't provide any value, couldn't er simply convert
This would also simplify your code a lot, since it completely removes the need for the A second issue is that you seem to convert go-metrics counters into Prometheus gauges. I think we can retain the counter type in Prometheus too. |
You're right about naming/grouping metrics based on their semantic value rather than unit type. Some good pointers can be found:
Regarding Prometheus counters, they can only increment unlike go-metric counters which can also decrement.
|
@karalabe named metrics better then typed groups 👍
Not sure about that, i need to send type of each metrics to Prometheus. But i will try @2color fully right about second question. |
Based on the Prometheus sample, you don't need to explicitly specify the type. But even if you want to, you can still do with the type switch you currently have, you just don't need to "group" all counters together for example, you can simply output as the come along: Counter1, Meter1, Counter2, Counter3, Meter2, etc. |
Yep, it works without Fixed names of metrics, PTAL |
@karalabe |
Nope, just pushes a tiny typo fix on top. LGTM, will merge when CI is green. |
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
Oh @chapsuk, would you be willing to share your Grafana dashboard setup? I'd like to write up a blog post about metrics for the 1.9 release and would be nice to have a Grafana dashboard included there too. |
This repo contains dev environment and Grafana dashboard. I'm updated dashboard and test last changes with it, but README screenshot not actual. I will try to fix it tonight. |
Thanks a lot for this PR! Btw, we'll probably simplify the flags a bit even further so not even |
Thanks @chapsuk! Much appreciated |
Hi, guys!
--metrics.prometheus
flag provided, start http server which returns internal geth metrics by http in prometheus format; log output: