pub struct Histogram { /* private fields */ }Expand description
Fixed-boundary histogram for latency metrics.
Bucket boundaries are in microseconds. Recording is O(bucket_count) but bucket_count is small (typically 12-15) and all operations are lock-free.
Implementations§
Source§impl Histogram
impl Histogram
Sourcepub fn new(boundaries: &[f64]) -> Self
pub fn new(boundaries: &[f64]) -> Self
Create a histogram with the given bucket boundaries (in the unit of the recorded values).
Sourcepub fn latency_ms() -> Self
pub fn latency_ms() -> Self
Create a histogram with latency-oriented boundaries (in milliseconds).
Boundaries: 1ms, 5ms, 10ms, 25ms, 50ms, 100ms, 250ms, 500ms, 1s, 5s, +Inf
Sourcepub fn bucket_counts(&self) -> Vec<(f64, u64)>
pub fn bucket_counts(&self) -> Vec<(f64, u64)>
Get the count for each bucket (including the +Inf bucket).
Sourcepub fn cumulative_counts(&self) -> Vec<(f64, u64)>
pub fn cumulative_counts(&self) -> Vec<(f64, u64)>
Get the cumulative count up to and including each bucket. This is the format used by Prometheus histograms.
Auto Trait Implementations§
impl !Freeze for Histogram
impl Forget for Histogram
impl Move for Histogram
impl RefUnwindSafe for Histogram
impl Send for Histogram
impl Sync for Histogram
impl Unpin for Histogram
impl UnsafeUnpin for Histogramwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<Atomic<u64>>: UnsafeUnpin,
PhantomData<f64>: UnsafeUnpin,
Align8<u64>: UnsafeUnpin,
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