metrics-0.3.0.0: High-performance application metric tracking

Safe HaskellNone
LanguageHaskell2010

Data.Metrics.Reservoir

Description

A reservoir is the internal storage mechanism for a Histogram. It provides a generic way to store histogram values in a way that allows us to avoid the need to plumb the implementation type through anything that uses a reservoir.

Synopsis

Documentation

data Reservoir Source

Encapsulates the internal state of a reservoir implementation.

The two standard implementations are the ExponentiallyDecayingReservoir and the UniformReservoir.

Constructors

forall s . Reservoir 

Fields

reservoirClear :: !(NominalDiffTime -> s -> s)

An operation that resets a reservoir to its initial state

reservoirSize :: !(s -> Int)

Retrieve current size of the reservoir. This may or may not be constant depending on the specific implementation.

reservoirSnapshot :: !(s -> Snapshot)

Take snapshot of the current reservoir.

The number of items in the snapshot should always match the reservoir's size.

reservoirUpdate :: !(Double -> NominalDiffTime -> s -> s)

Add a new value to the reservoir, potentially evicting old values in the prcoess.

reservoirState :: !s

The internal state of the reservoir.

clear :: NominalDiffTime -> Reservoir -> Reservoir Source

Reset a reservoir to its initial state.

size :: Reservoir -> Int Source

Get the current number of elements in the reservoir

snapshot :: Reservoir -> Snapshot Source

Get a copy of all elements in the reservoir.

update :: Double -> NominalDiffTime -> Reservoir -> Reservoir Source

Update a reservoir with a new value.

N.B. for some reservoir types, the latest value is not guaranteed to be retained in the reservoir.