Macro declare_static_histogram

Source
macro_rules! declare_static_histogram {
    ($name:ident, $key:expr_2021) => { ... };
}
Expand description

Create a thread safe static histogram that can be incremeneted or decremented. This is useful to avoid creating temporary histograms. You can safely create histograms with the same name. They will be joined by the underlying runtime and are thread safe.

Example:

struct Url {
    pub path: String,
    pub proto: String,
}

declare_static_histogram!(REQUEST_LATENCY, "request_latency");

REQUEST_LATENCY.record(40.0, kv_pairs!("path" => url.path, "proto" => url.proto))