#prometheus-metrics #open-metrics #prometheus #metrics #monitoring #instrumentation

prometheus-client

Open Metrics client library allowing users to natively instrument applications

18 releases

0.22.3 Jul 17, 2024
0.22.2 Mar 7, 2024
0.22.1 Jan 30, 2024
0.22.0 Oct 25, 2023
0.15.1 Feb 4, 2022

#97 in Debugging

Download history 109947/week @ 2024-07-23 104801/week @ 2024-07-30 104156/week @ 2024-08-06 121674/week @ 2024-08-13 107824/week @ 2024-08-20 121193/week @ 2024-08-27 129314/week @ 2024-09-03 117435/week @ 2024-09-10 114791/week @ 2024-09-17 117593/week @ 2024-09-24 127162/week @ 2024-10-01 136829/week @ 2024-10-08 136902/week @ 2024-10-15 141509/week @ 2024-10-22 130029/week @ 2024-10-29 133818/week @ 2024-11-05

567,989 downloads per month
Used in 402 crates (65 directly)

Apache-2.0 OR MIT

160KB
3K SLoC

Prometheus Rust client library

Test Status Crate API

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 (MUST and MUST 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.

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.

Dependencies

~0.7–6.5MB
~41K SLoC