Struct opentelemetry_api::metrics::ObservableCounter
source · [−]pub struct ObservableCounter<T>(_);
Available on crate feature
metrics
only.Expand description
An async instrument that records increasing values.
Implementations
sourceimpl<T> ObservableCounter<T>
impl<T> ObservableCounter<T>
sourceimpl<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
sourceimpl<T> Debug for ObservableCounter<T>
impl<T> Debug for ObservableCounter<T>
sourceimpl 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.
sourcefn try_from(
builder: InstrumentBuilder<'_, ObservableCounter<f64>>
) -> Result<Self, Self::Error>
fn try_from(
builder: InstrumentBuilder<'_, ObservableCounter<f64>>
) -> Result<Self, Self::Error>
Performs the conversion.
sourceimpl 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.
sourcefn try_from(
builder: InstrumentBuilder<'_, ObservableCounter<u64>>
) -> Result<Self, Self::Error>
fn try_from(
builder: InstrumentBuilder<'_, ObservableCounter<u64>>
) -> Result<Self, Self::Error>
Performs the conversion.
Auto Trait Implementations
impl<T> !RefUnwindSafe for ObservableCounter<T>
impl<T> Send for ObservableCounter<T>
impl<T> Sync for ObservableCounter<T>
impl<T> Unpin for ObservableCounter<T>
impl<T> !UnwindSafe for ObservableCounter<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more