[][src]Struct metrics::data::AtomicWindowedHistogram

pub struct AtomicWindowedHistogram { /* fields omitted */ }

An atomic windowed histogram.

This histogram provides a windowed view of values that rolls forward over time, dropping old values as they exceed the window of the histogram. Writes into the histogram are lock-free, as well as snapshots of the histogram.

Methods

impl AtomicWindowedHistogram[src]

pub fn new(window: Duration, granularity: Duration, clock: Clock) -> Self[src]

Creates a new AtomicWindowedHistogram.

Internally, a number of buckets will be created, based on how many times granularity goes into window. As time passes, buckets will be cleared to avoid values older than the window duration.

As buckets will hold values represneting a period of time up to granularity, the granularity can be lowered or raised to roll values off more precisely, or less precisely, against the provided clock.

Panics

Panics if granularity is larger than window.

pub fn snapshot(&self) -> StreamingIntegers[src]

Takes a snapshot of the current histogram.

Returns a StreamingIntegers value, representing all observed values in the histogram. As writes happen concurrently, along with buckets being cleared, a snapshot is not guaranteed to have all values present at the time the method was called.

pub fn record(&self, value: u64)[src]

Records a value to the histogram.

Trait Implementations

impl Debug for AtomicWindowedHistogram[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Erased for T