Skip to content

ref(core): Remove deprecated traceSampling option - #6415

Draft
sentry-junior[bot] wants to merge 3 commits into
9.x.xfrom
ref/remove-trace-sampling-option
Draft

sentry-junior[bot] wants to merge 3 commits into
9.x.xfrom
ref/remove-trace-sampling-option

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

📜 Description

Removes the traceSampling option for 9.0:

  • SentryOptions.isTraceSampling() / setTraceSampling(boolean) and the backing field
  • Android manifest key io.sentry.traces.trace-sampling (ManifestMetadataReader.TRACE_SAMPLING)
  • The isTraceSampling() gates in SentryTracer and OtelSpanWrapper (traceContext() / toBaggageHeader()), TracingUtils.traceIfAllowed, and SentryApolloInterceptor
  • Tests that only covered the option being disabled, plus isTraceSampling = true setup lines that matched the default

After this change:

  • traceContext() and toBaggageHeader() return a value whenever the transaction has baggage.
  • tracePropagationTargets is the only setting that controls outgoing sentry-trace/baggage headers.

💡 Motivation and Context

traceSampling has defaulted to true since 6.5.0-beta.2 (#2255). The getter is @ApiStatus.Experimental, the setter is @Deprecated in favor of tracePropagationTargets, and both Javadocs say "will be removed without notice". Even so, it still worked as a hidden switch for trace propagation in core, OpenTelemetry, Apollo and Android. Removing it leaves one supported way to control propagation.

Behavior change for anyone who set it to false:

  • Outgoing HTTP: they can get the same result with an empty tracePropagationTargets. Apollo is the exception, because it calls TracingUtils.trace directly and has no URL to match against.
  • Envelopes: there is no replacement for dropping the envelope trace header. Transactions with baggage always attach it now.

💚 How did you test it?

Ran locally on JDK 21:

  • :sentry:test: TracingUtilsTest, SentryTracerTest, SpanTest, SentryClientTest
  • :sentry-opentelemetry:sentry-opentelemetry-core:test
  • :sentry-openfeign:test
  • SentrySpanRest*CustomizerTest in sentry-spring-boot, sentry-spring-boot-jakarta and sentry-spring-boot-4
  • :sentry-apollo:compileKotlin
  • :sentry:apiDump, plus spotlessApply on the changed JVM modules

No Android SDK was available in the sandbox, so sentry-android-core (ManifestMetadataReader and its test) was not built locally. That change only deletes lines plus the now-unused ApiStatus import. CI should cover it.

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

  • Decide whether 9.0 needs a replacement switch for dropping the envelope trace header. I don't think it does, but I'd like a reviewer to confirm.
  • Check whether hybrid SDKs (RN, Flutter, Unity, etc.) set traceSampling / io.sentry.traces.trace-sampling.
  • Update the docs and the 9.0 migration guide where the option is mentioned.

via alexander.dinauer.

--

View Junior Session [Sentry]

sentry-junior Bot and others added 2 commits October 29, 2026 09:52
Remove SentryOptions.isTraceSampling/setTraceSampling and the
io.sentry.traces.trace-sampling Android manifest key. The option has
defaulted to true since 6.5.0 and was marked experimental and deprecated
in favor of tracePropagationTargets. Trace context and baggage are now
always produced when a transaction has baggage, and outgoing tracing
headers are controlled by tracePropagationTargets alone.

Co-Authored-By: Alexander Dinauer <alexander.dinauer@sentry.io>
Co-Authored-By: Alexander Dinauer <alexander.dinauer@sentry.io>
@sentry

sentry Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.62.0 (1) release

⚙️ sentry-android Build Distribution Settings

The mocked SentryOptions used to return false for isTraceSampling, which
skipped baggage computation on transaction finish. With the option
removed, SentryTracer always fills baggage values and needs a parsed DSN.

This branch has not been deployed

No deployments
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.

0 participants