Skip to main content

Metrics

Trait Metrics 

Source
pub trait Metrics: MaybeSend + MaybeSync {
    // Required methods
    fn incr(&self, name: &'static str, labels: &[(&'static str, &str)], by: u64);
    fn observe_ms(
        &self,
        name: &'static str,
        labels: &[(&'static str, &str)],
        ms: f64,
    );

    // Provided method
    fn gauge(
        &self,
        _name: &'static str,
        _labels: &[(&'static str, &str)],
        _value: f64,
    ) { ... }
}
Expand description

Metrics sink. Label values are borrowed so a hot path allocates nothing.

Required Methods§

Source

fn incr(&self, name: &'static str, labels: &[(&'static str, &str)], by: u64)

Add by to the counter name.

Source

fn observe_ms( &self, name: &'static str, labels: &[(&'static str, &str)], ms: f64, )

Record one observation, in milliseconds, in the histogram name.

Provided Methods§

Source

fn gauge( &self, _name: &'static str, _labels: &[(&'static str, &str)], _value: f64, )

Set a gauge. Sinks without gauge support may discard it.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§