#prometheus-metrics #metrics #prometheus #run-time #tokio #collection #expose

prometheus-tokio

A collection of tokio runtime metrics for prometheus consumption

2 unstable releases

0.2.0 Apr 3, 2023
0.1.0 Mar 31, 2023

#1287 in Data structures

34 downloads per month

Apache-2.0

23KB
410 lines

Prometheus + Tokio

This project exposes a Tokio collector that is compatible with the prometheus crate that adds tokio runtime related metrics.

The project relies on a tokio_unstable feature, so you need to add the flags accordingly, e.g. by adding a .cargo/config.toml file to your project with the correct RUSTFLAGS, as is done here.

You can quickly test to look at the metrics that exist by using the example app:

cargo run --example complete-setup
# In another terminal
curl 127.0.0.1/metrics

Forced feature

Due to feature unification, note that bringing this crate in your project will force the rt feature of tokio in your project. This should not be an issue, given that runtime metrics hopefully make little sense if there is no runtime to measure.

Features

The crate has a single feature:

  • io_driver enables the tokio/net feature, and adds an extra metric that reports the number of ready events processed by the runtime’s I/O driver.

Acknowledgement

The project was kickstarted by Fiberplane during a "Hack day".

Dependencies

~5–16MB
~173K SLoC