pub trait DistributionMetric {
// Required method
fn name(&self) -> &'static str;
}Expand description
A metric for capturing distributions.
A distribution is often similar to timers. Distributions can be thought of as a more general (not limited to timing things) form of timers.
§Example
use relay_statsd::{metric, DistributionMetric};
struct QueueSize;
impl DistributionMetric for QueueSize {
fn name(&self) -> &'static str {
"queue_size"
}
}
let queue = VecDeque::new();
// record a distribution value
metric!(distribution(QueueSize) = queue.len() as u64);
// record with tags
metric!(
distribution(QueueSize) = queue.len() as u64,
server = "server1",
host = "host1",
);