Struct metrics_util::Histogram[][src]

pub struct Histogram { /* fields omitted */ }

A bucketed histogram.

This histogram tracks the number of samples that fall into pre-defined buckets, rather than exposing any sort of quantiles.

This type is most useful with systems that prefer bucketed data, such as Prometheus’ histogram type, as opposed to its summary type, which deals with quantiles.

Implementations

impl Histogram[src]

pub fn new(bounds: &[f64]) -> Option<Histogram>[src]

Creates a new Histogram.

If bounds is empty, returns None.

pub fn sum(&self) -> f64[src]

Gets the sum of all samples.

pub fn count(&self) -> u64[src]

Gets the sample count.

pub fn buckets(&self) -> Vec<(f64, u64)>[src]

Gets the buckets.

Buckets are tuples, where the first element is the bucket limit itself, and the second element is the count of samples in that bucket.

pub fn record(&mut self, sample: f64)[src]

Records a single sample.

pub fn record_many<'a, S>(&mut self, samples: S) where
    S: IntoIterator<Item = &'a f64> + 'a, 
[src]

Records multiple samples.

Trait Implementations

impl Clone for Histogram[src]

impl Debug for Histogram[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.