Skip to content

fix(otlp): don't configure an automatic OTel propagator - #5319

Merged
jamescrosswell merged 2 commits into
version7from
fix/issue-5299-otlp-no-auto-propagator
Sep 8, 2026
Merged

jamescrosswell merged 2 commits into
version7from
fix/issue-5299-otlp-no-auto-propagator

Conversation

@jamescrosswell

@jamescrosswell jamescrosswell commented Jun 26, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #5299

Summary

The OTLP integration spec states:

The integration MUST NOT set up an automatic propagator. Cross-service trace propagation is handled by the propagateTraceparent setting or by user-configured OTel propagators.

Our OTLP exporter was inconsistent with this: AddSentryOtlpExporter (and UseOtlp) called Sdk.SetDefaultTextMapPropagator(new SentryPropagator()), automatically configuring a global propagator. This brings us in line with the spec and with our other OTLP integrations.

Changes

  • Remove the Sdk.SetDefaultTextMapPropagator(...) call from AddSentryOtlpExporter.
  • Remove the now-purposeless defaultTextMapPropagator parameter from both AddSentryOtlpExporter and SentryOptionsExtensions.UseOtlp.
  • Update XML docs to point users at PropagateTraceparent / their own OTel propagator config.
  • Drop the obsolete custom-propagator test; add a regression test asserting AddSentryOtlpExporter leaves Propagators.DefaultTextMapPropagator untouched.

⚠️ Breaking API change. The defaultTextMapPropagator parameter shipped in 6.5.0/6.6.0 and is removed here (source + binary breaking for anyone who passed it). This PR therefore targets version7 rather than main. Note the classic (non-OTLP) Sentry.OpenTelemetry package is intentionally left unchanged — it still requires SentryPropagator.

Users who want cross-service propagation should now either set SentryOptions.PropagateTraceparent or configure OpenTelemetry propagators themselves (e.g. Sdk.SetDefaultTextMapPropagator(...)).

Follow-up

🤖 Generated with Claude Code

The OTLP integration spec states the integration MUST NOT set up an
automatic propagator; cross-service trace propagation is handled by the
propagateTraceparent setting or by user-configured OTel propagators.

AddSentryOtlpExporter / UseOtlp previously called
Sdk.SetDefaultTextMapPropagator(new SentryPropagator()), which is
inconsistent with the spec and with our other OTLP integrations. This
removes that call and the now-purposeless defaultTextMapPropagator
parameter from both public methods.

BREAKING CHANGE: removed the defaultTextMapPropagator parameter from
AddSentryOtlpExporter and UseOtlp.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.16%. Comparing base (6690704) to head (87baa96).
⚠️ Report is 137 commits behind head on version7.

Additional details and impacted files
@@             Coverage Diff              @@
##           version7    #5319      +/-   ##
============================================
- Coverage     74.16%   74.16%   -0.01%     
============================================
  Files           508      508              
  Lines         18353    18351       -2     
  Branches       3586     3585       -1     
============================================
- Hits          13612    13610       -2     
  Misses         3869     3869              
  Partials        872      872              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Co-authored-by: James Crosswell <jamescrosswell@users.noreply.github.com>
@dingsdax

dingsdax commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

@jamescrosswell this should land in the next major, we'll do the same change in Ruby & Python in their next majors

@dingsdax dingsdax added the Breaking Change Binary/Source/Behavioral Breaking Changes. label Jul 6, 2026
@jamescrosswell
jamescrosswell marked this pull request as draft July 8, 2026 05:44
@jamescrosswell jamescrosswell added the Next Major Changes scheduled for the next Major release. label Aug 30, 2026
@jamescrosswell
jamescrosswell changed the base branch from main to version7 September 6, 2026 22:57
@jamescrosswell
jamescrosswell marked this pull request as ready for review September 6, 2026 22:58
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Sep 6, 2026

@adinauer adinauer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, I assume you'll update docs once v7 is released.

@szokeasaurusrex
szokeasaurusrex removed the request for review from Flash0ver September 7, 2026 11:24
@jamescrosswell
jamescrosswell merged commit d589ac5 into version7 Sep 8, 2026
49 checks passed
@jamescrosswell
jamescrosswell deleted the fix/issue-5299-otlp-no-auto-propagator branch September 8, 2026 00:07
jamescrosswell added a commit to getsentry/sentry-docs that referenced this pull request Nov 11, 2026
> [!NOTE]
> This targets `dotnet-v7`, which collects the .NET docs for
sentry-dotnet 7.0.0. #20641 merges that branch into
`master` when 7.0.0 ships, so this PR can merge into `dotnet-v7` as soon
as it's approved.

## DESCRIBE YOUR PR

Updates the .NET OTLP page for sentry-dotnet 7.0.0. From 7.0.0,
`AddSentryOtlpExporter` no longer installs `SentryPropagator`, and the
`defaultTextMapPropagator` parameter is gone from it and from `UseOtlp`
(getsentry/sentry-dotnet#5319).

- Replaces the `SentryPropagator` bullet and the "Planned Removal" alert
with a Trace Propagation section. It covers what gets propagated by
default, how to add `SentryPropagator` for services that rely on
`sentry-trace`, and when `PropagateTraceparent` helps. A short note
covers the pre-7.0.0 behavior.
- Removes the `defaultTextMapPropagator` option.
- Raises the OpenTelemetry floor in Supported Versions to 1.12.0.
- Replaces the note saying not to set `TracesSampleRate` with a Sampling
section. With `UseOtlp()` the SDK creates no transactions, so
`TracesSampleRate` and `TracesSampler` are never read, and the OTLP
exporter installs no OpenTelemetry sampler. Sampling is configured on
the `TracerProvider`. This is true for 6.x as well.

Closes getsentry/sentry-dotnet#5546

### Notes for review

Where the page differs from the issue, it follows the source on
sentry-dotnet's `version7` branch:

- **`PropagateTraceparent` doesn't help the OTLP service itself.**
OpenTelemetry's default propagator (W3C trace context plus baggage,
which the OTel SDK installs) and the .NET runtime already send
`traceparent`. OTel's HttpClient instrumentation also overwrites any
`traceparent` that `SentryHttpMessageHandler` adds first. A local run
against a `version7` build sent identical headers with and without the
option. The page recommends it for the Sentry-traced services that call
the OTLP service, as `/concepts/otlp/sentry-with-otel/` already does.
- **`sentry-trace` doesn't disappear completely.** `UseOtlp()` stops
`SentryHttpMessageHandler` from creating spans, but its header
propagation still runs (`SentryMessageHandler.PropagateTraceHeaders`).
Sentry adds the handler to `IHttpClientFactory` clients when it's set up
through DI. Other requests only carry `sentry-trace` if the app
configures `SentryPropagator`.
- **The 1.12.0 floor already shipped in 6.11.1** (#5560 was backported
in getsentry/sentry-dotnet#5588), so that line is correct today and has
no "before 7.0.0" note.
- `SentryPropagator` is still public in `Sentry.OpenTelemetry.Exporter`
on `version7`, so the snippet doesn't need the deprecated
`Sentry.OpenTelemetry` package. It derives from `BaggagePropagator`,
which is why the composite doesn't list that one separately. The snippet
compiles against the `version7` build with OpenTelemetry 1.12.0.

## IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs
to go live.
Select exactly one option. For deadlines, replace `YYYY-MM-DD` with the
due date. You can update this information later by editing the PR
description.

- [x] Urgent deadline (GA date, etc.): 2026-11-30
- [ ] Other deadline: YYYY-MM-DD
- [ ] No deadline: Not urgent, can wait up to 1 week+

## SLA

- Teamwork makes the dream work, so please add a reviewer to your PRs.
- Please give the docs team up to 1 week to review your PR unless you've
supplied a deadline.

Thanks in advance for your help!

## PRE-MERGE CHECKLIST

_Make sure you've checked the following before merging your changes:_

- [ ] Checked Vercel preview for correctness, including links
- [ ] PR was reviewed and approved by any necessary SMEs (subject matter
experts)
- [ ] PR was reviewed and approved by a member of the [Sentry docs
team](https://github.com/orgs/getsentry/teams/docs)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: ric-oliv <5938598+ric-oliv@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking Change Binary/Source/Behavioral Breaking Changes. Next Major Changes scheduled for the next Major release. risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disable automatic propagator for OTLP

3 participants