You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ldk-server/src/util/metrics.rs
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -14,26 +14,25 @@
14
14
//!
15
15
//! The metrics are updated through two main mechanisms:
16
16
//! 1. **Periodic Polling**: The `update_all_pollable_metrics` function is called at a regular
17
-
//! interval (`BUILD_METRICS_INTERVAL`) to perform a full recount of metrics like peer count,
18
-
//! channels count, and balances.
17
+
//! interval (`poll_metrics_interval`) configurable via the config file but defaults to 60secs if unset, to perform a full recount of metrics like peer count,
18
+
//! payments count, and channels metrics.
19
19
//! 2. **Event-Driven Updates**: For metrics that can change frequently and where a full recount
20
-
//! would be inefficient (e.g., total_successful_payments_count), a hybrid approach is used.
20
+
//! would be inefficient (e.g., total_successful_payments_count, balances), a hybrid approach is used.
21
21
//! - `initialize_payment_metrics` is called once at startup to get the accurate persisted state.
22
22
//! - `update_payments_count` is called incrementally whenever a relevant event (like
23
23
//! `PaymentSuccessful` or `PaymentFailed`) occurs.
24
+
//! - `update_all_balances` is called when we receive a `PaymentSuccessful` event to update all balance metrics.
25
+
//! - `update_channels_count` is called when we receive a `ChannelReady` or `ChannelClosed` event to update the channels metrics.
24
26
//!
25
27
//! The `gather_metrics` function collects all current metric values and formats them into the
26
28
//! plain-text format that Prometheus scrapers expect. This output is exposed via an
27
29
//! unauthenticated `/metrics` HTTP endpoint on the rest service address.
28
30
29
31
use std::sync::atomic::{AtomicI64,AtomicU64,Ordering};
0 commit comments