Copyright | Soostone Inc |
---|---|
License | BSD3 |
Maintainer | Ozgun Ataman |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Instrument.ClientClass
Description
This module mimics the functionality of Instrument.Client but instead exposes a typeclass facilitated interface. Once you define the typeclass for your application's main monad, you can call all the mesaurement functions directly.
Synopsis
- data Instrument
- initInstrument :: ConnectInfo -> InstrumentConfig -> IO Instrument
- class HasInstrument m where
- getInstrument :: m Instrument
- sampleI :: (MonadIO m, HasInstrument m) => MetricName -> HostDimensionPolicy -> Dimensions -> Double -> m ()
- timeI :: (MonadIO m, HasInstrument m) => MetricName -> HostDimensionPolicy -> Dimensions -> m a -> m a
- countI :: (MonadIO m, HasInstrument m) => MetricName -> HostDimensionPolicy -> Dimensions -> Int -> m ()
- incrementI :: (MonadIO m, HasInstrument m) => MetricName -> HostDimensionPolicy -> Dimensions -> m ()
Documentation
data Instrument Source #
Instances
Monad m => HasInstrument (ReaderT Instrument m) Source # | |
Defined in Instrument.ClientClass Methods |
Arguments
:: ConnectInfo | Redis connection info |
-> InstrumentConfig | Instrument configuration. Use "def" if you don't have specific needs |
-> IO Instrument |
Initialize an instrument for measurement and feeding data into the system.
The resulting opaque Instrument
is meant to be threaded around in
your application to be later used in conjunction with sample
and
time
.
class HasInstrument m where Source #
Methods
getInstrument :: m Instrument Source #
Instances
Monad m => HasInstrument (ReaderT Instrument m) Source # | |
Defined in Instrument.ClientClass Methods |
sampleI :: (MonadIO m, HasInstrument m) => MetricName -> HostDimensionPolicy -> Dimensions -> Double -> m () Source #
Record a measurement sample
timeI :: (MonadIO m, HasInstrument m) => MetricName -> HostDimensionPolicy -> Dimensions -> m a -> m a Source #
Run a monadic action while measuring its runtime
countI :: (MonadIO m, HasInstrument m) => MetricName -> HostDimensionPolicy -> Dimensions -> Int -> m () Source #
incrementI :: (MonadIO m, HasInstrument m) => MetricName -> HostDimensionPolicy -> Dimensions -> m () Source #