pd::metrics

Trait Recorder

pub trait Recorder {
    // Required methods
    fn describe_counter(
        &self,
        key: KeyName,
        unit: Option<Unit>,
        description: Cow<'static, str>,
    );
    fn describe_gauge(
        &self,
        key: KeyName,
        unit: Option<Unit>,
        description: Cow<'static, str>,
    );
    fn describe_histogram(
        &self,
        key: KeyName,
        unit: Option<Unit>,
        description: Cow<'static, str>,
    );
    fn register_counter(&self, key: &Key, metadata: &Metadata<'_>) -> Counter;
    fn register_gauge(&self, key: &Key, metadata: &Metadata<'_>) -> Gauge;
    fn register_histogram(
        &self,
        key: &Key,
        metadata: &Metadata<'_>,
    ) -> Histogram;
}
Expand description

A trait for registering and recording metrics.

This is the core trait that allows interoperability between exporter implementations and the macros provided by metrics.

Required Methods§

fn describe_counter( &self, key: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )

Describes a counter.

Callers may provide the unit or a description of the counter being registered. Whether or not a metric can be reregistered to provide a unit/description, if one was already passed or not, as well as how units/descriptions are used by the underlying recorder, is an implementation detail.

fn describe_gauge( &self, key: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )

Describes a gauge.

Callers may provide the unit or a description of the gauge being registered. Whether or not a metric can be reregistered to provide a unit/description, if one was already passed or not, as well as how units/descriptions are used by the underlying recorder, is an implementation detail.

fn describe_histogram( &self, key: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )

Describes a histogram.

Callers may provide the unit or a description of the histogram being registered. Whether or not a metric can be reregistered to provide a unit/description, if one was already passed or not, as well as how units/descriptions are used by the underlying recorder, is an implementation detail.

fn register_counter(&self, key: &Key, metadata: &Metadata<'_>) -> Counter

Registers a counter.

fn register_gauge(&self, key: &Key, metadata: &Metadata<'_>) -> Gauge

Registers a gauge.

fn register_histogram(&self, key: &Key, metadata: &Metadata<'_>) -> Histogram

Registers a histogram.

Implementations on Foreign Types§

§

impl Recorder for DebuggingRecorder

§

fn describe_counter( &self, key: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )

§

fn describe_gauge( &self, key: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )

§

fn describe_histogram( &self, key: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )

§

fn register_counter(&self, key: &Key, _metadata: &Metadata<'_>) -> Counter

§

fn register_gauge(&self, key: &Key, _metadata: &Metadata<'_>) -> Gauge

§

fn register_histogram(&self, key: &Key, _metadata: &Metadata<'_>) -> Histogram

§

impl Recorder for Fanout

§

fn describe_counter( &self, key_name: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )

§

fn describe_gauge( &self, key_name: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )

§

fn describe_histogram( &self, key_name: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )

§

fn register_counter(&self, key: &Key, metadata: &Metadata<'_>) -> Counter

§

fn register_gauge(&self, key: &Key, metadata: &Metadata<'_>) -> Gauge

§

fn register_histogram(&self, key: &Key, metadata: &Metadata<'_>) -> Histogram

§

impl Recorder for PrometheusRecorder

§

fn describe_counter( &self, key_name: KeyName, _unit: Option<Unit>, description: Cow<'static, str>, )

§

fn describe_gauge( &self, key_name: KeyName, _unit: Option<Unit>, description: Cow<'static, str>, )

§

fn describe_histogram( &self, key_name: KeyName, _unit: Option<Unit>, description: Cow<'static, str>, )

§

fn register_counter(&self, key: &Key, _metadata: &Metadata<'_>) -> Counter

§

fn register_gauge(&self, key: &Key, _metadata: &Metadata<'_>) -> Gauge

§

fn register_histogram(&self, key: &Key, _metadata: &Metadata<'_>) -> Histogram

§

impl Recorder for Router

§

fn describe_counter( &self, key_name: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )

§

fn describe_gauge( &self, key_name: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )

§

fn describe_histogram( &self, key_name: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )

§

fn register_counter(&self, key: &Key, metadata: &Metadata<'_>) -> Counter

§

fn register_gauge(&self, key: &Key, metadata: &Metadata<'_>) -> Gauge

§

fn register_histogram(&self, key: &Key, metadata: &Metadata<'_>) -> Histogram

§

impl<R> Recorder for Filter<R>
where R: Recorder,

§

fn describe_counter( &self, key_name: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )

§

fn describe_gauge( &self, key_name: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )

§

fn describe_histogram( &self, key_name: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )

§

fn register_counter(&self, key: &Key, metadata: &Metadata<'_>) -> Counter

§

fn register_gauge(&self, key: &Key, metadata: &Metadata<'_>) -> Gauge

§

fn register_histogram(&self, key: &Key, metadata: &Metadata<'_>) -> Histogram

§

impl<R> Recorder for Prefix<R>
where R: Recorder,

§

fn describe_counter( &self, key_name: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )

§

fn describe_gauge( &self, key_name: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )

§

fn describe_histogram( &self, key_name: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )

§

fn register_counter(&self, key: &Key, metadata: &Metadata<'_>) -> Counter

§

fn register_gauge(&self, key: &Key, metadata: &Metadata<'_>) -> Gauge

§

fn register_histogram(&self, key: &Key, metadata: &Metadata<'_>) -> Histogram

§

impl<R> Recorder for Stack<R>
where R: Recorder,

§

fn describe_counter( &self, key_name: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )

§

fn describe_gauge( &self, key_name: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )

§

fn describe_histogram( &self, key_name: KeyName, unit: Option<Unit>, description: Cow<'static, str>, )

§

fn register_counter(&self, key: &Key, metadata: &Metadata<'_>) -> Counter

§

fn register_gauge(&self, key: &Key, metadata: &Metadata<'_>) -> Gauge

§

fn register_histogram(&self, key: &Key, metadata: &Metadata<'_>) -> Histogram

Implementors§