Skip to main content

Observation

Enum Observation 

Source
pub enum Observation<L> {
    Observed {
        label: L,
        count: u64,
        timestamp: Instant,
    },
    ObservedOne {
        label: L,
        timestamp: Instant,
    },
    ObservedOneValue {
        label: L,
        value: ObservedValue,
        timestamp: Instant,
    },
}
Expand description

An observation that has been made.

Be aware that not all instruments handle all observations or values. E.g. a Meter does not take the value of an Observation::ObservedOneValue into account but simply counts the observation as one occurrence.

Variants§

§

Observed

Observed many occurrences with no value at the given timestamp

Fields

§label: L
§count: u64
§timestamp: Instant
§

ObservedOne

Observed one occurrence without a value at the given timestamp

Fields

§label: L
§timestamp: Instant
§

ObservedOneValue

Observed one occurrence with a value at a given timestamp.

Fields

§label: L
§timestamp: Instant

Implementations§

Source§

impl<L> Observation<L>

Source

pub fn observed(label: L, count: u64, timestamp: Instant) -> Self

Source

pub fn observed_now(label: L, count: u64) -> Self

Source

pub fn observed_one(label: L, timestamp: Instant) -> Self

Source

pub fn observed_one_now(label: L) -> Self

Source

pub fn observed_one_value<T: Into<ObservedValue>>( label: L, value: T, timestamp: Instant, ) -> Self

Source

pub fn observed_one_value_now<T: Into<ObservedValue>>( label: L, value: T, ) -> Self

Source§

impl<L> Observation<L>

Source

pub fn label(&self) -> &L

Extracts the label L from an observation.

Source§

impl<L> Observation<L>

Source

pub fn timestamp(&self) -> Instant

Trait Implementations§

Source§

impl<L: Debug> Debug for Observation<L>

Source§

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

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

impl<'a, T> From<&'a Observation<T>> for BorrowedLabelAndUpdate<'a, T>

Source§

fn from(obs: &'a Observation<T>) -> BorrowedLabelAndUpdate<'a, T>

Converts to this type from the input type.
Source§

impl<T> From<Observation<T>> for LabelAndUpdate<T>

Source§

fn from(obs: Observation<T>) -> LabelAndUpdate<T>

Converts to this type from the input type.
Source§

impl<L> ObservationLike for Observation<L>

Source§

fn timestamp(&self) -> Instant

Source§

fn is_delta(&self) -> bool

Observations which are deltas should not be skipped when there are too many incoming metrics

Auto Trait Implementations§

§

impl<L> Freeze for Observation<L>
where L: Freeze,

§

impl<L> RefUnwindSafe for Observation<L>
where L: RefUnwindSafe,

§

impl<L> Send for Observation<L>
where L: Send,

§

impl<L> Sync for Observation<L>
where L: Sync,

§

impl<L> Unpin for Observation<L>
where L: Unpin,

§

impl<L> UnsafeUnpin for Observation<L>
where L: UnsafeUnpin,

§

impl<L> UnwindSafe for Observation<L>
where L: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V