Crate prometheus_utils

Source
Expand description

Utilities for working with Prometheus metrics in Rust

This crate builds on the Promtheus crate to provide API with additional safety guardrails:

Modules§

paste_crate

Macros§

label_enum
Declare an enum intended to be used as a Prometheus label.

Structs§

DeferredAdd
A guard that will automatically increment a GenericCounter when dropped.
DeferredAddWithLabels
A guard that will automatically increment a labeled metric when dropped.
GenericGaugeGuard
An RAII-style guard for situations where we want to increment a gauge and then ensure that there is always a corresponding decrement.
HistogramWithLabels
A Prometheus histogram metric, with labels described by the type L.
InstrumentedFuture
An instrumented Future.
IntCounterWithLabels
A Prometheus integer counter metric, with labels described by the type L.
IntGaugeWithLabels
A Prometheus integer gauge metric, with labels described by the type L.
Observations
Collect observations, which are sampled as a Sample.
Sample
A sample of the state in Observations.
Windowing
Windowing is a mechanism for rotating between different observations. It provides an accessor Windowing::current for the current observation, and a method Windowing::cycle_windows which makes the next observation in the ring current, and returns the observation which was current prior to the call.

Enums§

TimingBucket
Labels corresponding to the fields in Sample

Traits§

DeferredCounter
An extension trait for GenericCounter to provide methods for incrementing a counter once an RAII-style guard has been dropped.
GuardedGauge
An extension trait for GenericGauge to provide methods for temporarily modifying a gauge.
IntoInstrumentedFuture
Convert a Future into an instrumented future.
Labels
The Labels trait applies to values intended to generate Prometheus labels for a metric.

Type Aliases§

GaugeGuard
An RAII-style guard for an AtomicF64 gauge.
IntGaugeGuard
An RAII-style guard for an AtomicI64 gauge.
LabelValues
A sequence of values for Prometheus labels