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();Implementations
Trait Implementations
sourceimpl<N, A> EncodeMetric for Gauge<N, A> where
N: Encode,
A: Atomic<N>,
impl<N, A> EncodeMetric for Gauge<N, A> where
N: Encode,
A: Atomic<N>,
fn encode(&self, encoder: Encoder<'_, '_>) -> Result<(), Error>
fn metric_type(&self) -> MetricType
sourceimpl<N, A> TypedMetric for Gauge<N, A>
impl<N, A> TypedMetric for Gauge<N, A>
const TYPE: MetricType = MetricType::Gauge
Auto Trait Implementations
impl<N, A> RefUnwindSafe for Gauge<N, A> where
A: RefUnwindSafe,
N: RefUnwindSafe,
impl<N, A> Send for Gauge<N, A> where
A: Send + Sync,
N: Send,
impl<N, A> Sync for Gauge<N, A> where
A: Send + Sync,
N: Sync,
impl<N, A> Unpin for Gauge<N, A> where
N: Unpin,
impl<N, A> UnwindSafe for Gauge<N, A> where
A: RefUnwindSafe,
N: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more