fedimint_metrics

Macro register_histogram_with_registry

macro_rules! register_histogram_with_registry {
    ($NAME:expr, $HELP:expr, $REGISTRY:expr $(,)?) => { ... };
    ($NAME:expr, $HELP:expr, $BUCKETS:expr, $REGISTRY:expr $(,)?) => { ... };
    ($HOPTS:expr, $REGISTRY:expr $(,)?) => { ... };
}
Expand description

Create a Histogram 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 = histogram_opts!("test_macro_histogram", "help");
let res1 = register_histogram_with_registry!(opts, custom_registry);
assert!(res1.is_ok());

let res2 = register_histogram_with_registry!("test_macro_histogram_2", "help", custom_registry);
assert!(res2.is_ok());

let res3 = register_histogram_with_registry!("test_macro_histogram_4",
                                "help",
                                vec![1.0, 2.0], custom_registry);
assert!(res3.is_ok());