[][src]Trait opentelemetry::api::metrics::counter::Counter

pub trait Counter<T, LS>: Instrument<LS> where
    T: Into<MeasurementValue>,
    LS: LabelSet
{ type Handle: CounterHandle<T>; fn measurement(&self, value: T) -> Measurement<LS>;
fn acquire_handle(&self, labels: &LS) -> Self::Handle; fn add(&self, value: T, label_set: &LS) { ... } }

An interface for recording values where the sum is of primary interest.

Associated Types

type Handle: CounterHandle<T>

The handle type for the implementing Counter.

Loading content...

Required methods

fn measurement(&self, value: T) -> Measurement<LS>

Creates a Measurement object to be used by a Meter when batch recording.

fn acquire_handle(&self, labels: &LS) -> Self::Handle

Creates a handle for this counter. The labels should contain the keys and values for each key specified in the LabelSet.

If the labels do not contain a value for the key specified in the LabelSet, then the missing value will be treated as unspecified.

Loading content...

Provided methods

fn add(&self, value: T, label_set: &LS)

Adds the value to the Counter's sum.

Loading content...

Implementors

impl Counter<f64, HashMap<Cow<'static, str>, Cow<'static, str>, RandomState>> for CounterVec[src]

type Handle = CounterHandle

fn measurement(&self, value: f64) -> Measurement<LabelSet>[src]

Creates a Measurement object to be used by a Meter when batch recording.

fn acquire_handle(&self, labels: &LabelSet) -> Self::Handle[src]

Creates a handle for this instrument.

impl Counter<i64, HashMap<Cow<'static, str>, Cow<'static, str>, RandomState>> for IntCounterVec[src]

type Handle = IntCounterHandle

Prometheus' CounterHandle

fn measurement(&self, value: i64) -> Measurement<LabelSet>[src]

Creates a Measurement object to be used by a Meter when batch recording.

fn acquire_handle(&self, labels: &LabelSet) -> Self::Handle[src]

Creates a handle for this instrument.

impl<T: Into<MeasurementValue> + 'static> Counter<T, NoopLabelSet> for NoopCounter<T>[src]

type Handle = NoopHandle<T>

fn measurement(&self, value: T) -> Measurement<NoopLabelSet>[src]

Returns a no-op Measurement.

fn acquire_handle(&self, _labels: &NoopLabelSet) -> Self::Handle[src]

Returns a NoopHandle

Loading content...