package prometheus

  1. Overview
  2. Docs

Collect metrics for Prometheus. See:


  • The Prometheus docs require that client libraries are thread-safe. We interpret this to mean safe with Lwt threads, NOT with native threading.
  • This library is intended to be a dependency of any library that might need to report metrics, even though many applications will not enable it. Therefore it should have minimal dependencies.
type metric_type =
  1. | Counter
  2. | Gauge
  3. | Summary
  4. | Histogram
module type NAME = sig ... end

A string that meets some additional requirements.

module MetricName : NAME

A valid name for a metric.

module LabelName : NAME

A valid name for a label.

module MetricInfo : sig ... end

Metadata about a metric.

module LabelSetMap : Asetmap.Map.S with type key = string list

A map indexed by a set of labels.

A map indexed by metric families.

module Sample_set : sig ... end
module CollectorRegistry : sig ... end

A collection of metric reporters. Usually, only CollectorRegistry.default is used.

module type METRIC = sig ... end

Operations common to all types of metric.

module Counter : sig ... end

A counter is a cumulative metric that represents a single numerical value that only ever goes up.

module Gauge : sig ... end

A gauge is a metric that represents a single numerical value that can arbitrarily go up and down.

module Summary : sig ... end

A summary is a metric that records both the number of readings and their total. This allows calculating the average.

module Histogram_spec : sig ... end
module type HISTOGRAM = sig ... end
module Histogram (Buckets : sig ... end) : HISTOGRAM

A histogram configured with reasonable defaults for measuring network request times in seconds.