Skip to content

Conversation

@sl0thentr0py
Copy link
Member

@sl0thentr0py sl0thentr0py commented Dec 11, 2025

Description

  • bail out of iter_trace_propagation_headers if we have an external_propagation_context
  • handle outgoing headers as best as possible based on just the available SpanContext from otel
  • NOTE for baggage:
    • is correctly passed through in the incoming case
    • but for the head SDK, we cannot populate it in a persistent way across the span tree (no transaction concept)
    • so dynamic sampling with OTLP is out of scope right now

Issues

@sl0thentr0py sl0thentr0py force-pushed the neel/otlp-outgoing-propagator branch 2 times, most recently from ddec242 to 7f7d432 Compare December 12, 2025 15:17
* bail out of `iter_trace_propagation_headers` if we have an
  `external_propagation_context`
* handle outgoing headers as best as possible based on just the
  available `SpanContext` from otel
* NOTE for baggage:
  * is correctly passed through in the incoming case
  * but for the head SDK, we cannot populate it in a persistent way
    across the span tree (no transaction concept)
  * so dynamic sampling with OTLP is out of scope right now
@sl0thentr0py sl0thentr0py force-pushed the neel/otlp-outgoing-propagator branch from 7f7d432 to 042f445 Compare December 12, 2025 15:18
@sl0thentr0py sl0thentr0py marked this pull request as ready for review December 12, 2025 15:18
@sl0thentr0py sl0thentr0py requested a review from a team as a code owner December 12, 2025 15:18
@linear
Copy link

linear bot commented Dec 12, 2025


baggage = get_value(SENTRY_BAGGAGE_KEY, context)
if baggage is not None and isinstance(baggage, Baggage):
setter.set(carrier, BAGGAGE_HEADER_NAME, baggage.serialize())
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Empty baggage header may be set unexpectedly

The inject method sets the baggage header without checking if serialize() returns an empty string. When an incoming request has a sentry-trace header but no baggage header (or only third-party baggage items), the extract method creates an empty Baggage object that gets stored in context. On inject, baggage.serialize() returns "" for this empty baggage, resulting in an empty baggage header being set on outgoing requests. The parent class SentryPropagator avoids this by checking if baggage_data: before calling setter.set().

Fix in Cursor Fix in Web

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.

Apply external_propagation_context in Propagator.inject

2 participants