[][src]Trait metrics_core::Observer

pub trait Observer {
    fn observe_counter(&mut self, key: Key, value: u64);
fn observe_gauge(&mut self, key: Key, value: i64);
fn observe_histogram(&mut self, key: Key, values: &[u64]); }

A value that observes metrics.

Required methods

fn observe_counter(&mut self, key: Key, value: u64)

The method called when a counter is observed.

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 exporter side, both are provided.

fn observe_gauge(&mut self, key: Key, value: i64)

The method called when a gauge is observed.

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 exporter side, both are provided.

fn observe_histogram(&mut self, key: Key, values: &[u64])

The method called when an histogram is observed.

Observers are expected to tally their own histogram views, so this will be called with all of the underlying observed values, and callers will need to process them accordingly.

There is no guarantee that this method will not be called multiple times for the same key.

Loading content...

Implementors

Loading content...