fedimint_bitcoind/
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 BITCOIND_RPC_DURATION_SECONDS: LazyLock<HistogramVec> = LazyLock::new(|| {
11 register_histogram_vec_with_registry!(
12 histogram_opts!(
13 "bitcoind_rpc_request_duration_seconds",
14 "Duration of bitcoind RPC requests",
15 ),
16 &["method", "name"],
17 REGISTRY
18 )
19 .expect("metric registration should not fail")
20});
21
22pub static BITCOIND_RPC_REQUESTS_TOTAL: LazyLock<IntCounterVec> = LazyLock::new(|| {
24 register_int_counter_vec_with_registry!(
25 opts!(
26 "bitcoind_rpc_requests_total",
27 "Total number of bitcoind RPC requests",
28 ),
29 &["method", "name", "result"],
30 REGISTRY
31 )
32 .expect("metric registration should not fail")
33});