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

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 :: Type -> Type) Source #

An instantaneous measure of a value.

Instances

Instances details
(MonadBase b m, PrimMonad b) => Value b m (Gauge b) Double Source # 
Instance details

Defined in Data.Metrics.Gauge

Methods

value :: Gauge b -> m Double Source #

(MonadBase b m, PrimMonad b) => Set b m (Gauge b) (b Double) Source # 
Instance details

Defined in Data.Metrics.Gauge

Methods

set :: Gauge b -> b Double -> m () Source #

Register (Gauge IO) Source # 
Instance details

Defined in Data.Metrics.Registry

gauge :: (MonadBase b m, PrimMonad b) => b Double -> m (Gauge b) Source #

Create a new gauge from the given action.

ratio :: Applicative f => f Double -> f Double -> f Double Source #

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

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