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