pub struct ReplicationMetrics {
pub acked_sequence: [Atomic<u64>; 2],
pub in_memory_sequence: [Atomic<u64>; 2],
pub bytes_sent: [Atomic<u64>; 2],
pub ack_latency_us: [Atomic<u64>; 2],
pub acks_received: [Atomic<u64>; 2],
pub catching_up: [Atomic<bool>; 2],
pub evictions_total: Atomic<u64>,
pub divergence_total: Atomic<u64>,
}Expand description
Per-slot replication metrics exposed via the health endpoint.
The two-element arrays mirror the topology cap of 1 primary + 2 replica slots. Sized at compile time because the cluster shape is
fixed by the response gate’s MAX_CLUSTER_SIZE (see
crate::durability_policy::MAX_CLUSTER_SIZE); a Vec would add
a layer of indirection on every health-endpoint read for zero
gain.
Fields§
§acked_sequence: [Atomic<u64>; 2]Per-slot acked sequence (last sequence the replica confirmed as durable). Used to compute per-replica replication lag.
in_memory_sequence: [Atomic<u64>; 2]Per-slot in-memory sequence (last sequence the replica has
accepted into its pipeline pre-journal). Always
>= acked_sequence. Used by the multi-level durability gate
(see crate::durability_policy).
bytes_sent: [Atomic<u64>; 2]Per-slot bytes sent to the replica (cumulative). Includes catch-up and live streaming.
ack_latency_us: [Atomic<u64>; 2]Per-slot ack round-trip latency in microseconds. Updated on each ack by measuring elapsed time since the last batch send.
acks_received: [Atomic<u64>; 2]Per-slot cumulative count of valid Ack frames recorded
(monotonic across reconnects — never reset on disconnect, like
bytes_sent). Dividing the growth of acked_sequence /
in_memory_sequence by the growth of this counter between two
health samples gives the mean ack quantum — how many sequences
each cursor advance covers, the number that bounds the
durability gate’s queueing delay under load.
catching_up: [Atomic<bool>; 2]Per-slot catch-up state: true while streaming historical journal entries, false once the replica enters live mode.
evictions_total: Atomic<u64>Total eviction count (both slots combined). Incremented when the journal stage’s backpressure timeout fires.
divergence_total: Atomic<u64>Total divergent-replica handshake verdicts (both slots combined): connections whose journal chain failed validation and were routed through archive + snapshot re-seed. Every divergence funnels through this counter — an ex-primary rejoining after failover AND a replica that detected mid-stream divergence and reconnected to repair in-process. Growth outside an expected failover rejoin means data corruption or a serious bug somewhere in the cluster and warrants immediate investigation.