Trait opentelemetry_api::metrics::AsyncUpDownCounter
source · pub trait AsyncUpDownCounter<T> {
// Required method
fn observe(&self, cx: &Context, value: T, attributes: &[KeyValue]);
}
Expand description
An SDK implemented async instrument that records increasing or decreasing values.
Required Methods§
sourcefn observe(&self, cx: &Context, value: T, attributes: &[KeyValue])
fn observe(&self, cx: &Context, value: T, attributes: &[KeyValue])
Records the increment or decrement 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.