open-telemetry / open-telemetry/opentelemetry-java

Ability to update baggage from SpanProcessor

Open
#4,999 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

blocked:spec Feature Request
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.