Crate measured_tokio

Crate measured_tokio 

Source
Expand description

Monitor a tokio runtime.

§Usage

use measured::MetricGroup;

#[derive(MetricGroup)]
#[metric(new())]
struct MyAppMetrics {
    #[cfg(tokio_unstable)]
    #[metric(namespace = "tokio")]
    #[metric(init = measured_tokio::RuntimeCollector::current())]
    tokio: measured_tokio::RuntimeCollector,

    // other metrics
}

#[tokio::main]
async fn main() {
    let metrics = MyAppMetrics::new();

    // when you run metrics.collect_group_into(...), you will sample tokio to get runtime state.

}

Structs§

NamedRuntimesCollector
A collector which contains multiple named tokio runtimes
RuntimeCollector
A collector which exports the current state of tokio metrics