Skip to main content

Gauge

Trait Gauge 

Source
pub trait Gauge: Send + Sync {
    // Required method
    fn value(&self, config: &MetricConfig, now: i64) -> MetricValue;
}
Expand description

A gauge metric is an instantaneous reading of a particular value.

In Java Gauge<T> extends MetricValueProvider<T> and is a functional interface producing a value of type T. Because the public metric value is type-erased, the Rust gauge produces a MetricValue.

Required Methods§

Source

fn value(&self, config: &MetricConfig, now: i64) -> MetricValue

Returns the current value associated with this gauge.

  • config - The configuration for this metric
  • now - The POSIX time in milliseconds the measurement is being taken

Implementors§

Source§

impl<F> Gauge for ClosureGauge<F>
where F: Fn(&MetricConfig, i64) -> MetricValue + Send + Sync,