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]
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]
S: IntoIterator<Item = &'a f64> + 'a,
Records multiple samples.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Histogram
impl RefUnwindSafe for Histogram
impl UnwindSafe for Histogram
impl UnwindSafe for Histogram