feat(go): add diagnostic event subscriptions to TCP client - #4120
Draft
explise wants to merge 1 commit into
Draft
Conversation
Port client lifecycle events to the Go SDK, mirroring the Rust SDK's DiagnosticEvent stream. Adds a DiagnosticEvent enum, SubscribeEvents() on the Client interface, and a non-blocking fan-out broadcaster in the TCP client. Emission is wired into the transport and session transitions: Connected on connect, Disconnected on connect failure/invalidate/disconnect, Shutdown (and channel close) on close, SignedIn/SignedOut on login/logout, and Redirected after a leader redirection is torn down.
explise
force-pushed
the
feat/3219-go-diagnostic-events
branch
from
September 10, 2026 12:17
25dffb3 to
7054617
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #4120 +/- ##
============================================
- Coverage 86.02% 85.57% -0.45%
Complexity 1451 1451
============================================
Files 1248 1250 +2
Lines 194879 194949 +70
Branches 160177 160177
============================================
- Hits 167637 166829 -808
- Misses 23141 24062 +921
+ Partials 4101 4058 -43
🚀 New features to boost your workflow:
|
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.
Which issue does this PR address
Closes #3219
Rationale
The TCP client had
// TODO publish eventstubs at the connect/disconnect/shutdown paths with no way for callers to observe connection or auth state
changes. This fills those in and is groundwork for a high-level
IggyConsumerabstraction: diagnostic events let the consumer detect disconnects and re-join
consumer groups eagerly on reconnect. They are also useful on their own for
application-level observability (logging drops, health metrics).
What changed?
DiagnosticEventenum +String()incontracts/, andSubscribeEvents()on the
Clientinterface.independent subscribers, with an idempotent unsubscribe function.
Connected), failed connect / invalidate /disconnect (
Disconnected), shutdown (Shutdown, then channel close),login (
SignedIn), logout (SignedOut) and leader redirection(
Redirected).Review feedback addressed
Rebased onto current
master(adapting to thetransportState/sessionStatesplit and the reworked
register/settleOnLeadersign-in flow) and appliedthe open review threads from #3621:
Redirectedis now published after the teardown, not before.Connected/Disconnectedare published before releasingc.mtx.once.Do, noclosed-guard in
unsubscribe,slices.Delete, and the broadcaster is heldby value.
per-package
testcontainersTestMain, removing the container-leak onstartup failure.
Local Execution
gofmt,go build ./...,go vet ./...clean.go test ./client/tcp/).apache/iggy:edgeserver: all 5TestDiagnosticEvents_*cases (signed-in, signed-out, shutdown + channelclose, multiple subscribers, full lifecycle).
-race:IGGY_TCP_ADDRESS=... go test -race ./....AI Usage
master, applying the prior reviewfeedback, and test repair.
go build/go vet/gofmt, unit tests, and theintegration suite run against a real server, including
-race.