[][src]Macro metrics::counter

macro_rules! counter {
    #[proc_macro_hack] => { ... };
}

Increments a counter.

Counters represent a single monotonic value, which means the value can only be incremented, not decremented, and always starts out with an initial value of zero.

Example

// A basic counter:
counter!("some_metric_name", 12);

// Specifying labels:
counter!("some_metric_name", 12, "service" => "http");

// We can also pass labels by giving a vector or slice of key/value pairs:
let dynamic_val = "woo";
let labels = [("dynamic_key", format!("{}!", dynamic_val))];
counter!("some_metric_name", 12, &labels);