Crate ckb_metrics
source · [−]Expand description
A lightweight metrics facade used in CKB.
The ckb-metrics
crate is a set of tools for 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, Timer};
fn run_query(_: &str) -> u64 { 42 }
pub fn process(query: &str) -> u64 {
let timer = Timer::start();
let row_count = run_query(query);
metrics!(timing, "process.query_time", timer.stop());
metrics!(counter, "process.query_row_count", row_count);
row_count
}
Macros
Out-of-the-box macros for metrics.
Structs
A simple timer which is used to time how much time elapsed.
Functions
Returns a global meter.