pub struct WindowedQuantiles { /* private fields */ }Available on crate feature
tracker only.Expand description
Sliding-window quantiles: rotate DdSketches through time
buckets so a query answers “quantile over the last window”.
Mirrors TimeBucketedCounter’s
bucket rotation. record is O(1); quantile clones and
merges the live buckets (alloc per query, not per record).
Implementations§
Source§impl WindowedQuantiles
impl WindowedQuantiles
Sourcepub fn new(
window: Duration,
bucket_width: Duration,
alpha: f64,
max_bins: usize,
) -> Self
pub fn new( window: Duration, bucket_width: Duration, alpha: f64, max_bins: usize, ) -> Self
New windowed sketch. window = observation period;
bucket_width = resolution; alpha / max_bins size each
per-bucket DdSketch.
Sourcepub fn quantile(&self, q: f64, now: Timestamp) -> Option<f64>
pub fn quantile(&self, q: f64, now: Timestamp) -> Option<f64>
Estimate quantile q over [now - window, now]. Returns
None if no live observations. Clones + merges the active
buckets — O(live buckets) allocation per call.
Sourcepub fn evict_expired(&mut self, now: Timestamp)
pub fn evict_expired(&mut self, now: Timestamp)
Drop buckets older than now - window.
Trait Implementations§
Source§impl Clone for WindowedQuantiles
impl Clone for WindowedQuantiles
Source§fn clone(&self) -> WindowedQuantiles
fn clone(&self) -> WindowedQuantiles
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WindowedQuantiles
impl Debug for WindowedQuantiles
Source§impl Mergeable for WindowedQuantiles
impl Mergeable for WindowedQuantiles
Auto Trait Implementations§
impl Freeze for WindowedQuantiles
impl RefUnwindSafe for WindowedQuantiles
impl Send for WindowedQuantiles
impl Sync for WindowedQuantiles
impl Unpin for WindowedQuantiles
impl UnsafeUnpin for WindowedQuantiles
impl UnwindSafe for WindowedQuantiles
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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