ckb-metrics 0.38.0

A lightweight metrics facade used in CKB.
Documentation

A lightweight metrics facade used in CKB.

The ckb-metrics crate is a wrapper of metrics. The crate ckb-metrics-service is the runtime which handles the metrics data in CKB.

Use

The basic use of the facade crate is through the metrics macro: [metrics!].

Examples

use ckb_metrics::metrics;

# use std::time::Instant;
# pub fn run_query(_: &str) -> u64 { 42 }
pub fn process(query: &str) -> u64 {
let start = Instant::now();
let row_count = run_query(query);
let end = Instant::now();

metrics!(timing, "process.query_time", start, end);
metrics!(counter, "process.query_row_count", row_count);

row_count
}
# fn main() {}