Skip to content

ref: Decouple propagator from span processor#1223

Closed
giortzisg wants to merge 4 commits intomasterfrom
ref/otel-propagator
Closed

ref: Decouple propagator from span processor#1223
giortzisg wants to merge 4 commits intomasterfrom
ref/otel-propagator

Conversation

@giortzisg
Copy link
Copy Markdown
Contributor

Description

This changes the current behavior of the sentry otel propagator to work without needing the span processor. The change is influenced by the otlp integration also needing a propagator, and since it doesn't make sense to couple the otlp integration with the span_map, this extracts and refines the propagator functionality to:

  • receive a WithDSCSource to override fetching the dynamic sampling context. When using alongside span processor the propagator should inject the span map, so that it can fetch the DSC from the span itself.
  • for otlp we only propagate the baggage as is in case we received it, or skip
  • the extract stays as is

The PR also moves the propagator under otel/internal/common so that it can be re-used by the PR that will implement the otlp integration under otel/otlp.

Note

Tried to split the changes into first refactoring the propagator.go in-place and then move it under common, but the diff still shows it as a separate file. For easier review, it's probably better to have a look at the individual commits.

Issues

Changelog Entry Instructions

To add a custom changelog entry, uncomment the section above. Supports:

  • Single entry: just write text
  • Multiple entries: use bullet points
  • Nested bullets: indent 4+ spaces

For more details: custom changelog entries

Reminders

@giortzisg giortzisg requested a review from sl0thentr0py March 10, 2026 16:10
@giortzisg giortzisg self-assigned this Mar 10, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 10, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • Add support for homogenous arrays by giortzisg in #1203
  • Add support for client reports by giortzisg in #1192
  • add org id propagation in sentry_baggage by giortzisg in #1210
  • add OrgID and StrictTraceContinuation client options. by giortzisg in #1210
  • Add the option to set attributes on the scope by giortzisg in #1208

Bug Fixes 🐛

  • (serialization) Pre-serialize mutable event fields to prevent race panics by giortzisg in #1214
  • Use HEROKU_BUILD_COMMIT with HEROKU_SLUG_COMMIT as fallback by ericapisani in #1220

Internal Changes 🔧

Ai

  • Add AGENTS.md and testing guidelines by giortzisg in #1216
  • Add dotagents configuration by giortzisg in #1211

Deps

  • Bump getsentry/craft from 2.20.1 to 2.23.1 by dependabot in #1213
  • Bump github.com/gofiber/fiber/v2 from 2.52.11 to 2.52.12 in /fiber by dependabot in #1209

Other

  • Decouple propagator from span processor by giortzisg in #1223
  • Handle independent go module versions for integrations by giortzisg in #1217

🤖 This preview updates automatically when you update the PR.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment thread otel/span_map.go
// freeze it for the transaction itself.
txn.SetDynamicSamplingContext(dsc)
return dsc, true
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

GetDSC overwrites frozen upstream DSC with local values

High Severity

GetDSC unconditionally calls DynamicSamplingContextFromTransaction(txn) which recomputes the DSC from the local transaction's fields, then overwrites the transaction's DSC via SetDynamicSamplingContext. This ignores any already-frozen upstream DSC that was set on the transaction by the span processor during OnStart. The old ToBaggage() method checked !s.dynamicSamplingContext.IsFrozen() before recomputing, preserving upstream-propagated DSC entries (like the originating service's public_key, release, environment). The new code always replaces those with locally-computed values, breaking DSC propagation in distributed traces.

Fix in Cursor Fix in Web

@giortzisg giortzisg changed the title ref: decouple propagator from span processor ref: Decouple propagator from span processor Mar 11, 2026
@giortzisg giortzisg closed this Mar 13, 2026
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.

Decouple otel propagator from span map

1 participant