[][src]Macro metrics::value

macro_rules! value {
    ($name:expr, $value:expr) => { ... };
    ($name:expr, $value:expr, $($labels:tt)*) => { ... };
}

Records a value.

This will register an histogram with the given name, if it does not already exist, then add data point with the given value. Optionally, a set of labels, of the form key => value, can be passed to further describe the histogram.

Functionally equivalent to calling Recorder::record_histogram.

Examples

use metrics::value;

fn handle_request() {
    let rows_read = process();
    value!("client.process_num_rows", rows_read);
}

Labels can also be passed along:

use metrics::value;

fn handle_request() {
    let rows_read = process();
    value!("client.process_num_rows", rows_read, "resource" => "shard1", "table" => "posts");
}