| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Hydra.Logging.Monitoring
Description
Provides Prometheus-based metrics server based on Tracer collection.
To add a new metric, one needs to:
- Add a
MetricDefinitionto theallMetricslist, providing a uniqueName, the relevant constructor for theMetricvalue and a registration function, - Update the
monitorfunction to Handle relevantHydraLogentries and update underlying Prometheus metrics store. Nested helpers are provided to increase aCounterby one (tick) and toobservesome value in anHistogram.
Synopsis
- withMonitoring :: (MonadIO m, MonadAsync m, IsTx tx, MonadMonotonicTime m) => Maybe PortNumber -> Tracer m (HydraLog tx) -> (Tracer m (HydraLog tx) -> m ()) -> m ()
Documentation
withMonitoring :: (MonadIO m, MonadAsync m, IsTx tx, MonadMonotonicTime m) => Maybe PortNumber -> Tracer m (HydraLog tx) -> (Tracer m (HydraLog tx) -> m ()) -> m () Source #
Wraps a monadic action using a Tracer and capture metrics based on traces.
Given a portNumber, this wrapper starts a Prometheus-compliant server on this port.
This is a no-op if given Nothing. This function is not polymorphic over the type of
messages because it needs to understand them in order to provide meaningful metrics.