-
Notifications
You must be signed in to change notification settings - Fork 159
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 units to prometheus metric lines #535
base: main
Are you sure you want to change the base?
Conversation
This adds units to the prometheus exporter metric lines as the prometheus naming conventions specify: https://prometheus.io/docs/practices/naming/ The units without a prometheus equivalent such as kilobytes of bytes_per_second were left as is in order to not lose information given by the user.
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.
So at a high-level, I'm not opposed to this although it will definitely need to live behind a flag to enable it, with it disabled by default.
Separately, though, I'm curious for your thoughts around how to close the gap between what this PR does and what the ideal semantic suffixing strategy is, as defined by the "Metric and label naming" guide.
For example, one thing is base units. The guide recommends avoiding using non-base units (i.e., prefer seconds over milliseconds/nanoseconds/etc) but in this PR, we're just tacking on whatever the defined unit is. Should we actually be adjusting the value to normalize it to seconds? And do a similar thing for bytes, etc.
(I originally commented about counters and _total
but glossed over the fact you've already mentioned that in the PR description.)
I think a flag is a good idea. But just to confirm, you do mean a runtime flag right? I think it would be a good idea in general to normalize the units, though it will require some refactoring. Let me know if you would like me to add it here. What would make this process easier is if One incongruity here is the fact that counters can only take an integer value. For instance, this makes it such that counters in seconds do not make much sense. However, for example prometheus uses f64, sentry uses f64 and otlp allows for the use of either f64 or i64. Perhaps then this should change in Another concern are the per second metrics. The advice from prometheus is to let the prometheus implementation compute the rate by itself. However, the prometheus guidance specifies the "power" unit, which is aggregated over time. So normalizing these but otherwise leaving them as-is could be an acceptable solution. |
I have a note to circle back around to this to re-review it and think about what we've discussed... time has just been hard to come by. 😅 |
Coming back to this again...
Yes, something that would end up being configured by
Definitely something for later.
I do realize that not using It's very unlikely that I will ever change this, at least before metrics v2.
The per-second units are a hold over.. I don't actually remember why I initially added them, but they're sort of pointless at this stage. Users are typically able to compute rates at query time, so dealing with it client-side is unnecessary, and if you actually only have access to a pre-computed rate (like pulling in metrics from a dependent library to be exporter with your app metrics), then it's probably just easier to manually suffix them as such... but that's a tangent. I'd say we could just pretend the per-second units don't exist because it's more likely than not that I'll remove them in the future. |
This adds units to the prometheus exporter metric lines as the prometheus naming conventions specify:
https://prometheus.io/docs/practices/naming/
The units without a prometheus equivalent such as kilobytes or bytes_per_second were left as is in order to not lose information given by the user.
I also think
_total
should be appended to all counters. However, that is for a future pull request.Closes #426.