Trait telemetry::plain::Histogram[][src]

pub trait Histogram<T>: Clone {
    fn record_cb<F>(&self, _: F)
    where
        F: FnOnce() -> Option<T>
; fn record(&self, value: T) { ... } }

A plain histogram.

Histograms do not implement Sync, so an instance of Histogram cannot be shared by several threads. However, any histogram can be cloned as needed for concurrent use.

Performance

Cloning a histogram is relatively cheap, both in terms of memory and in terms of speed (most histograms weigh ~40bytes on a x86-64 architecture).

When the telemetry service is inactive, recording data to a histogram is very fast (essentially a dereference and an atomic fetch). When the telemetry service is active, the duration of recording data is comparable to the duration of sending a simple message to a Sender.

Required methods

fn record_cb<F>(&self, _: F) where
    F: FnOnce() -> Option<T>, 
[src]

Record a value in this histogram, as provided by a callback.

If the service is currently inactive, this is a noop.

If the callback returns None, no value is recorded.

Loading content...

Provided methods

fn record(&self, value: T)[src]

Record a value in this histogram.

If the service is currently inactive, this is a noop.

Loading content...

Implementors

impl Histogram<u32> for Count[src]

impl Histogram<()> for Flag[src]

impl<K> Histogram<K> for Enum<K> where
    K: Flatten
[src]

impl<T> Histogram<T> for Ignoring<T>[src]

impl<T> Histogram<T> for Linear<T> where
    T: Flatten
[src]

Loading content...