Struct opentelemetry_api::metrics::ObservableGauge
source · [−]pub struct ObservableGauge<T>(_);
Available on crate feature
metrics
only.Expand description
An instrument that records independent readings.
Implementations
sourceimpl<T> ObservableGauge<T>
impl<T> ObservableGauge<T>
sourcepub fn observe(&self, cx: &Context, value: T, attributes: &[KeyValue])
pub fn observe(&self, cx: &Context, value: T, attributes: &[KeyValue])
Records the state of the instrument.
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.
sourceimpl<T> ObservableGauge<T>
impl<T> ObservableGauge<T>
sourcepub fn new(inner: Arc<dyn AsyncGauge<T>>) -> Self
pub fn new(inner: Arc<dyn AsyncGauge<T>>) -> Self
Create a new gauge
Trait Implementations
sourceimpl<T: Clone> Clone for ObservableGauge<T>
impl<T: Clone> Clone for ObservableGauge<T>
sourcefn clone(&self) -> ObservableGauge<T>
fn clone(&self) -> ObservableGauge<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 ObservableGauge<T>where
T: Debug,
impl<T> Debug for ObservableGauge<T>where
T: Debug,
sourceimpl TryFrom<InstrumentBuilder<'_, ObservableGauge<f64>>> for ObservableGauge<f64>
impl TryFrom<InstrumentBuilder<'_, ObservableGauge<f64>>> for ObservableGauge<f64>
type Error = MetricsError
type Error = MetricsError
The type returned in the event of a conversion error.
sourcefn try_from(
builder: InstrumentBuilder<'_, ObservableGauge<f64>>
) -> Result<Self, Self::Error>
fn try_from(
builder: InstrumentBuilder<'_, ObservableGauge<f64>>
) -> Result<Self, Self::Error>
Performs the conversion.
sourceimpl TryFrom<InstrumentBuilder<'_, ObservableGauge<i64>>> for ObservableGauge<i64>
impl TryFrom<InstrumentBuilder<'_, ObservableGauge<i64>>> for ObservableGauge<i64>
type Error = MetricsError
type Error = MetricsError
The type returned in the event of a conversion error.
sourcefn try_from(
builder: InstrumentBuilder<'_, ObservableGauge<i64>>
) -> Result<Self, Self::Error>
fn try_from(
builder: InstrumentBuilder<'_, ObservableGauge<i64>>
) -> Result<Self, Self::Error>
Performs the conversion.
sourceimpl TryFrom<InstrumentBuilder<'_, ObservableGauge<u64>>> for ObservableGauge<u64>
impl TryFrom<InstrumentBuilder<'_, ObservableGauge<u64>>> for ObservableGauge<u64>
type Error = MetricsError
type Error = MetricsError
The type returned in the event of a conversion error.
sourcefn try_from(
builder: InstrumentBuilder<'_, ObservableGauge<u64>>
) -> Result<Self, Self::Error>
fn try_from(
builder: InstrumentBuilder<'_, ObservableGauge<u64>>
) -> Result<Self, Self::Error>
Performs the conversion.
Auto Trait Implementations
impl<T> !RefUnwindSafe for ObservableGauge<T>
impl<T> Send for ObservableGauge<T>
impl<T> Sync for ObservableGauge<T>
impl<T> Unpin for ObservableGauge<T>
impl<T> !UnwindSafe for ObservableGauge<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