metrics-0.3.0.2: High-performance application metric tracking

Safe HaskellNone
LanguageHaskell2010

Data.Metrics.Registry

Description

An interface for bundling metrics in a way that they cna be iterated over for reporting or looked up for use by code that shares the registry.

Synopsis

Documentation

data MetricRegistry m Source

A container that tracks all metrics registered with it. All forms of metrics share the same namespace in the registry. Consequently, attempting to replace a metric with one of a different type will fail (return Nothing from a call to register).

data Metric m Source

A sum type of all supported metric types that reporters should be able to output.

class Register a where Source

Add a new metric to a registry or retrieve the existing metric of the same name if one exists.

Methods

register :: MetricRegistry IO -> Text -> IO a -> IO (Maybe a) Source

If possible, avoid using register to frequently retrieve metrics from a global registry. The metric registry is locked any time a lookup is performed, which may cause contention.

newMetricRegistry :: IO (MetricRegistry IO) Source

Initializes a new metric registry.