Prometheus metrics aggregation for forking servers.
Listens on a unix socket and collects prometheus metrics, then exposes metrics via http for prometheus scrape.
Addresses issue where a master process forks several workers and each worker collects his own metrics. When prometheus server scrapes the master, it will return the metrics from whichever worker serviced the request. This app allows all workers to write metrics to a single socket, where the metrics can be aggregated.
App servers where this is applicable are unicorn and puma (ruby).
See prometheus/client_ruby#9 for background information.
Download the latest release, extract it, and put it somewhere on your PATH.
or
$ go get github.com/atongen/prom_multi_proc
or
$ mkdir -p $GOPATH/src/github.com/atongen
$ cd $GOPATH/src/github.com/atongen
$ git clone [email protected]:atongen/prom_multi_proc.git
$ cd prom_multi_proc
$ go install
$ rehash
$ cd $GOPATH/src/github.com/atongen/prom_multi_proc
$ go test -cover
$ mkdir -p $GOPATH/src/github.com/atongen
$ cd $GOPATH/src/github.com/atongen
$ git clone [email protected]:atongen/prom_multi_proc.git
$ cd prom_multi_proc
$ make release
λ prom_multi_proc -h
Usage of prom_multi_proc:
-addr string
Address to listen on for exposing prometheus metrics (default "0.0.0.0:9299")
-log string
Path to log file, will write to STDOUT if empty
-metrics string
Path to json file which contains metric definitions
-path string
Path to use for exposing prometheus metrics (default "/metrics")
-socket string
Path to unix socket to listen on for incoming metrics (default "/tmp/prom_multi_proc.sock")
-v Print version information and exit
Send the process a HUP
signal to re-open log files.
Send the process a USR1
signal to re-load metrics configuration json file.
Note that only new metrics can be added and existing metrics can be removed.
Changes to existing metrics will be ignored.