Macro prometheus::register_gauge_with_registry [−][src]
macro_rules! register_gauge_with_registry {
($OPTS : expr, $REGISTRY : expr $(,) ?) => { ... };
($NAME : expr, $HELP : expr, $REGISTRY : expr $(,) ?) => { ... };
}
Expand description
Create a [Gauge
] and registers to a custom registry.
Examples
let mut labels = HashMap::new();
labels.insert("mykey".to_string(), "myvalue".to_string());
let custom_registry = Registry::new_custom(Some("myprefix".to_string()), Some(labels)).unwrap();
let opts = opts!("test_macro_gauge", "help");
let res1 = register_gauge_with_registry!(opts, custom_registry);
assert!(res1.is_ok());
let res2 = register_gauge_with_registry!("test_macro_gauge_2", "help", custom_registry);
assert!(res2.is_ok());