-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
metrics: Expose process_cpu_seconds_total as a float (#754)
Prometheus handles all values as `f64`, but we only expose values as whole integers. This means that the `process_cpu_seconds_total` metric only exposes whole second values, while Linux exposes process time in 10ms increments. This change modifies the `Counter` metric type to store an additional marker that provides a strategy for converting the stored `u64` value to `f64` for export. This strategy is employed so that we can continue to use `AtomicU64` to back counters and only use floats at export-time. By default the unit type is used to convert counters as before, but an alternate `MillisAsSeconds` strategy is used to expose fractional seconds from a millisecond counter. This necessitates changing the histogram buckets to floats as well. While this change doesn't modify the bucket values, this sets up future changes to latency metrics.
- Loading branch information
Showing
7 changed files
with
240 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.