prometheusversion

Client library for Prometheus monitoring

To run services reliably, it is useful if they can report various metrics
(for example, heap size, queue lengths, number of warnings logged, etc).

A monitoring service can be configured to collect this data regularly.
The data can be graphed to help understand the performance of the service over time,
or to help debug problems quickly.
It can also be used to send alerts if a service is down or behaving poorly.

This repository contains code to report metrics to a [Prometheus][] monitoring server.

Use by libraries

Library authors should define a set of metrics that may be useful. For example, the DataKitCI
cache module defines several metrics like this:

Use by applications

Applications can enable metric reporting using the prometheus-app opam package.
This depends on cohttp and can serve the metrics collected above over HTTP.

The prometheus-app.unix ocamlfind library provides the Prometheus_unix module,
which includes a cmdliner option and pre-configured web-server.
See the examples/example.ml program for an example, which can be run as:

$ ./_build/examples/example.native --listen-prometheus=9090
If run with the option --listen-prometheus=9090, this program serves metrics at
http://localhost:9090/metrics
Tick!
Tick!
...

Unikernels can use Prometheus_app instead of Prometheus_unix to avoid the Unix dependency.