Update go module#2
Merged
Merged
Conversation
AdamGS
approved these changes
Jul 17, 2025
Merged
delta003
added a commit
that referenced
this pull request
Jul 17, 2025
robert3005
pushed a commit
that referenced
this pull request
Aug 27, 2025
…ing - approach #2 (open-telemetry#13460) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description This PR provides a solution to propagate context values across batching. This is particularly useful in scenarios where context carries important metadata—such as authentication tokens. **New API** A new API has been added to support this functionality: ``` mergeCtx func(ctx1 context.Context, ctx2 context.Context) context.Context ``` By supplying a custom mergeCtx function, users can control how context values are preserved or combined—for example, by selectively copying specific keys, merging metadata, or keeping the larger value. Note: `context.Context` returned from the above function should not override `Value()` function. **Default Behavior** If mergeCtx is not provided (i.e., left as nil), the batching system defaults to a conservative behavior: no context values are retained from the original incoming contexts. Users who need context propagation must explicitly opt in by defining and supplying a mergeCtx function. <!-- Issue number if applicable --> #### Link to tracking issue open-telemetry#13320 <!--Describe what testing was performed and which tests were added.--> #### Testing * `batch_context_test.go` checks the `mergeCtx` does not interfere with span link * `partition_batcher_test.go` checks `mergeCtx=nil` works properly <!--Describe the documentation added.--> #### Documentation <!--Please delete paragraphs that you did not use before submitting.-->
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.
No description provided.