open-telemetry / open-telemetry/opentelemetry-java
Ability to update baggage from SpanProcessor
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 2.5k
- Forks
- 1k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 58
Description
Is your feature request related to a problem? Please describe.
Opentelemetry Java instrumentation architecture provides the ability to plugin a custom SpanProcessor which provides the flexibility to perform our custom operations on every span start and end. However, there is a limitation, we can't add or update a baggage from SpanProcessor.
If the ability to add/update baggage from SpanProcessor is supported, it will be very helpful extension that allows us to add rich custom functionalities using a SpanProcessor. For example, one would like to dynamically compute a baggage value from span data (attributes, events, links) in a span processor and then add/update computed baggage value to current span context which can then be propagated to child spans.
I believe, we can achieve many customizations around span start and end if the baggage management functionality is supported from a Span Processor.
Describe the solution you'd like
Ability to add/update baggage from Span Processor (both from onStart and onEnd operations).
Describe alternatives you've considered
There is an open enhancement to support the baggage update functionality using global ContextCustomizer. But I believe Span Processor is the right place to achieve this. Moreover, SpanProcessor is applied to auto instrumented as well as manually instrumented spans whereas ContextCustomizers are applied only for auto instrumented spans.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the SpanProcessor onStart and onEnd operations and the related ContextCustomizer enhancement in issue #6651. Clarify the API and context-lifecycle design needed to add or update baggage from both processor callbacks, with completion defined by support for propagation to child spans.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- observability-sre
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100