You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sim(network): expose send-window occupancy as metrics #205
Follow-up to #202, which deliberately added no metrics.
Why
Each stream direction now carries an exact accounting: outstanding = queued + in_flight + unread_at_peer, bounded by tcp_send_window_bytes, plus how long a writer sits parked on a full window. That is precisely the "queue is filling, reader is falling behind, writer is stalled" signal the metastability work wants to see in queue/busyness metrics, and today it is only reachable through SimWorld::outstanding_send_bytes and friends from a test.
Requested
Publish, per connection direction (or aggregated per process IP, whichever the metrics architecture keys on), through the existing app-metrics path the runner already fills into SimulationMetrics::app_series:
net_writer_blocked (gauge, 0/1) or a cumulative net_writer_blocked_ns, sampled from the send-window waiter registry;
optionally net_in_flight_held (a partition is freezing this direction).
Constraints
Observation only: sampling must draw no randomness, register no wakers, and must not change when events run (no scheduler-driven sampling that adds events to the timeline, which would shift seeds).
Cheap: O(1) per sample from the fields already kept on ConnectionState; do not walk in_flight or send_buffer on every step.
The accounting must stay owned by the engine; metrics read it, never maintain a second copy.
Acceptance
The tests/flow_control.rs campaign (streamer into a slow reader with a 4 KiB window) shows net_outstanding_bytes pinned at the window and net_writer_blocked at 1 while the reader sleeps, and both dropping when it reads.
check_determinism stays green with metrics enabled.
Closing: this issue served the old paros metastability work, which the paros rework removed (archive tag v0.2.0-alpha.1). No current user asks for send-window metrics. Reopen it if a user needs them.
Activity
PierreZ commentedon Nov 19, 2026
Closing: this issue served the old paros metastability work, which the paros rework removed (archive tag
v0.2.0-alpha.1). No current user asks for send-window metrics. Reopen it if a user needs them.Generated by Claude Code