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

A metric for capturing gauges.

Gauge values are an instantaneous measurement of a value determined by the client. They do not change unless changed by the client. Examples include things like load average or how many connections are active.

§Example

use relay_statsd::{metric, GaugeMetric};

struct QueueSize;

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

let queue = VecDeque::new();

// a simple gauge value
metric!(gauge(QueueSize) = queue.len() as u64);

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

Required Methods§

source

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

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

Implementors§