fedimint_ln_server/
metrics.rs1use std::sync::LazyLock;
2
3use fedimint_metrics::prometheus::{
4 register_histogram_vec_with_registry, register_int_counter_with_registry,
5};
6use fedimint_metrics::{
7 AMOUNTS_BUCKETS_SATS, HistogramVec, IntCounter, REGISTRY, histogram_opts, opts,
8};
9
10pub static LN_INCOMING_OFFER: LazyLock<IntCounter> = LazyLock::new(|| {
11 register_int_counter_with_registry!(
12 opts!("ln_incoming_offer_total", "Incoming payment offer"),
13 REGISTRY
14 )
15 .unwrap()
16});
17pub static LN_CANCEL_OUTGOING_CONTRACTS: LazyLock<IntCounter> = LazyLock::new(|| {
18 register_int_counter_with_registry!(
19 opts!(
20 "ln_canceled_outgoing_contract_total",
21 "Canceled outgoing contract"
22 ),
23 REGISTRY
24 )
25 .unwrap()
26});
27pub static LN_FUNDED_CONTRACT_SATS: LazyLock<HistogramVec> = LazyLock::new(|| {
28 register_histogram_vec_with_registry!(
29 histogram_opts!(
30 "ln_funded_contract_sats",
31 "Funded (with outgoing or incoming direction) contract amount in sats",
32 AMOUNTS_BUCKETS_SATS.clone()
33 ),
34 &["direction"],
35 REGISTRY
36 )
37 .unwrap()
38});