metrics-0.2.1.0: High-performance application metric tracking

Safe HaskellNone

Data.Metrics.Gauge

Description

A module representing a Gauge, which is simply an action that returns the instantaneous measure of a value for charting.

The action that provides the gauge's value may be replaced using set, or read using value.

 gaugeExample = do
   g <- gauge $ return 1
   x <- value g
   set g $ return 2
   y <- value g
   return (x == 1 && y == 2)

Synopsis

Documentation

data Gauge m Source

An instantaneous measure of a value.

Instances

PrimMonad m => Value m (Gauge m) Double 
PrimMonad m => Set m (Gauge m) (m Double) 
Register (Gauge IO) 

gauge :: PrimMonad m => m Double -> m (Gauge m)Source

Create a new gauge from the given action.

ratio :: Applicative f => f Double -> f Double -> f DoubleSource

Compose multiple actions to create a ratio. Useful for graphing percentage information, e. g.

 connectionUtilizationRate :: IO (Gauge IO)
 connectionUtilizationRate = gauge $ ratio openConnectionCount $ return connectionPoolSize