Trait opentelemetry::metrics::AsyncInstrument

source ·
pub trait AsyncInstrument<T>: Send + Sync {
    // Required methods
    fn observe(&self, measurement: T, attributes: &[KeyValue]);
    fn as_any(&self) -> Arc<dyn Any>;
}
Available on crate feature metrics only.
Expand description

An SDK implemented instrument that records measurements via callback.

Required Methods§

source

fn observe(&self, measurement: T, attributes: &[KeyValue])

Observes the state of the instrument.

It is only valid to call this within a callback.

source

fn as_any(&self) -> Arc<dyn Any>

Used for SDKs to downcast instruments in callbacks.

Implementors§