2 releases
0.0.22 | Jun 24, 2024 |
---|---|
0.0.21 | May 11, 2024 |
#56 in #monitor
31 downloads per month
185KB
3K
SLoC
measured-tokio
Tokio metrics support for measured.
lib.rs
:
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.
# drop(metrics);
}
Dependencies
~5–14MB
~144K SLoC