Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Provides Prometheus-based metrics server based on Tracer
collection.
To add a new metric, one needs to:
- Add a
MetricDefinition
to theallMetrics
list, providing a uniqueName
, the relevant constructor for theMetric
value and a registration function, - Update the
monitor
function to Handle relevantHydraLog
entries and update underlying Prometheus metrics store. Nested helpers are provided to increase aCounter
by one (tick
), by some integral value (tickN
), and toobserve
some value in anHistogram
.
Synopsis
- withMonitoring :: (MonadIO m, MonadAsync m, IsTx tx, MonadMonotonicTime m) => Maybe PortNumber -> Tracer m (HydraLog tx net) -> (Tracer m (HydraLog tx net) -> m ()) -> m ()
Documentation
withMonitoring :: (MonadIO m, MonadAsync m, IsTx tx, MonadMonotonicTime m) => Maybe PortNumber -> Tracer m (HydraLog tx net) -> (Tracer m (HydraLog tx net) -> 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.