macro_rules! declare_static_gauge {
($name:ident, $key:expr_2021) => { ... };
}
Expand description
Create a thread safe static gauge that can be set to a specific value. This is useful to avoid creating temporary gauges. You can safely create gauges with the same name. They will be joined by the underlying runtime and are thread safe.
Example:
struct System {
pub memory_usage: f64,
pub cpu_usage: f64,
}
declare_static_gauge!(MEMORY_USAGE, "memory_usage");
MEMORY_USAGE.record(system.memory_usage, kv_pairs!("unit" => "MB", "process" => "hyperactor"))