-
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
is counter macro supports floating point values? #367
Comments
as i see openmetrics are u64 or f64 prometheus/OpenMetrics#262 . for me allow f64 in counter! and may be casting u128 to f64 behind scenes is good option to try to support fintech/crypto domains |
No, it does not. This is an intentional choice to ensure that counters are monotonically increasing, which would not be guaranteed if floating-point values were accepted, as negative values could be given, leading to the overall counter value decreasing. If floating-point values are desired, gauges can be used instead, as helpers such as |
hm. gauge is awesome. will use. it is for tracking some long lived entity (in my case account). but how to use gauge to track transfers? it may be huge amount gagues. is any paper on itsq equivalence? |
@tobz may you reconsdier you opinion? |
Guaranteeing positive values at the type-level is nice, however using a gauge and pretending it's a counter is not ideal. Prometheus has builtin features to deal with counter resets that are not available for gauge metric types (e.g. you cannot use the So in order to record total request times, you'd have to either:
These hacks could be avoided either by:
|
@tamasfe It's unfortunate that our choice to constrain counters to If people are primarily interacting with Prometheus, and want an experience that matches the Prometheus conventions more closely, both the |
We've just switched from
It's not just Prometheus, OpenTelemetry also recently chose to recommend seconds as the unit of measurement for durations after a long debate.
I'd be happy to submit a PR for it. |
No description provided.
The text was updated successfully, but these errors were encountered: