#scrape #handler

trillium-prometheus

Trillium handler for Prometheus metrics scrapes

3 releases (breaking)

new 0.3.0 Mar 31, 2025
0.2.0 Sep 12, 2024
0.1.0 Apr 4, 2023

#492 in Debugging

Download history 742/week @ 2024-12-09 208/week @ 2024-12-16 180/week @ 2024-12-23 66/week @ 2024-12-30 147/week @ 2025-01-06 442/week @ 2025-01-13 278/week @ 2025-01-20 432/week @ 2025-01-27 468/week @ 2025-02-03 155/week @ 2025-02-10 313/week @ 2025-02-17 552/week @ 2025-02-24 549/week @ 2025-03-03 410/week @ 2025-03-10 538/week @ 2025-03-17 220/week @ 2025-03-24

1,717 downloads per month

MPL-2.0 license

15KB

This is a small utility crate that provides a Prometheus metrics endpoint as a Trillium handler. It responds to GET requests to "/metrics" with metrics from the provided registry, using text-format encoding.

Example:

let registry = prometheus::Registry::new();
let handler = trillium_prometheus::text_format_handler(registry);
trillium_smol::config()
    .with_host("0.0.0.0")
    .with_port(9464)
    .run(handler);

Dependencies

~7–14MB
~212K SLoC