hydra-node-0.20.0: The Hydra node
Safe HaskellSafe-Inferred
LanguageGHC2021

Hydra.Logging.Monitoring

Description

Provides Prometheus-based metrics server based on Tracer collection.

To add a new metric, one needs to:

  • Add a MetricDefinition to the allMetrics list, providing a unique Name, the relevant constructor for the Metric value and a registration function,
  • Update the monitor function to Handle relevant HydraLog entries and update underlying Prometheus metrics store. Nested helpers are provided to increase a Counter by one (tick), by some integral value (tickN), and to observe some value in an Histogram.
Synopsis

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.