Struct metrics_util::Histogram
source · pub struct Histogram { /* private fields */ }
Expand description
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§
source§impl Histogram
impl Histogram
sourcepub fn new(bounds: &[f64]) -> Option<Histogram>
pub fn new(bounds: &[f64]) -> Option<Histogram>
Creates a new Histogram
.
If bounds
is empty, returns None
.
sourcepub fn buckets(&self) -> Vec<(f64, u64)>
pub fn buckets(&self) -> Vec<(f64, u64)>
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.
sourcepub fn record_many<'a, S>(&mut self, samples: S)where
S: IntoIterator<Item = &'a f64> + 'a,
pub fn record_many<'a, S>(&mut self, samples: S)where S: IntoIterator<Item = &'a f64> + 'a,
Records multiple samples.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Histogram
impl Send for Histogram
impl Sync for Histogram
impl Unpin for Histogram
impl UnwindSafe for Histogram
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more