package prometheus-app
Client library for Prometheus monitoring
Install
Dune Dependency
Authors
Maintainers
Sources
prometheus-v0.7.tbz
sha256=e2894de14ab9f9a095b1359581d84094123a1214f76e1563f7ce5a16c69c6ac5
sha512=6a4d81fef6514400ecf7e16a9871db0aba83a8cd52deaaaa3d07517ecbb460a638684326fc1087c4a57dfd830a609ae7486b69a9f77d07ab5e0eada663191228
doc/src/prometheus-app.unix/prometheus_unix.ml.html
Source file prometheus_unix.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
open Prometheus module Unix_runtime = struct let start_time = Unix.gettimeofday () let simple_metric ~metric_type ~help name fn = let info = { MetricInfo. name = MetricName.v name; help; metric_type; label_names = []; } in let collect () = LabelSetMap.singleton [] [Sample_set.sample (fn ())] in info, collect let process_start_time_seconds = simple_metric ~metric_type:Counter "process_start_time_seconds" (fun () -> start_time) ~help:"Start time of the process since unix epoch in seconds." let metrics = [ process_start_time_seconds; ] end type config = int option module Server = Prometheus_app.Cohttp(Cohttp_lwt_unix.Server) let serve = function | None -> [] | Some port -> let mode = `TCP (`Port port) in let callback = Server.callback in let thread = Cohttp_lwt_unix.Server.create ~mode (Cohttp_lwt_unix.Server.make ~callback ()) in [thread] let listen_prometheus = let open! Cmdliner in let doc = Arg.info ~docs:"MONITORING OPTIONS" ~docv:"PORT" ~doc: "Port on which to provide Prometheus metrics over HTTP." ["listen-prometheus"] in Arg.(value @@ opt (some int) None doc) let opts = listen_prometheus let () = let add (info, collector) = CollectorRegistry.(register default) info collector in List.iter add Unix_runtime.metrics
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>