Repository navigation
fix: Fix shared trace dispatcher lifecycle and discovery - #1243
Merged
Merged
Conversation
Balance client ownership from construction through shutdown, preserve trace batching and NameServer failover, and safely replace trace interceptors. Separate address discovery from route refresh, reuse concurrent route lookups, publish broker addresses before queues, and avoid mutating resolver snapshots. Add lifecycle, migration, concurrency, and timeout regression coverage.
ShannonDing
approved these changes
Oct 8, 2026
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.
What is the purpose of the change
Fix trace dispatcher failures when consumers are recreated in a long-running process after NameServer discovery changes.
Previously, trace initialization could return a typed nil dispatcher, causing the interceptor to panic before invoking the business callback.
Closing a dispatcher also left its underlying client behind.
This change makes unavailable tracing preserve business callback execution and gives shared trace resources an explicit lifecycle, while retaining
the existing
WithTraceAPI andTraceConfiglayout.Brief changelog
WithSharedTracesupport for sharing trace resources by stable logical destination, with additional isolation by unit, accesschannel and credentials. An independent resolver factory manages discovery ownership.
shutdown, and release resources after the final user closes.
docs/trace.md.The general producer/consumer client registry and its NameServer conflict checks remain unchanged.
Verifying this change
-raceininternal,consumerandproducer.-raceafter the fix.git diff --checkpassed.Full-suite success is not claimed. The full run encountered an asynchronous mock expectation failure in
consumer.TestStartand a timeout ininternal/remote.TestInvokeAsyncTimeout. Both were independently reproduced against the unmodified upstream baseline.Checklist
[ISSUE #<number>] Fix shared trace dispatcher lifecycle and discovery.patch.