Skip to main content

fedimint_lnv2_server/
metrics.rs

1#![allow(clippy::disallowed_types)]
2// Prometheus registration macros use `HashMap` internally.
3
4use std::sync::LazyLock;
5
6use fedimint_metrics::prometheus::{
7    IntCounterVec, register_histogram_vec_with_registry, register_int_counter_vec_with_registry,
8};
9use fedimint_metrics::{AMOUNTS_BUCKETS_SATS, HistogramVec, REGISTRY, histogram_opts, opts};
10
11pub(crate) static LN_FUNDED_CONTRACT_SATS: LazyLock<HistogramVec> = LazyLock::new(|| {
12    register_histogram_vec_with_registry!(
13        histogram_opts!(
14            "lnv2_funded_contract_sats",
15            "Funded (with outgoing or incoming direction) contract amount in sats",
16            AMOUNTS_BUCKETS_SATS.clone()
17        ),
18        &["direction"],
19        REGISTRY
20    )
21    .unwrap()
22});
23pub(crate) static LN_OUTGOING_CONTRACT_SETTLED: LazyLock<IntCounterVec> = LazyLock::new(|| {
24    register_int_counter_vec_with_registry!(
25        opts!(
26            "lnv2_outgoing_contract_settled_total",
27            "Settled outgoing contracts by outcome (claim, refund or cancel)"
28        ),
29        &["outcome"],
30        REGISTRY
31    )
32    .unwrap()
33});