[][src]Crate ckb_metrics

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;

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
}

Re-exports

pub use metrics as internal;

Macros

metrics

Reexports the macros from the crate metrics.

Structs

SetRecorderError

The type returned by set_recorder if set_recorder has already been called.

Timer

A simple timer which is used to time how much time elapsed.