Fix ecaptureQ remote mode: wire event writer to probe dispatcher#964
Fix ecaptureQ remote mode: wire event writer to probe dispatcher#964
Conversation
When --ecaptureq flag is specified, events from eBPF probes were not being sent to the ecaptureQ WebSocket server. The ecaptureQEventWriter was defined but never instantiated or connected to the event dispatch pipeline. Changes: - Add GetEventWriter/SetEventWriter to domain.Configuration interface - Create IOWriterAdapter to wrap io.Writer as OutputWriter - Modify ecaptureQEventWriter to encode events as protobuf LogEntry - In runProbe(), create ecaptureQEventWriter and set on probe config - In BaseProbe.Initialize(), register additional TextHandler for ecaptureQ Co-authored-by: cfc4n <709947+cfc4n@users.noreply.github.com> Agent-Logs-Url: https://github.com/gojue/ecapture/sessions/21b7ed29-95c2-44c1-9d2f-2cfc798a7da7
Co-authored-by: cfc4n <709947+cfc4n@users.noreply.github.com> Agent-Logs-Url: https://github.com/gojue/ecapture/sessions/21b7ed29-95c2-44c1-9d2f-2cfc798a7da7
…ng to server, replace handler instead of adding alongside 1. cli/cmd/ecaptureq.go: Reverted Write() to simple pass-through (like pre-refactoring) 2. pkg/ecaptureq/server.go: Moved protobuf encoding into WriteEvent() (consistent with WriteLog()) 3. internal/probe/base/base_probe.go: When --ecaptureq EventWriter is set, use it as the ONLY text handler (replaces file/socket handler, avoiding conflict) Co-authored-by: cfc4n <709947+cfc4n@users.noreply.github.com> Agent-Logs-Url: https://github.com/gojue/ecapture/sessions/bd7d5c23-7f1d-4f64-b6de-ae9a88f604d2
There was a problem hiding this comment.
Pull request overview
This PR fixes ecaptureQ remote mode by ensuring probe-dispatched events are routed through the ecaptureQ WebSocket server using the protobuf LogEntry event protocol, rather than being written to the default file/socket output path.
Changes:
- Encode events as protobuf
LogEntry(EVENT) inServer.WriteEvent()and broadcast to connected WebSocket clients. - Wire a pre-configured
io.Writerevent sink from CLI (--ecaptureq) into probe initialization so it replaces the default text output writer. - Introduce an
io.Writer→writers.OutputWriteradapter and extend configuration interfaces/implementations to carry the event writer.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/ecaptureq/server.go | Moves event protobuf encoding into WriteEvent() and broadcasts encoded messages. |
| internal/probe/base/base_probe.go | Uses cfg.GetEventWriter() (when present) as the sole text output writer for event dispatch. |
| internal/output/writers/iowriter_adapter.go | Adds an adapter to wrap io.Writer as an OutputWriter. |
| internal/domain/configuration.go | Extends the Configuration interface with GetEventWriter/SetEventWriter. |
| internal/config/base_config.go | Stores EventWriter io.Writer (non-JSON) and implements the new interface methods. |
| cli/cmd/root.go | In --ecaptureq mode, sets the probe config’s event writer to the ecaptureQ event writer. |
| cli/cmd/ecaptureq.go | Adjusts ecaptureQEventWriter.Write to use a pointer receiver. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
✅ E2E Test Results: PASSEDTest Run: #23544996141 Tests Executed:
✅ All e2e tests passed successfully! The TLS capture functionality is working correctly. Automated e2e test results for commit 3f77697 |
…atalf) Agent-Logs-Url: https://github.com/gojue/ecapture/sessions/9e44f264-f38e-4e82-898f-07211176b0c7 Co-authored-by: cfc4n <709947+cfc4n@users.noreply.github.com>
Agent-Logs-Url: https://github.com/gojue/ecapture/sessions/faff6ee7-1299-4da2-b631-919f40080e85 Co-authored-by: cfc4n <709947+cfc4n@users.noreply.github.com>
✅ E2E Test Results: PASSEDTest Run: #23685328652 Tests Executed:
✅ All e2e tests passed successfully! The TLS capture functionality is working correctly. Automated e2e test results for commit 39057e4 |
test/e2e/ecaptureq_e2e_test.shE2E测试脚本(模仿 tls_e2e_test.sh 风格)e2e-ecaptureq目标e2e-advanced目标中.github/workflows/e2e.yml添加 ecaptureq_client 构建步骤和测试说明Original prompt
📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.