[][src]Trait metrics_core::MetricsObserver

pub trait MetricsObserver {
    fn observe_counter<K: AsRef<str>>(&mut self, key: K, value: u64);
fn observe_gauge<K: AsRef<str>>(&mut self, key: K, value: i64);
fn observe_histogram<K: AsRef<str>>(
        &mut self,
        key: K,
        quantiles: &[(f64, u64)]
    ); }

A value that observes collected metrics.

Required methods

fn observe_counter<K: AsRef<str>>(&mut self, key: K, value: u64)

Observes a counter.

From the perspective of an observer, a counter and gauge are essentially identical, insofar as they are both a single value tied to a key. From the perspective of a collector, counters and gauges usually have slightly different modes of operation.

For the sake of flexibility on the observer side, both are provided.

fn observe_gauge<K: AsRef<str>>(&mut self, key: K, value: i64)

Observes a gauge.

From the perspective of a observer, a counter and gauge are essentially identical, insofar as they are both a single value tied to a key. From the perspective of a collector, counters and gauges usually have slightly different modes of operation.

For the sake of flexibility on the observer side, both are provided.

fn observe_histogram<K: AsRef<str>>(&mut self, key: K, quantiles: &[(f64, u64)])

Observes a histogram.

The quantiles are expected to be in the format of (quantile, value_at_quantile).

Quantiles are a value from 0 to 1, inclusive. Values outside of this range are considered invalid, but it is an implementation detail of the observer on how to handle them.

Loading content...

Implementors

Loading content...