Struct opentelemetry_api::metrics::ObservableGauge
source · pub struct ObservableGauge<T>(_);
Expand description
An instrument that records independent readings.
Implementations§
source§impl<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.
source§impl<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§
source§impl<T: Clone> Clone for ObservableGauge<T>
impl<T: Clone> Clone for ObservableGauge<T>
source§fn clone(&self) -> ObservableGauge<T>
fn clone(&self) -> ObservableGauge<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T> Debug for ObservableGauge<T>where
T: Debug,
impl<T> Debug for ObservableGauge<T>where T: Debug,
source§impl 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.
source§fn try_from(
builder: InstrumentBuilder<'_, ObservableGauge<f64>>
) -> Result<Self, Self::Error>
fn try_from( builder: InstrumentBuilder<'_, ObservableGauge<f64>> ) -> Result<Self, Self::Error>
Performs the conversion.
source§impl 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.
source§fn try_from(
builder: InstrumentBuilder<'_, ObservableGauge<i64>>
) -> Result<Self, Self::Error>
fn try_from( builder: InstrumentBuilder<'_, ObservableGauge<i64>> ) -> Result<Self, Self::Error>
Performs the conversion.
source§impl 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.
source§fn try_from(
builder: InstrumentBuilder<'_, ObservableGauge<u64>>
) -> Result<Self, Self::Error>
fn try_from( builder: InstrumentBuilder<'_, ObservableGauge<u64>> ) -> Result<Self, Self::Error>
Performs the conversion.