package prometheus-app
Client library for Prometheus monitoring
Install
Dune Dependency
Authors
Maintainers
Sources
prometheus-v0.6.tbz
sha256=86509374e5af8ce5987535b43d8cb9cffec066e3b9b09a6ef07fa5371b878629
sha512=25976154fce5062f679694a49941a346c9da77083d16072b941cdfd7ae739f5603bee243ef55dbdd3a1ad26e51eb23c3a08cac6bd3d1fc40e3d7a9cc2bbc4ade
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)"
>