userspace: add bounded dataplane event producer#1404
Conversation
|
@copilot review |
There was a problem hiding this comment.
Pull request overview
Adds bounded userspace dataplane event producer infrastructure for future RT_FLOW policy-deny, screen-drop, and filter-log emission, while keeping runtime call-site wiring as follow-up work.
Changes:
- Adds Rust producer-side rate limiting, non-blocking enqueue, and per-kind/drop-reason counters.
- Updates event-stream stats behavior/tests for queued/sent accounting.
- Updates documentation/status tests to reflect the infrastructure vs. remaining call-site gap.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
userspace-dp/src/event_stream/producer.rs |
Adds dataplane event producer, limiter, outcomes, and counters. |
userspace-dp/src/event_stream/producer_tests.rs |
Covers enqueue, rate-limit, queue-full, and disconnected outcomes. |
userspace-dp/src/event_stream/mod.rs |
Wires producer module, stats fields, shared state, and send accounting. |
userspace-dp/src/event_stream/tests.rs |
Adds sent-counter assertions for existing send paths. |
userspace-dp/src/event_stream/README.md |
Documents producer API and RT_FLOW telemetry requirements. |
pkg/dataplane/userspace/statusfmt_test.go |
Extends status summary expectations for event-stream counters. |
docs/userspace-dataplane-gaps.md |
Updates dataplane event logging gap status. |
docs/pr/1373-retire-ebpf-dataplane/plan-1379-dataplane-events.md |
Updates implementation status, invariants, tests, and remaining gaps. |
| pub(crate) fn try_emit_dataplane_event_at( | ||
| &self, | ||
| event: DataplaneEventPayload, | ||
| now_ns: u64, | ||
| ) -> DataplaneEventEmitOutcome { |
Round-1 Codex review on
|
Round-2 Codex review on
|
|
@copilot review |
Addressed in e101bf7: limiter runtime now precomputes interval/burst horizon once, and telemetry admission adds bounded total/per-kind queue budgets so session/control frames retain reserved shared-channel capacity.
Addressed in 9fc6d0b: telemetry budget is no longer released on mpsc dequeue; it is held through replay retention and released on ACK trim or definitive drop paths (eviction/drain), with connected-loop tests covering the would-block/drain behavior.
Completed a fresh adversarial pass on the current head (e101bf7 + 9fc6d0b). I don’t see additional major blockers beyond the issues those two commits already resolved. |
| fn rate_bucket_index(kind: DataplaneEventKind, ingress_zone_id: u16) -> usize { | ||
| let zone_bucket = usize::from(ingress_zone_id).min(DATAPLANE_EVENT_ZONE_BUCKETS - 1); | ||
| kind_index(kind) * DATAPLANE_EVENT_ZONE_BUCKETS + zone_bucket |
| impl EventStreamWorkerHandle { | ||
| /// Fixed-size, non-blocking dataplane telemetry emission. | ||
| /// | ||
| /// `now_ns` is a caller-supplied monotonic timestamp used only for rate | ||
| /// limiting; `event.timestamp_ns` remains the on-wire event timestamp. | ||
| pub(crate) fn try_emit_dataplane_event_at( | ||
| &self, | ||
| event: DataplaneEventPayload, | ||
| now_ns: u64, | ||
| ) -> DataplaneEventEmitOutcome { |
Claude r3 review on
|
Round-3 triple-review synthesis on
|
| Reviewer | Verdict |
|---|---|
| Claude | MERGE-READY |
| Codex | MERGE-READY |
| Gemini Pro 3 | MERGE-READY |
All three converge. r2 budget-release MAJOR is closed.
Codex confirmation
- Producer reordering at producer.rs:268-323: acquire-before-encode; rate-limit and queue-full paths return BEFORE budget acquisition.
- Release encapsulated in
pop_replay_frame(mod.rs:734-741); four legitimate caller sites (ACK trim 599-605, replay eviction 723-731, shutdown drain 707-715 + 745-749). - New test at tests.rs:152-245 explicitly pins the r2 bug: drains mpsc into replay, asserts second emit gets
QueueFull(would have succeeded under r2's drain-time release). - README at README.md:57-67 accurately describes acquire → queue → replay-retain → ACK/drop → release.
Gemini confirmation
Same findings with quote evidence. Noted "the only Vec::new and vec! calls introduced exist strictly inside test cases" — no hot-path allocation.
Open note
Codex flagged decrement_if_positive underflow guard is weak in release build, but no reachable double-release path in this patch. Tracker-only.
Recommendation
Merge-ready.
Codex task: task-mpaag88k-mtifyw. Gemini task: task-mpaagqdu-37x92v. Not merging — author's decision.
9fc6d0b to
aa6f366
Compare
Adds bounded dataplane event producer (#1404) in userspace. Fixes event producer queue fairness. Holds event telemetry budget until ack or drop. Touches userspace-dp/src/event_stream, docs/pr/1373-retire-ebpf-dataplane, pkg/dataplane/userspace, and docs/userspace-dataplane-gaps.md across documentation, tests, userspace dataplane, and dataplane integration. The largest file deltas are userspace-dp/src/event_stream/producer.rs, userspace-dp/src/event_stream/producer_tests.rs, and userspace-dp/src/event_stream/tests.rs. The diff is 1025 additions and 34 deletions across 9 files.
Summary
Refs #1379.
Adds the bounded userspace dataplane event producer infrastructure needed before wiring policy-deny, screen-drop, and filter-log call sites:
EventStreamWorkerHandleThis intentionally does not claim full #1379 closure. Runtime producer call sites, operator-surfaced helper counters, and end-to-end syslog validation remain open.
Validation
cargo test event_streamgo test ./pkg/dataplane/userspacego test ./pkg/apigit diff --check