this repo has no description
1opam-version: "2.0"
2maintainer: "datakit@docker.com"
3authors: ["Thomas Leonard" "David Scott"]
4license: "Apache-1.0+"
5homepage: "https://github.com/mirage/prometheus"
6bug-reports: "https://github.com/mirage/prometheus/issues"
7dev-repo: "git+https://github.com/mirage/prometheus.git"
8doc: "https://mirage.github.io/prometheus/"
9
10build: [
11 [ "jbuilder" "subst" "-p" name ] {dev}
12 [ "jbuilder" "build" "-p" name "-j" jobs ]
13]
14
15depends: [
16 "ocaml" {>= "4.01.0"}
17 "jbuilder" {>= "1.0+beta10"}
18 "astring"
19 "asetmap"
20 "fmt"
21 "re"
22 "lwt" {>= "2.5.0"}
23 "alcotest" {with-test}
24]
25synopsis: "Client library for Prometheus monitoring"
26description: """
27To run services reliably, it is useful if they can report various metrics
28(for example, heap size, queue lengths, number of warnings logged, etc).
29
30A monitoring service can be configured to collect this data regularly.
31The data can be graphed to help understand the performance of the service over time,
32or to help debug problems quickly.
33It can also be used to send alerts if a service is down or behaving poorly.
34
35This repository contains code to report metrics to a [Prometheus][] monitoring server.
36
37### Use by libraries
38
39Library authors should define a set of metrics that may be useful. For example, the DataKitCI
40cache module defines several metrics like this:
41
42```ocaml
43module Metrics = struct
44 open Prometheus
45
46 let namespace = "DataKitCI"
47 let subsystem = "cache"
48
49 let builds_started_total =
50 let help = "Total number of builds started" in
51 Counter.v_label ~help ~label_name:"name" ~namespace ~subsystem "builds_started_total"
52
53 let builds_succeeded_total =
54 let help = "Total number of builds that succeeded" in
55 Counter.v_label ~help ~label_name:"name" ~namespace ~subsystem "builds_succeeded_total"
56
57 let builds_failed_total =
58 let help = "Total number of builds that failed" in
59 Counter.v_label ~help ~label_name:"name" ~namespace ~subsystem "builds_failed_total"
60
61 [...]
62end
63```
64
65Each of these metrics has a `name` label, which allows the reports to be further broken down
66by the type of thing being built.
67
68When (for example) a build succeeds, the CI does:
69
70```ocaml
71Prometheus.Counter.inc_one (Metrics.builds_succeeded_total build_type)
72```
73
74### Use by applications
75
76Applications can enable metric reporting using the `prometheus-app` opam package.
77This depends on cohttp and can serve the metrics collected above over HTTP.
78
79The `prometheus-app.unix` ocamlfind library provides the `Prometheus_unix` module,
80which includes a cmdliner option and pre-configured web-server.
81See the `examples/example.ml` program for an example, which can be run as:
82
83```shell
84$ ./_build/examples/example.native --listen-prometheus=9090
85If run with the option --listen-prometheus=9090, this program serves metrics at
86http://localhost:9090/metrics
87Tick!
88Tick!
89...
90```
91
92Unikernels can use `Prometheus_app` instead of `Prometheus_unix` to avoid the `Unix` dependency.
93
94### API docs
95
96Generated API documentation is available at <https://mirage.github.io/prometheus/>."""
97url {
98 src:
99 "https://github.com/mirage/prometheus/releases/download/v0.4/prometheus-0.4.tbz"
100 checksum: [
101 "sha256=cea6e4f60e9e479851105cb8979f621cd5e388b954ff2e7989ec57f6bd28fd08"
102 "md5=c29ace053a914b5eac5487185af3e050"
103 ]
104}