metrics-0.4.1.1: High-performance application metric tracking
Safe HaskellNone
LanguageHaskell2010

Data.Metrics.Histogram

Description

Histogram metrics allow you to measure not just easy things like the min, mean, max, and standard deviation of values, but also quantiles like the median or 95th percentile.

Traditionally, the way the median (or any other quantile) is calculated is to take the entire data set, sort it, and take the value in the middle (or 1% from the end, for the 99th percentile). This works for small data sets, or batch processing systems, but not for high-throughput, low-latency services.

The solution for this is to sample the data as it goes through. By maintaining a small, manageable reservoir which is statistically representative of the data stream as a whole, we can quickly and easily calculate quantiles which are valid approximations of the actual quantiles. This technique is called reservoir sampling.

Synopsis

Documentation

data Histogram (m :: Type -> Type) Source #

A measure of the distribution of values in a stream of data.

Instances

Instances details
(MonadBase b m, PrimMonad b) => Clear b m (Histogram b) Source # 
Instance details

Defined in Data.Metrics.Histogram

Methods

clear :: Histogram b -> m () Source #

(MonadBase b m, PrimMonad b) => Count b m (Histogram b) Source # 
Instance details

Defined in Data.Metrics.Histogram

Methods

count :: Histogram b -> m Int Source #

(MonadBase b m, PrimMonad b) => Statistics b m (Histogram b) Source # 
Instance details

Defined in Data.Metrics.Histogram

(MonadBase b m, PrimMonad b) => TakeSnapshot b m (Histogram b) Source # 
Instance details

Defined in Data.Metrics.Histogram

(MonadBase b m, PrimMonad b) => Update b m (Histogram b) Double Source # 
Instance details

Defined in Data.Metrics.Histogram

Methods

update :: Histogram b -> Double -> m () Source #

Register (Histogram IO) Source # 
Instance details

Defined in Data.Metrics.Registry

histogram :: (MonadBase b m, PrimMonad b) => b NominalDiffTime -> Reservoir -> m (Histogram b) Source #

Create a histogram using a custom time data supplier function and a custom reservoir.

exponentiallyDecayingHistogram :: MonadBase IO m => m (Histogram IO) Source #

The recommended histogram type. It provides a fast histogram that probabilistically evicts older entries using a weighting system. This ensures that snapshots remain relatively fresh.

uniformHistogram :: MonadBase IO m => Seed -> m (Histogram IO) Source #

A histogram that gives all entries an equal likelihood of being evicted.

Probably not what you want for most time-series data.