Skip to content

Update go module#2

Merged
delta003 merged 3 commits into
mainfrom
mb/fix-module
Jul 17, 2025
Merged

Update go module#2
delta003 merged 3 commits into
mainfrom
mb/fix-module

Conversation

@delta003
Copy link
Copy Markdown
Member

No description provided.

@delta003 delta003 merged commit c669c62 into main Jul 17, 2025
1 check passed
delta003 added a commit that referenced this pull request Jul 17, 2025
@delta003 delta003 mentioned this pull request Jul 17, 2025
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.-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants