fix(encoding): use +Inf as the implicit histogram overflow bucket bound (#343)
- fix(encoding): use +Inf as the implicit histogram overflow bucket bound
Signed-off-by: Gheorghita MUTU gheorghitamutu@gmail.com
- fix(encoding): drop non-finite bucket bounds in Histogram::new
The overflow bucket is implicit and now genuinely +Inf, so an explicitly configured f64::INFINITY bound produced two le=”+Inf” series for the same metric, which is invalid exposition. client_golang strips an explicitly-configured +Inf bound for the same reason.
NaN and -Inf bounds are dropped as well: observe_classic matches with upper_bound >= v, and every comparison against NaN is false, so a NaN bound could never receive an observation.
Regression test asserts a single +Inf bucket both on the bucket list and on the rendered text exposition. It fails without the filter with buckets=[(1.0, 1), (inf, 0), (NaN, 0), (-inf, 0), (inf, 0)].
Signed-off-by: Gheorghita MUTU gheorghitamutu@gmail.com
- test(histogram): order the overflow-bucket tests to match their doc comments
Signed-off-by: Gheorghita MUTU gheorghitamutu@gmail.com
Signed-off-by: Gheorghita MUTU gheorghitamutu@gmail.com
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号
Prometheus Rust client library
Rust client library implementation of the Open Metrics specification. Allows developers to instrument applications and thus enables operators to monitor said applications with monitoring systems like Prometheus.
Documentation: https://docs.rs/prometheus-client/
Goals
No
unsafe. Don’t use unsafe Rust within the library itself.Type safe. Leverage Rust’s type system to catch common instrumentation mistakes at compile time.
Fast. Don’t force users to worry about the performance impact of instrumentation. Instead encourage users to instrument often and extensively.
Specification Compliance
Below is a list of properties where this client library implementation lags behind the Open Metrics specification. Not being compliant with all requirements (
MUSTandMUST NOT) of the specification is considered a bug and likely to be fixed in the future. Contributions in all forms are most welcome.State set metric.
Enforce “A Histogram MetricPoint MUST contain at least one bucket”.
Enforce “A MetricFamily MUST have a […] UNIT metadata”.
Enforce “MetricFamily names […] MUST be unique within a MetricSet.”
Enforce “Names SHOULD be in snake_case”.
Enforce “MetricFamily names beginning with underscores are RESERVED and MUST NOT be used unless specified by this standard”.
Enforce “Exposers SHOULD avoid names that could be confused with the suffixes that text format sample metric names use”.
Gauge histogram metric.
Allow “A MetricPoint in a Metric with the type [Counter, Histogram] SHOULD have a Timestamp value called Created”.
Summary metric.
Related Libraries
License
Licensed under either of
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.