hopr_metrics::metrics

Struct MultiHistogram

Source
pub struct MultiHistogram { /* private fields */ }
Expand description

Represents a vector of histograms with floating point values. Wrapper for HistogramVec type

Implementations§

Source§

impl MultiHistogram

Source

pub fn record_measure(&self, timer: SimpleTimer)

Stops the given timer and records the elapsed duration in seconds to the multi-histogram.

Source

pub fn cancel_measure(&self, timer: SimpleTimer) -> f64

Stops the given timer and discards the measured duration in seconds and returns it.

Source

pub fn name(&self) -> String

Returns the name of the histogram given at construction.

Source§

impl MultiHistogram

Source

pub fn new( name: &str, description: &str, buckets: Vec<f64>, labels: &[&str], ) -> Result<Self>

Creates a new histogram with the given name, description and buckets. If no buckets are specified, they will be defined automatically. The +Inf bucket is always added automatically.

Source

pub fn start_measure(&self, label_values: &[&str]) -> Result<SimpleTimer>

Starts a timer for a histogram with the given labels.

Source

pub fn observe(&self, label_values: &[&str], value: f64)

Records a value observation to the histogram with the given labels.

Source

pub fn get_sample_count(&self, label_values: &[&str]) -> Option<u64>

Get all samples count with given labels

Source

pub fn get_sample_sum(&self, label_values: &[&str]) -> Option<f64>

Get all samples sum with given labels

Source

pub fn labels(&self) -> Vec<&str>

Returns the labels of the counters given at construction.

Auto Trait Implementations§

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.