summaryrefslogtreecommitdiffstats
path: root/src/swarm/stats.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-26 20:48:45 +0100
committertv <tv@krebsco.de>2026-10-26 20:48:45 +0100
commit5854fe5a3a7c7e8f681264d3a4b27597a8c61de0 (patch)
treee5c5f085a291a633140edb2cf7d1757b3567c69f /src/swarm/stats.rs
parent8414f96f27b059c4536ae67ddfce18dec54e7451 (diff)
add sync and relay stats
Diffstat (limited to 'src/swarm/stats.rs')
-rw-r--r--src/swarm/stats.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/swarm/stats.rs b/src/swarm/stats.rs
index f9a5b7b..8172233 100644
--- a/src/swarm/stats.rs
+++ b/src/swarm/stats.rs
@@ -29,6 +29,8 @@ struct Inner {
catch_up_sources: u32,
max_heads: usize,
stale_hello_replies: u64,
+ relay: Relay,
+ blob_requests_dropped: u64,
saved_size: Option<SavedSize>,
measuring: bool,
/// The document version (`AppState::change_tx`) and epoch the saved size is of.
@@ -90,6 +92,17 @@ pub(crate) struct SavedSize {
pub(crate) took: Duration,
}
+/// Passing changes on (`swarm::relay`), since start.
+#[derive(Debug, Clone, Copy, Default)]
+pub(crate) struct Relay {
+ /// Announcement rounds (each a PING to the neighbours).
+ pub(crate) announce_rounds: u64,
+ /// Pulls started.
+ pub(crate) pulls: u64,
+ /// Announcements of heads we lacked that had to wait for the pull in progress.
+ pub(crate) pulls_queued: u64,
+}
+
/// When the initial sync finished, and what it took.
#[derive(Debug, Clone, Copy)]
pub(crate) struct CaughtUp {
@@ -107,6 +120,8 @@ pub(crate) struct Snapshot {
pub(crate) catch_up_sources: u32,
pub(crate) max_heads: usize,
pub(crate) stale_hello_replies: u64,
+ pub(crate) relay: Relay,
+ pub(crate) blob_requests_dropped: u64,
pub(crate) propagation: Propagation,
}
@@ -154,6 +169,23 @@ impl NodeStats {
self.lock().stale_hello_replies += 1;
}
+ pub(crate) fn announce_round(&self) {
+ self.lock().relay.announce_rounds += 1;
+ }
+
+ pub(crate) fn pull_started(&self) {
+ self.lock().relay.pulls += 1;
+ }
+
+ pub(crate) fn pull_queued(&self) {
+ self.lock().relay.pulls_queued += 1;
+ }
+
+ /// A blob request went unanswered: too many were being answered.
+ pub(crate) fn blob_request_dropped(&self) {
+ self.lock().blob_requests_dropped += 1;
+ }
+
/// The last measurement of the saved size, if any.
pub(crate) fn saved_size(&self) -> Option<SavedSize> {
self.lock().saved_size
@@ -203,6 +235,8 @@ impl NodeStats {
catch_up_sources: inner.catch_up_sources,
max_heads: inner.max_heads,
stale_hello_replies: inner.stale_hello_replies,
+ relay: inner.relay,
+ blob_requests_dropped: inner.blob_requests_dropped,
propagation: inner.propagation,
}
}