pub trait HistogramMetric {
    // Required method
    fn name(&self) -> &'static str;
}
Expand description

A metric for capturing histograms.

Histograms are values whose distribution is calculated by the server. The distribution calculated for histograms is often similar to that of timers. Histograms can be thought of as a more general (not limited to timing things) form of timers.

§Example

use relay_statsd::{metric, HistogramMetric};

struct QueueSize;

impl HistogramMetric for QueueSize {
    fn name(&self) -> &'static str {
        "queue_size"
    }
}

let queue = VecDeque::new();

// record a histogram value
metric!(histogram(QueueSize) = queue.len() as u64);

// record with tags
metric!(
    histogram(QueueSize) = queue.len() as u64,
    server = "server1",
    host = "host1",
);

Required Methods§

source

fn name(&self) -> &'static str

Returns the histogram metric name that will be sent to statsd.

Implementors§