summaryrefslogtreecommitdiffstats
path: root/src/swarm/stats.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/swarm/stats.rs')
-rw-r--r--src/swarm/stats.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/swarm/stats.rs b/src/swarm/stats.rs
index 8172233..308c2a5 100644
--- a/src/swarm/stats.rs
+++ b/src/swarm/stats.rs
@@ -31,6 +31,7 @@ struct Inner {
stale_hello_replies: u64,
relay: Relay,
blob_requests_dropped: u64,
+ largest_sync_received: u64,
saved_size: Option<SavedSize>,
measuring: bool,
/// The document version (`AppState::change_tx`) and epoch the saved size is of.
@@ -122,6 +123,8 @@ pub(crate) struct Snapshot {
pub(crate) stale_hello_replies: u64,
pub(crate) relay: Relay,
pub(crate) blob_requests_dropped: u64,
+ /// The largest sync message received (its Automerge part, in bytes).
+ pub(crate) largest_sync_received: u64,
pub(crate) propagation: Propagation,
}
@@ -181,6 +184,12 @@ impl NodeStats {
self.lock().relay.pulls_queued += 1;
}
+ /// A sync message of `bytes` arrived.
+ pub(crate) fn sync_received(&self, bytes: usize) {
+ let mut inner = self.lock();
+ inner.largest_sync_received = inner.largest_sync_received.max(bytes as u64);
+ }
+
/// A blob request went unanswered: too many were being answered.
pub(crate) fn blob_request_dropped(&self) {
self.lock().blob_requests_dropped += 1;
@@ -237,6 +246,7 @@ impl NodeStats {
stale_hello_replies: inner.stale_hello_replies,
relay: inner.relay,
blob_requests_dropped: inner.blob_requests_dropped,
+ largest_sync_received: inner.largest_sync_received,
propagation: inner.propagation,
}
}