Struct opentelemetry_api::metrics::ObservableCounter
source · pub struct ObservableCounter<T>(_);
Expand description
An async instrument that records increasing values.
Implementations§
source§impl<T> ObservableCounter<T>
impl<T> ObservableCounter<T>
source§impl<T> ObservableCounter<T>
impl<T> ObservableCounter<T>
sourcepub fn observe(&self, cx: &Context, value: T, attributes: &[KeyValue])
pub fn observe(&self, cx: &Context, value: T, attributes: &[KeyValue])
Records an increment to the counter.
It is only valid to call this within a callback. If called outside of the registered callback it should have no effect on the instrument, and an error will be reported via the error handler.
Trait Implementations§
source§impl<T> Debug for ObservableCounter<T>
impl<T> Debug for ObservableCounter<T>
source§impl TryFrom<InstrumentBuilder<'_, ObservableCounter<f64>>> for ObservableCounter<f64>
impl TryFrom<InstrumentBuilder<'_, ObservableCounter<f64>>> for ObservableCounter<f64>
§type Error = MetricsError
type Error = MetricsError
The type returned in the event of a conversion error.
source§fn try_from(
builder: InstrumentBuilder<'_, ObservableCounter<f64>>
) -> Result<Self, Self::Error>
fn try_from( builder: InstrumentBuilder<'_, ObservableCounter<f64>> ) -> Result<Self, Self::Error>
Performs the conversion.
source§impl TryFrom<InstrumentBuilder<'_, ObservableCounter<u64>>> for ObservableCounter<u64>
impl TryFrom<InstrumentBuilder<'_, ObservableCounter<u64>>> for ObservableCounter<u64>
§type Error = MetricsError
type Error = MetricsError
The type returned in the event of a conversion error.
source§fn try_from(
builder: InstrumentBuilder<'_, ObservableCounter<u64>>
) -> Result<Self, Self::Error>
fn try_from( builder: InstrumentBuilder<'_, ObservableCounter<u64>> ) -> Result<Self, Self::Error>
Performs the conversion.