feat: expose the gRPC control API on a network address - #37
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
dwd.v1.DwdgRPC 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-addrflag that serves the sameDwdServiceinstance 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-protonow 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.