package prometheus-app

  1. Overview
  2. Docs
Client library for Prometheus monitoring

Install

Dune Dependency

Authors

Maintainers

Sources

prometheus-v1.1.tbz
sha256=fbcf8bb28c02bfe4f61d2494bc2b70fdedd62f2b41fd1343e6f73d583bf599e4
sha512=9cf49689f6d33138cf41eca585e0d15bd17f670a3334b8235a52cc6c210fdc763fb967b19a91a110759a206aa9223cca1c7064e0eb2e2e6d3d13957ec7a38201

doc/prometheus-app.unix/Prometheus_unix/Logging/index.html

Module Prometheus_unix.LoggingSource

Report metrics for messages logged.

Sourceval init : ?default_level:Logs.level -> ?levels:(string * Logs.level) list -> ?formatter:Format.formatter -> unit -> unit

Initialise the Logs library with a reporter that reports prometheus metrics too. The reporter is configured to log to stderr and the log messages include a timestamp and the event's source.

A server will typically use the following code to initialise logging:

let () = Prometheus_app.Logging.init ()

Or:

let () =
  Prometheus_unix.Logging.init ()
    ~default_level:Logs.Debug
    ~levels:[
      "cohttp.lwt.io", Logs.Info;
    ]
  • parameter default_level

    The default log-level to use (default Logs.Info).

  • parameter levels

    Provides levels for specific log sources.

  • parameter formatter

    A custom formatter (default Fmt.stderr).

Sourceval inc_counter : Logs.level -> string -> unit

inc_counter level src increments the count of messages logged by src at level. The reporter installed by init calls this automatically, but you might want to use this if you use your own reporter instead.

OCaml

Innovation. Community. Security.