pub struct ObservableGauge<T>(_);
Available on crate feature metrics only.
Expand description

An instrument that records independent readings.

Implementations§

source§

impl<T> ObservableGauge<T>

source

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>

source

pub fn new(inner: Arc<dyn AsyncGauge<T> + 'static>) -> ObservableGauge<T>

Create a new gauge

Trait Implementations§

source§

impl<T> Clone for ObservableGauge<T>where T: Clone,

source§

fn clone(&self) -> ObservableGauge<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T> Debug for ObservableGauge<T>where T: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl TryFrom<InstrumentBuilder<'_, ObservableGauge<f64>>> for ObservableGauge<f64>

§

type Error = MetricsError

The type returned in the event of a conversion error.
source§

fn try_from( builder: InstrumentBuilder<'_, ObservableGauge<f64>> ) -> Result<ObservableGauge<f64>, <ObservableGauge<f64> as TryFrom<InstrumentBuilder<'_, ObservableGauge<f64>>>>::Error>

Performs the conversion.
source§

impl TryFrom<InstrumentBuilder<'_, ObservableGauge<i64>>> for ObservableGauge<i64>

§

type Error = MetricsError

The type returned in the event of a conversion error.
source§

fn try_from( builder: InstrumentBuilder<'_, ObservableGauge<i64>> ) -> Result<ObservableGauge<i64>, <ObservableGauge<i64> as TryFrom<InstrumentBuilder<'_, ObservableGauge<i64>>>>::Error>

Performs the conversion.
source§

impl TryFrom<InstrumentBuilder<'_, ObservableGauge<u64>>> for ObservableGauge<u64>

§

type Error = MetricsError

The type returned in the event of a conversion error.
source§

fn try_from( builder: InstrumentBuilder<'_, ObservableGauge<u64>> ) -> Result<ObservableGauge<u64>, <ObservableGauge<u64> as TryFrom<InstrumentBuilder<'_, ObservableGauge<u64>>>>::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§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FutureExt for T

source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V