Struct prometheus_client::metrics::gauge::Gauge
source · Expand description
Open Metrics Gauge
to record current measurements.
Single increasing, decreasing or constant value metric.
Gauge
is generic over the actual data type tracking the Gauge
state
as well as the data type used to interact with the Gauge
. Out of
convenience the generic type parameters are set to use an AtomicU64
as a
storage and u64
on the interface by default.
Examples
Using AtomicU64
as storage and u64
on the interface
let gauge: Gauge = Gauge::default();
gauge.set(42u64);
let _value: u64 = gauge.get();
Using AtomicU64
as storage and f64
on the interface
let gauge = Gauge::<f64, AtomicU64>::default();
gauge.set(42.0);
let _value: f64 = gauge.get();