pub struct Histogram { /* private fields */ }Expand description
Fixed-bucket latency histogram (microsecond samples).
Buckets are cumulative on render, per Prometheus convention.
Implementations§
Source§impl Histogram
impl Histogram
Sourcepub fn new(bounds_us: &[u64]) -> Self
pub fn new(bounds_us: &[u64]) -> Self
Create a histogram with the given bucket upper bounds (µs, ascending).
Sourcepub fn observe_us(&self, us: u64)
pub fn observe_us(&self, us: u64)
Record a sample in microseconds.
Sourcepub fn quantile_us(&self, q: f64) -> u64
pub fn quantile_us(&self, q: f64) -> u64
Approximate quantile (µs) from bucket boundaries. Returns the upper
bound of the bucket containing quantile q (0.0–1.0); a target that
lands above every bounded bucket returns the sentinel below.
A q whose target is served only by samples in the implicit +Inf
bucket returns u64::MAX as a sentinel: this signals “beyond top
bucket” instead of silently under-reporting bounds_us.last().
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Histogram
impl RefUnwindSafe for Histogram
impl Send for Histogram
impl Sync for Histogram
impl Unpin for Histogram
impl UnsafeUnpin 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