[][src]Trait opentelemetry::api::metrics::gauge::Gauge

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

An interface for recording values where the metric cannot be expressed as a sum or because the measurement interval is arbitrary.

Associated Types

type Handle: GaugeHandle<T>

The handle type for the implementing Gauge.

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 gauge. 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 set(&self, value: T, label_set: &LS)

Assigns the passed value to the value of the gauge. 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...

Implementors

impl Gauge<f64, HashMap<Cow<'static, str>, Cow<'static, str>, RandomState>> for GaugeVec[src]

type Handle = GaugeHandle

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 Gauge<f64, NoopLabelSet> for NoopGauge<f64>[src]

type Handle = NoopHandle<f64>

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

Returns a no-op Measurement.

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

Returns a NoopHandle

impl Gauge<i64, HashMap<Cow<'static, str>, Cow<'static, str>, RandomState>> for IntGaugeVec[src]

type Handle = IntGaugeHandle

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 Gauge<i64, NoopLabelSet> for NoopGauge<i64>[src]

type Handle = NoopHandle<i64>

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

Returns a no-op Measurement.

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

Returns a NoopHandle

Loading content...