Safe Haskell | None |
---|---|
Language | Haskell2010 |
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
- data MetricRegistry (m :: Type -> Type)
- data Metric (m :: Type -> Type)
- = MetricGauge !(Gauge m)
- | MetricCounter !(Counter m)
- | MetricHistogram !(Histogram m)
- | MetricMeter !(Meter m)
- | MetricTimer !(Timer m)
- class Register a where
- metrics :: MetricRegistry m -> MVar (HashMap Text (Metric m))
- newMetricRegistry :: IO (MetricRegistry IO)
- module Data.Metrics.Types
Documentation
data MetricRegistry (m :: Type -> Type) 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 :: Type -> Type) Source #
A sum type of all supported metric types that reporters should be able to output.
Constructors
MetricGauge !(Gauge m) | |
MetricCounter !(Counter m) | |
MetricHistogram !(Histogram m) | |
MetricMeter !(Meter m) | |
MetricTimer !(Timer m) |
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.
module Data.Metrics.Types