aboutsummaryrefslogtreecommitdiffstats
path: root/src/swarm/stats.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-05 20:07:47 +0100
committertv <tv@krebsco.de>2026-11-05 20:07:47 +0100
commit9aad4bee0fbcac76e96b3ff4e6c57a28b162b861 (patch)
tree01aaf842815fb1b797441c3b976129b20d341d71 /src/swarm/stats.rs
parent8fbb882112310790943b4da33358399adbbe12e6 (diff)
chunk fetch counters
Diffstat (limited to 'src/swarm/stats.rs')
-rw-r--r--src/swarm/stats.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/swarm/stats.rs b/src/swarm/stats.rs
index 218d5e8..5cac16a 100644
--- a/src/swarm/stats.rs
+++ b/src/swarm/stats.rs
@@ -141,6 +141,13 @@ pub(crate) struct Relay {
pub(crate) chunks_deflated: u64,
pub(crate) chunk_bytes: u64,
pub(crate) chunk_bytes_sent: u64,
+ /// Blob chunks fetched (`blob::fetch`): asked of another source as late, asked of a
+ /// second source at the end, come when held already, and come from a peer dropped
+ /// as a source meanwhile (kept, its hash being good).
+ pub(crate) chunks_timed_out: u64,
+ pub(crate) chunks_doubled: u64,
+ pub(crate) chunks_twice: u64,
+ pub(crate) chunks_from_dropped: u64,
/// Sync messages received that carried changes, all of which we had already, and
/// their payload's bytes: changes that came twice. Of those, how many came along a
/// writer's tree (`SyncEnvelope::writer`), and how many were taken as delivered by
@@ -277,6 +284,26 @@ impl NodeStats {
inner.relay.chunk_bytes_sent += sent as u64;
}
+ /// `count` blob chunks we fetch went to another source, as late.
+ pub(crate) fn chunks_timed_out(&self, count: usize) {
+ self.lock().relay.chunks_timed_out += count as u64;
+ }
+
+ /// `count` blob chunks we fetch were asked of a second source, at the end.
+ pub(crate) fn chunks_doubled(&self, count: usize) {
+ self.lock().relay.chunks_doubled += count as u64;
+ }
+
+ /// A blob chunk we fetch came when we held it already.
+ pub(crate) fn chunk_twice(&self) {
+ self.lock().relay.chunks_twice += 1;
+ }
+
+ /// A blob chunk we fetch came from a peer no longer a source.
+ pub(crate) fn chunk_from_dropped(&self) {
+ self.lock().relay.chunks_from_dropped += 1;
+ }
+
/// A sync message of `from` bytes went out deflated to `to`.
pub(crate) fn deflated(&self, from: usize, to: usize) {
let mut inner = self.lock();