monad-metrics-0.1.0.0: A convenient wrapper around EKG metrics

Copyright(c) Matt Parsons 2017
Taylor Fausak 2016
LicenseMIT
Maintainerparsonsmatt@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Control.Monad.Metrics

Contents

Description

This module presents an easy interface that you can use to collect metrics about your application. It uses EKG under the hood and is inspired by Taylor Fausak's blunt application.

This module is designed to be imported qualified.

Synopsis

The Type Class

class MonadMetrics m where Source #

A class is an instance of MonadMetrics if it can provide a Metrics somehow. Commonly, this will be implemented as a ReaderT where some field in the environment is the Metrics data.

Since v0.1.0.0

Minimal complete definition

getMetrics

Initializing

data Metrics Source #

A container for metrics used by the MonadMetrics class.

initialize :: IO Metrics Source #

Initializes a Metrics value, creating a new Store for it.

Since v0.1.0.0

initializeWith :: Store -> IO Metrics Source #

Initializes a Metrics value with the given Store.

Since 0.1.0.0

Collecting Metrics

increment :: (MonadIO m, MonadMetrics m) => Text -> m () Source #

Increment the named counter by 1.

Since v0.1.0.0

counter :: (MonadIO m, MonadMetrics m) => Text -> Int -> m () Source #

A type specialized version of counter' to avoid ambiguous type errors.

Since v0.1.0.0

counter' :: (MonadIO m, MonadMetrics m, Integral int) => Text -> int -> m () Source #

Adds the value to the named Counter.

Since v0.1.0.0

gauge :: (MonadIO m, MonadMetrics m) => Text -> Int -> m () Source #

A type specialized version of gauge' to avoid ambiguous types.

Since v0.1.0.0

gauge' :: (MonadIO m, MonadMetrics m, Integral int) => Text -> int -> m () Source #

Set the value of the named Gauge.

Since v0.1.0.0

distribution :: (MonadIO m, MonadMetrics m) => Text -> Double -> m () Source #

Add the value to the named Distribution.

Since v0.1.0.0

timed :: (MonadIO m, MonadMetrics m) => Text -> m a -> m a Source #

Record the time of executing the given action in seconds. Defers to timed'.

Since v0.1.0.0

timed' :: (MonadIO m, MonadMetrics m) => Resolution -> Text -> m a -> m a Source #

Record the time taken to perform the named action. The number is stored in a Distribution and is converted to the specified Resolution.

Since v0.1.0.0

label :: (MonadIO m, MonadMetrics m) => Text -> Text -> m () Source #

label' :: (MonadIO m, MonadMetrics m, Show a) => Text -> a -> m () Source #