#prometheus #metrics


An easy-to-use prometheus-compatible metrics framework

10 releases (6 breaking)

0.7.1 Aug 5, 2021
0.7.0 Jan 26, 2021
0.6.0 Jan 22, 2021
0.5.0 Sep 17, 2020
0.2.0 Sep 9, 2019

#10 in #prometheus

Download history 1321/week @ 2021-09-25 2553/week @ 2021-10-02 3437/week @ 2021-10-09 2401/week @ 2021-10-16 1787/week @ 2021-10-23 1052/week @ 2021-10-30 2119/week @ 2021-11-06 1088/week @ 2021-11-13 2075/week @ 2021-11-20 590/week @ 2021-11-27 946/week @ 2021-12-04 444/week @ 2021-12-11 275/week @ 2021-12-18 275/week @ 2021-12-25 439/week @ 2022-01-01 334/week @ 2022-01-08

1,478 downloads per month


202 lines


An easy-to-use prometheus-compatible metrics library.

Epimetheus is probably the easiest way to get your Rust application serving metrics. Just scatter your code with instrumentation and call spawn_http_server() in main().

Watch your hashmaps grow!


Monitor the latency of your functions!

let start = Instant::now();

Track the status codes of your responses!

let resp = compute_response();

Then connect to port 9898 to see what's happening:

$ curl localhost:9898
my_data_cap 1024
my_data_len 764
my_function_duration_count 6032
my_function_duration_sum 8.32
responses{code="200 OK"} 5443
responses{code="404 Not Found"} 587
responses{code="500 Internal Server Error"} 2

Your program can also call epimetheus::query() to inspect its own metrics. If you only plan to access the metrics this way, you can skip the call to spawn_http_server().


  • Multi-threaded OK! Everyone shares the same set of metrics.
  • The format is prometheus-compatible. Point prometheus' watchful eye at your program and get nice graphs.
  • Updating metrics is fast (...mostly. See below.)
  • The port number can be customised via the RUST_METRICS_PORT environment variable.
  • The code is very readable - under 200 sloc. Take a look!
  • Public domain.


  • Updating an unlabelled metric (like my_data_len above) is fast (~500ns uncontended, ~5us contended).
  • Updating a labelled metric (like responses above) is slower (~1us uncontended, ~10us contended).
  • The HTTP server is extremely dumb and can only handle one client at a time; typically this doesn't matter.

Other stuff

Epimetheus is the brother of Prometheus, hence the crate's name.


Please send bug reports to ~asayers/public-inbox@lists.sr.ht.

Please send patches to ~asayers/public-inbox@lists.sr.ht, and include the following text:

I dedicate any and all copyright interest in this software to the public domain. I make this dedication for the benefit of the public at large and to the detriment of my heirs and successors. I intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.



y a