package tally-mkernel
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=1c97d36830e5715bce41230202b4c971
sha512=fd3030ff95296bd431412678079a9dd8e48824ae28808b09bf838e1597bb1a02db667e6634d3452fd5de9e211048bd2ed809dbe22adf15e3c6ab521d9612b55c
Description
Tally-mkernel provides measurements for mkernel.
Added to opam-repository:
README
Tally - collecting metrics of OCaml applications
Tally is a library to collect and output counters of OCaml applications. The output can be send to InfluxDB (via Telegraf), and then visualized with Grafana.
The API of a tally is simple: each tally has a name (which is the measurement name), a set of tags (key and value are string), and a set of fields (with key being a string, and value an int).
Base tallies are already implemented by this library: gc uses Gc.quick_stat, logs exposes the Logs.warn_count () and Logs.err_count ().
An example application would use:
let pid = Unix.getpid () in
let _ru = Tally_rusage.v pid in
let more_tags = [ "process", "my-application" ; "pid", string_of_int pid ] in
let measurements = Tally.measure () in
let influx_data =
List.map (fun name tags fields ->
Tally.encode_influx name ~tags:(more_tags @ tags) fields)
measurements |> String.concat ""
in
let socket = Unix.(socket PF_INET SOCK_STREAM 0) in
Unix.connect socket Unix.(ADDR_INET (inet_addr_loopback, 8096));
let _written =
Unix.write socket (Bytes.of_string influx_data) 0 (String.length influx_data)
in
()Tally-rusage
The sublibrary tally.rusage provides Tally_rusage.v pid to collect resource usage from the host system about a process. This uses /proc/<pid>/stat and /proc/<pid>/status on Linux, and ctl_kern.kern_proc.kern_proc_pid on FreeBSD.
Tally-mkernel
The separate opam package tally-mkernel collects metrics from mkernel devices and the ocaml-solo5 malloc implementation.
Comparison to other metric libraries
The library metrics has a similar goal, but uses a more involved API for fields, and tags (with GADTs - where the keys and values may have more types). It also introduces more buereaucracy with graphs and also provides interaction with GNUplot.
The library prometheus is tied to the monitoring system Prometheus.
Tally is not tied to any monitoring system, contributions for more operating systems as well as further monitoring systems are appreciated - though the latter may be best provided by separate packages.
Installation
It is released to opam-repository, so an opam install tally or opam install tally-mkernel will make this package available.
LICENSE
AGPL 3 or later