wai-middleware-prometheus-0.1.0.1: WAI middlware for exposing http://prometheus.io metrics.

Safe HaskellNone
LanguageHaskell2010

Network.Wai.Middleware.Prometheus

Description

This module provides Network.Wai middlware for exporting Prometheus metrics and for instrumenting WAI applications.

Synopsis

Documentation

prometheus :: PrometheusSettings -> Middleware Source

Expose Prometheus metrics and instrument an application with some basic metrics (e.g. request latency).

data PrometheusSettings Source

Settings that control the behavior of the Prometheus middleware.

Constructors

PrometheusSettings 

Fields

prometheusEndPoint :: [Text]

The path that will be used for exporting metrics. The default value is ["metrics"] which corresponds to the path /metrics.

prometheusInstrumentApp :: Bool

Whether the default instrumentation should be applied to the application. If this is set to false the application can still be instrumented using the instrumentApp function. The default value is True.

prometheusInstrumentPrometheus :: Bool

Whether the default instrumentation should be applied to the middleware that serves the metrics endpoint. The default value is True.

def :: Default a => a

The default value for this type.

instrumentApp Source

Arguments

:: String

The label used to identify this app

-> Application

The app to instrument

-> Application

The instrumented app

Instrument a WAI app with the default WAI metrics.

If you use this function you will likely want to override the default value of prometheusInstrumentApp to be false so that your app does not get double instrumented.

instrumentIO Source

Arguments

:: String

The label used to identify this IO operation

-> IO a

The IO action to instrument

-> IO a

The instrumented app

Instrument an IO action with timing metrics. This function can be used if you would like to get more fine grained metrics, for instance this can be used to instrument individual end points.

If you use this function you will likely want to override the default value of prometheusInstrumentApp to be false so that your app does not get double instrumented.