Struct opentelemetry_api::metrics::ObservableUpDownCounter
source · [−]pub struct ObservableUpDownCounter<T>(_);
Available on crate feature
metrics
only.Expand description
An async instrument that records increasing or decreasing values.
Implementations
sourceimpl<T> ObservableUpDownCounter<T>
impl<T> ObservableUpDownCounter<T>
sourcepub fn new(inner: Arc<dyn AsyncUpDownCounter<T> + Send + Sync>) -> Self
pub fn new(inner: Arc<dyn AsyncUpDownCounter<T> + Send + Sync>) -> Self
Create a new observable up down counter.
sourcepub fn observe(&self, cx: &Context, value: T, attributes: &[KeyValue])
pub 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.
Trait Implementations
sourceimpl<T: Clone> Clone for ObservableUpDownCounter<T>
impl<T: Clone> Clone for ObservableUpDownCounter<T>
sourcefn clone(&self) -> ObservableUpDownCounter<T>
fn clone(&self) -> ObservableUpDownCounter<T>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<T> Debug for ObservableUpDownCounter<T>where
T: Debug,
impl<T> Debug for ObservableUpDownCounter<T>where
T: Debug,
sourceimpl TryFrom<InstrumentBuilder<'_, ObservableUpDownCounter<f64>>> for ObservableUpDownCounter<f64>
impl TryFrom<InstrumentBuilder<'_, ObservableUpDownCounter<f64>>> for ObservableUpDownCounter<f64>
type Error = MetricsError
type Error = MetricsError
The type returned in the event of a conversion error.
sourcefn try_from(
builder: InstrumentBuilder<'_, ObservableUpDownCounter<f64>>
) -> Result<Self, Self::Error>
fn try_from(
builder: InstrumentBuilder<'_, ObservableUpDownCounter<f64>>
) -> Result<Self, Self::Error>
Performs the conversion.
sourceimpl TryFrom<InstrumentBuilder<'_, ObservableUpDownCounter<i64>>> for ObservableUpDownCounter<i64>
impl TryFrom<InstrumentBuilder<'_, ObservableUpDownCounter<i64>>> for ObservableUpDownCounter<i64>
type Error = MetricsError
type Error = MetricsError
The type returned in the event of a conversion error.
sourcefn try_from(
builder: InstrumentBuilder<'_, ObservableUpDownCounter<i64>>
) -> Result<Self, Self::Error>
fn try_from(
builder: InstrumentBuilder<'_, ObservableUpDownCounter<i64>>
) -> Result<Self, Self::Error>
Performs the conversion.
Auto Trait Implementations
impl<T> !RefUnwindSafe for ObservableUpDownCounter<T>
impl<T> Send for ObservableUpDownCounter<T>
impl<T> Sync for ObservableUpDownCounter<T>
impl<T> Unpin for ObservableUpDownCounter<T>
impl<T> !UnwindSafe for ObservableUpDownCounter<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