Refactor fanout exporter concurrent dispatch#7486
Merged
Merged
Conversation
Copilot
AI
changed the title
[WIP] Refactor duplicate code in fanoutExporter methods
Refactor fanout exporter concurrent dispatch
Jun 13, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the tracing fanout span exporter to centralize its concurrent fan-out and error aggregation behavior into a single private helper, reducing duplication between ExportSpans and Shutdown while preserving existing semantics.
Changes:
- Extract shared concurrent dispatch + joined-error aggregation into
(*fanoutExporter).forEachExporter. - Refactor
ExportSpansandShutdownto delegate to the shared helper. - Add a focused unit test validating that the helper visits all exporters and propagates callback errors.
Show a summary per file
| File | Description |
|---|---|
| internal/tracing/fanout.go | Consolidates concurrent exporter iteration + error joining into forEachExporter, simplifying ExportSpans and Shutdown. |
| internal/tracing/fanout_test.go | Adds targeted coverage for forEachExporter to ensure all exporters are invoked and errors are returned. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
Copilot AI
added a commit
that referenced
this pull request
Jun 13, 2026
Adapt debug logging to the refactored forEachExporter helper introduced in main (Refactor fanout exporter concurrent dispatch #7486). The op string parameter to forEachExporter carries operation context into per-backend error log messages, satisfying the reviewer request to identify which exporter failed.
This was referenced Jun 14, 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.
fanoutExporter.ExportSpansandfanoutExporter.Shutdowncarried the same concurrent fan-out and error aggregation logic, differing only in the exporter method invoked. This change consolidates that shared behavior so future updates to fan-out semantics happen in one place.Shared dispatch path
forEachExporterhelper onfanoutExporterPublic method simplification
ExportSpansto delegate span export through the helperShutdownto delegate exporter shutdown through the helperCoverage update