aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/stats.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/stats.rs')
-rw-r--r--src/api/stats.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/api/stats.rs b/src/api/stats.rs
index 8eaff0c..1f0701d 100644
--- a/src/api/stats.rs
+++ b/src/api/stats.rs
@@ -127,6 +127,9 @@ struct SyncStats {
last_from_neighbour_secs: Option<u64>,
/// Peers whose heads differ from ours while sync is idle (`peers.md`, healing).
diverged_peers: usize,
+ /// Peers refused as a whole, their own changes having broken the swarm's rules
+ /// (`access::screen`): sent nothing.
+ refused_peers: usize,
/// The largest sync message received since start (its Automerge part). Larger
/// transfers come as deltas (blobs).
largest_received_bytes: u64,
@@ -324,11 +327,15 @@ pub(crate) async fn collect(state: &AppState, list: &PeerListResponse) -> StatsR
let mut incidents = Incidents::default();
let mut last_from_neighbour_secs: Option<u64> = None;
let mut diverged_peers = 0;
+ let mut refused_peers = 0;
for peer in list.peers.values() {
incidents.add(&peer.incidents);
if peer.diverged_for_secs.is_some() {
diverged_peers += 1;
}
+ if peer.refused.is_some() {
+ refused_peers += 1;
+ }
if peer.neighbour
&& let Some(secs) = peer.last_sync_secs_ago
{
@@ -370,6 +377,7 @@ pub(crate) async fn collect(state: &AppState, list: &PeerListResponse) -> StatsR
sync: SyncStats {
last_from_neighbour_secs,
diverged_peers,
+ refused_peers,
largest_received_bytes: node.largest_sync_received,
},
relay: RelayStats {