aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/measurements.md3
-rw-r--r--docs/openapi.yaml8
-rw-r--r--src/api/stats.rs8
-rw-r--r--src/api/stats/prometheus.rs18
-rw-r--r--src/swarm/relay.rs3
-rw-r--r--src/swarm/stats.rs18
6 files changed, 57 insertions, 1 deletions
diff --git a/docs/measurements.md b/docs/measurements.md
index 131adca..f93a79a 100644
--- a/docs/measurements.md
+++ b/docs/measurements.md
@@ -83,6 +83,9 @@ or caught up over many small messages.
| `relay.announceRounds` | `announce_rounds_total` | Announcement rounds: our new heads to the neighbours after applying their changes (partial mesh only). |
| `relay.pulls` | `pulls_total` | Pulls of changes we lacked from a neighbour that announced them. |
| `relay.pullsQueued` | `pulls_queued_total` | Announcements of heads we lacked that waited for the pull in progress. Many compared with `pulls`: changes arrive from several sides at once. |
+| `relay.grafts` | `grafts_total` | Links made eager: a pull brought changes over them, which from then on the neighbour sends as it applies them ([`peers.md`](peers.md)). |
+| `relay.prunes` | `prunes_total` | Links made lazy again: changes came over them that another path had brought first. Grafts and prunes growing together, long after start: links keep switching, as when writers in different places take turns. |
+| `relay.eagerForwards` | `eager_forwards_total` | Changes forwarded over eager links: a sync message per neighbour, instead of an announcement and a pull. |
| `relay.blobRequestsDropped` | `blob_requests_dropped_total` | Blob requests not answered because too many were being answered; the requester asks again or asks another peer. Also logged as a warning, at most once a minute with the count. |
## Topology
diff --git a/docs/openapi.yaml b/docs/openapi.yaml
index 701cdf9..c925dde 100644
--- a/docs/openapi.yaml
+++ b/docs/openapi.yaml
@@ -1966,7 +1966,7 @@ components:
type: integer
relay:
type: object
- required: [announceRounds, pulls, pullsQueued, blobRequestsDropped]
+ required: [announceRounds, pulls, pullsQueued, grafts, prunes, eagerForwards, blobRequestsDropped]
properties:
announceRounds:
type: integer
@@ -1974,6 +1974,12 @@ components:
type: integer
pullsQueued:
type: integer
+ grafts:
+ type: integer
+ prunes:
+ type: integer
+ eagerForwards:
+ type: integer
blobRequestsDropped:
type: integer
topology:
diff --git a/src/api/stats.rs b/src/api/stats.rs
index 558507a..9ac2c94 100644
--- a/src/api/stats.rs
+++ b/src/api/stats.rs
@@ -140,6 +140,11 @@ struct RelayStats {
pulls: u64,
/// Announcements of heads we lacked that waited for the pull in progress.
pulls_queued: u64,
+ /// Links made eager, and lazy again (`swarm::relay`).
+ grafts: u64,
+ prunes: u64,
+ /// Changes forwarded over eager links, per neighbour.
+ eager_forwards: u64,
/// Blob requests not answered: too many were being answered.
blob_requests_dropped: u64,
}
@@ -340,6 +345,9 @@ pub(crate) async fn collect(state: &AppState, list: &PeerListResponse) -> StatsR
announce_rounds: node.relay.announce_rounds,
pulls: node.relay.pulls,
pulls_queued: node.relay.pulls_queued,
+ grafts: node.relay.grafts,
+ prunes: node.relay.prunes,
+ eager_forwards: node.relay.eager_forwards,
blob_requests_dropped: node.blob_requests_dropped,
},
topology: TopologyStats {
diff --git a/src/api/stats/prometheus.rs b/src/api/stats/prometheus.rs
index 0a1d75d..3d4bcc6 100644
--- a/src/api/stats/prometheus.rs
+++ b/src/api/stats/prometheus.rs
@@ -651,6 +651,24 @@ pub(super) fn render(stats: &StatsResponse, list: &PeerListResponse) -> String {
relay.pulls_queued as f64,
);
out.single(
+ "grafts_total",
+ "counter",
+ "Links made eager: a pull brought changes over them.",
+ relay.grafts as f64,
+ );
+ out.single(
+ "prunes_total",
+ "counter",
+ "Links made lazy again: changes came over them that another path brought first.",
+ relay.prunes as f64,
+ );
+ out.single(
+ "eager_forwards_total",
+ "counter",
+ "Changes forwarded over eager links, per neighbour.",
+ relay.eager_forwards as f64,
+ );
+ out.single(
"blob_requests_dropped_total",
"counter",
"Blob requests not answered: too many were being answered.",
diff --git a/src/swarm/relay.rs b/src/swarm/relay.rs
index fcca9c7..e11bd69 100644
--- a/src/swarm/relay.rs
+++ b/src/swarm/relay.rs
@@ -106,6 +106,7 @@ async fn forward_eagerly(state: &AppState, from: &str) {
continue;
}
if peer_state.lock().await.eager_to {
+ state.stats.eager_forward();
state.request_sync(&peer);
}
}
@@ -265,6 +266,7 @@ async fn graft(state: &AppState, peer: &str) {
if !set_eager_from(state, peer, true).await {
return;
}
+ state.stats.link_grafted();
debug!(peer = %peer, "Link eager: we want its changes as it applies them");
if let Err(error) = announce_heads(state, peer).await {
debug!(peer = %peer, error = %format!("{error:#}"), "Telling a neighbour the link is eager failed");
@@ -277,6 +279,7 @@ pub(crate) async fn prune(state: &AppState, peer: &str) {
if !set_eager_from(state, peer, false).await {
return;
}
+ state.stats.link_pruned();
debug!(peer = %peer, "Link lazy: its changes reach us first another way");
if let Err(error) = announce_heads(state, peer).await {
debug!(peer = %peer, error = %format!("{error:#}"), "Telling a neighbour the link is lazy failed");
diff --git a/src/swarm/stats.rs b/src/swarm/stats.rs
index 04f41b2..dd56bb0 100644
--- a/src/swarm/stats.rs
+++ b/src/swarm/stats.rs
@@ -102,6 +102,12 @@ pub(crate) struct Relay {
pub(crate) pulls: u64,
/// Announcements of heads we lacked that had to wait for the pull in progress.
pub(crate) pulls_queued: u64,
+ /// Links made eager (a pull brought changes over them) and lazy again (changes came
+ /// over them that another path brought first).
+ pub(crate) grafts: u64,
+ pub(crate) prunes: u64,
+ /// Changes forwarded over eager links: a sync message asked for per neighbour.
+ pub(crate) eager_forwards: u64,
}
/// When the initial sync finished, and what it took.
@@ -184,6 +190,18 @@ impl NodeStats {
self.lock().relay.pulls_queued += 1;
}
+ pub(crate) fn link_grafted(&self) {
+ self.lock().relay.grafts += 1;
+ }
+
+ pub(crate) fn link_pruned(&self) {
+ self.lock().relay.prunes += 1;
+ }
+
+ pub(crate) fn eager_forward(&self) {
+ self.lock().relay.eager_forwards += 1;
+ }
+
/// A sync message of `bytes` arrived.
pub(crate) fn sync_received(&self, bytes: usize) {
let mut inner = self.lock();