metrics_util::registry

Trait Storage

source
pub trait Storage<K> {
    type Counter: CounterFn + Clone;
    type Gauge: GaugeFn + Clone;
    type Histogram: HistogramFn + Clone;

    // Required methods
    fn counter(&self, key: &K) -> Self::Counter;
    fn gauge(&self, key: &K) -> Self::Gauge;
    fn histogram(&self, key: &K) -> Self::Histogram;
}
Available on crate feature registry only.
Expand description

Defines the underlying storage for metrics as well as how to create them.

Required Associated Types§

source

type Counter: CounterFn + Clone

The type used for counters.

source

type Gauge: GaugeFn + Clone

The type used for gauges.

source

type Histogram: HistogramFn + Clone

The type used for histograms.

Required Methods§

source

fn counter(&self, key: &K) -> Self::Counter

Creates an empty counter.

source

fn gauge(&self, key: &K) -> Self::Gauge

Creates an empty gauge.

source

fn histogram(&self, key: &K) -> Self::Histogram

Creates an empty histogram.

Implementors§