#prometheus #tide #middleware #prometheus-metrics

tide-prometheus

Tide middleware for Prometheus with a few default metrics

1 unstable release

0.1.0 Aug 21, 2021

#50 in #tide

MIT/Apache

8KB
53 lines

tide-prometheus

Tide middleware for Prometheus with a few default metrics.

Documentation

See docs.rs for documentation.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


lib.rs:

Tide middleware for prometheus with a few default metrics.

Example

let mut server = tide::new();

server.with(tide_prometheus::Prometheus::new("tide"));

// Optionally serve these metrics on the same server:
server.at("/metrics").get(tide_prometheus::metrics_endpoint);

Metrics

The {prefix} below is the string you put in Prometheus::new.

  • {prefix}_http_requests (prometheus::IntCounterVec) with labels:
    • method as the request method.
    • status as the response status.

Features

  • process will enable the prometheus process feature, recording various metrics of the process.

Dependencies

~11–22MB
~350K SLoC