All Projects → mirage → prometheus

mirage / prometheus

Licence: Apache-2.0 license
OCaml library for reporting metrics to a Prometheus server

Programming Languages

ocaml
1615 projects
Makefile
30231 projects

Projects that are alternatives of or similar to prometheus

mirage-xmpp
Implementation of XMPP for MirageOS
Stars: ✭ 12 (-72.73%)
Mutual labels:  mirageos
contruno
A TLS termination proxy as a MirageOS
Stars: ✭ 13 (-70.45%)
Mutual labels:  mirageos
Mirage
MirageOS is a library operating system that constructs unikernels
Stars: ✭ 1,707 (+3779.55%)
Mutual labels:  mirageos
Irmin
Built-in Snapshotting - backup and restore Storage Agnostic - you can use Irmin on top of your own storage layer Custom Datatypes - (de)serialization for custom data types, derivable via ppx_irmin Highly Portable - runs anywhere from Linux to web browsers and Xen unikernels Git Compatibility - irmin-git uses an on-disk format that can be inspected and modified using Git Dynamic Behavior - allows the users to define custom merge functions, use in-memory transactions (to keep track of reads as well as writes) and to define event-driven workflows using a notification mechanism
Stars: ✭ 1,524 (+3363.64%)
Mutual labels:  mirageos
ocaml-pcap
OCaml code for generating and analysing pcap (packet capture) files
Stars: ✭ 20 (-54.55%)
Mutual labels:  mirageos
mirage-framebuffer
Experimental portable bitmap framebuffer graphics for MirageOS
Stars: ✭ 16 (-63.64%)
Mutual labels:  mirageos
docteur
An opiniated file-system for MirageOS
Stars: ✭ 16 (-63.64%)
Mutual labels:  mirageos
ocaml-x509
X509 (RFC5280) handling in OCaml
Stars: ✭ 40 (-9.09%)
Mutual labels:  mirageos
arp
Address resolution protocol (ARP) implementation in OCaml targeting MirageOS
Stars: ✭ 20 (-54.55%)
Mutual labels:  mirageos
eye-of-mirage
WiP image viewer using MirageOS
Stars: ✭ 16 (-63.64%)
Mutual labels:  mirageos
keyfender
Secure HSM implementation based on MirageOS
Stars: ✭ 33 (-25%)
Mutual labels:  mirageos
mirage-solo5
Solo5 core platform libraries for MirageOS
Stars: ✭ 18 (-59.09%)
Mutual labels:  mirageos
ocaml-dns
OCaml implementation of the DNS protocol
Stars: ✭ 93 (+111.36%)
Mutual labels:  mirageos
mirage-xen
Xen core platform libraries for MirageOS
Stars: ✭ 17 (-61.36%)
Mutual labels:  mirageos
rekernel
A minimal setup for writing Unikernels in ReasonML
Stars: ✭ 28 (-36.36%)
Mutual labels:  mirageos
awesome-unikernels
A list about Unikernels
Stars: ✭ 86 (+95.45%)
Mutual labels:  mirageos

OCaml 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:

module Metrics = struct
  open Prometheus

  let namespace = "DataKitCI"
  let subsystem = "cache"

  let builds_started_total =
    let help = "Total number of builds started" in
    Counter.v_label ~help ~label_name:"name" ~namespace ~subsystem "builds_started_total"

  let builds_succeeded_total =
    let help = "Total number of builds that succeeded" in
    Counter.v_label ~help ~label_name:"name" ~namespace ~subsystem "builds_succeeded_total"

  let builds_failed_total =
    let help = "Total number of builds that failed" in
    Counter.v_label ~help ~label_name:"name" ~namespace ~subsystem "builds_failed_total"

  [...]
end

Each of these metrics has a name label, which allows the reports to be further broken down by the type of thing being built.

When (for example) a build succeeds, the CI does:

Prometheus.Counter.inc_one (Metrics.builds_succeeded_total build_type)

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:

$ dune exec -- examples/example.exe --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.

API docs

Generated API documentation is available at https://mirage.github.io/prometheus/.

Licensing

This code is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].