Skip to content

feat: expose the gRPC control API on a network address - #37

Merged
3Hren merged 1 commit into
masterfrom
feat/grpc-remote-control
Jul 26, 2026
Merged

3Hren merged 1 commit into
masterfrom
feat/grpc-remote-control

Conversation

@3Hren

@3Hren 3Hren commented Jul 26, 2026

Copy link
Copy Markdown
Member

The dwd.v1.Dwd gRPC service (Control, StreamStats, Describe) was served only over the in-memory pipe backing the built-in TUI, so there was no way to control a run remotely; headless (--no-ui) runs dropped the control channel entirely and could only be stopped by signals.

This PR adds a global --grpc-addr flag that serves the same DwdService instance on a TCP address, giving remote clients full control over the run: set the RPS, suspend/resume the profile and stream live statistics. The service is shared between the in-memory TUI seam and the network endpoint, and headless runs keep the control channel alive whenever the network endpoint is up, enabling fully API-driven runs (--no-ui --grpc-addr).

The contract is extended with StopControl: a remote stop flips the shared run flag, so the engine drains and the process shuts down gracefully, exactly like a TUI exit or SIGTERM.

gRPC server reflection (v1 + v1alpha) is enabled on the network endpoint so grpcurl & co discover the API without local proto files; dwd-proto now emits and exposes the encoded file descriptor set for that.

Covered by unit tests for the control handler (event forwarding, stop semantics) and a TCP round-trip test of the network endpoint. Verified live: a headless UDP run driven entirely over grpcurl — set 5000 RPS (stream confirmed the target and growing TX counters), then stop, which produced a graceful shutdown with the end-of-run summary. README documents the new flag with examples.

The dwd.v1.Dwd gRPC service (Control, StreamStats, Describe) was served
only over the in-memory pipe backing the built-in TUI, so there was no
way to control a run remotely; headless (--no-ui) runs dropped the
control channel entirely and could only be stopped by signals.

Add a global --grpc-addr flag that serves the same DwdService instance
on a TCP address, giving remote clients full control over the run: set
the RPS, suspend/resume the profile and stream live statistics. The
service is shared between the in-memory TUI seam and the network
endpoint, and headless runs keep the control channel alive whenever the
network endpoint is up, enabling fully API-driven runs
(--no-ui --grpc-addr).

Extend the contract with StopControl: a remote stop flips the shared
run flag, so the engine drains and the process shuts down gracefully,
exactly like a TUI exit or SIGTERM.

Enable gRPC server reflection (v1 + v1alpha) on the network endpoint so
grpcurl & co discover the API without local proto files; dwd-proto now
emits and exposes the encoded file descriptor set for that.

Covered by unit tests for the control handler (event forwarding, stop
semantics) and a TCP round-trip test of the network endpoint; README
documents the new flag with grpcurl examples.
@3Hren
3Hren merged commit 5c27059 into master Jul 26, 2026
8 checks passed
@3Hren
3Hren deleted the feat/grpc-remote-control branch July 26, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant