fedimint_connectors/
metrics.rs1use std::sync::LazyLock;
2
3use fedimint_metrics::prometheus::{
4 HistogramVec, IntCounterVec, register_histogram_vec_with_registry,
5};
6use fedimint_metrics::{REGISTRY, histogram_opts, opts, register_int_counter_vec_with_registry};
7
8pub static CONNECTION_DURATION_SECONDS: LazyLock<HistogramVec> = LazyLock::new(|| {
11 register_histogram_vec_with_registry!(
12 histogram_opts!(
13 "connector_connection_duration_seconds",
14 "Duration of establishing connections to federation peers",
15 ),
16 &["scheme"],
17 REGISTRY
18 )
19 .expect("metric registration should not fail")
20});
21
22pub static CONNECTION_ATTEMPTS_TOTAL: LazyLock<IntCounterVec> = LazyLock::new(|| {
24 register_int_counter_vec_with_registry!(
25 opts!(
26 "connector_connection_attempts_total",
27 "Total number of connection attempts to federation peers",
28 ),
29 &["scheme", "result"],
30 REGISTRY
31 )
32 .expect("metric registration should not fail")
33});