Skip to content

feat(android)!: Disable legacy profiling by default - #6837

Open
adinauer wants to merge 3 commits into
9.x.xfrom
feat/disable-legacy-profiling-default-v9
Open

adinauer wants to merge 3 commits into
9.x.xfrom
feat/disable-legacy-profiling-default-v9

Conversation

@adinauer

@adinauer adinauer commented Dec 2, 2026

Copy link
Copy Markdown
Member

📜 Description

Changes the Android enableLegacyProfiling default from true to false for version 9. The legacy Debug-based transaction and continuous profilers remain available, but applications must explicitly opt in on API levels below 35 or when using transaction-based profiling.

The option is now deprecated for removal in version 10. API 35+ continues to use Perfetto continuous profiling, including when a legacy transaction profiling sample rate is still configured. Persisted pre-v9 app-start profiling configuration is ignored so it cannot enable the legacy profiler once after an upgrade.

💡 Motivation and Context

Android's legacy runtime tracer can cause Android Runtime crashes. Disabling it by default reduces that risk without removing profiling V1 or the pre-API-35 backend during the version 9 release cycle.

Refs #5094

💚 How did you test it?

  • ./gradlew :sentry:clean :sentry:test --tests io.sentry.SentryOptionsTest --tests io.sentry.JsonSerializerTest --tests io.sentry.SentryTest
  • ./gradlew :sentry-android-core:testReleaseUnitTest --tests io.sentry.android.core.AndroidOptionsInitializerTest --tests io.sentry.android.core.ManifestMetadataReaderTest --tests io.sentry.android.core.SentryPerformanceProviderTest
  • make format api

📝 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

  • Update Android profiling documentation in getsentry/sentry-docs and onboarding in getsentry/sentry before the version 9 release.
  • Communicate the changed default and version 10 removal plan to hybrid SDK maintainers.

adinauer and others added 2 commits December 2, 2026 15:30
Require applications to explicitly opt into the crash-prone Debug-based profiler while keeping the legacy implementation available for version 9. Deprecate the option for removal in version 10 and preserve Perfetto continuous profiling on API 35 and newer.

Refs GH-5094

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 6326105

@github-actions github-actions Bot added the risk: high PR risk score: high label Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

PR risk: high

For commit b4efbc6.

Main concerns: public contract, reach, data sent to Sentry.

This label is a hint for reviewers, not an approval.

<meta-data
android:name="io.sentry.traces.profiling.session-sample-rate"
android:value="1.0" />
<!-- Deprecated: temporarily opt into profiling below API 35. Removed in version 10. -->

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should we remove this again so people don't get drawn into something we'll remove in v10?

@sentry

sentry Bot commented Dec 2, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

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

⚙️ sentry-android Build Distribution Settings

Close a continuous profiler started from previous-launch configuration
when the current options disable legacy profiling. This prevents the
current opt-out from retaining the crash-prone legacy backend.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added risk: high PR risk score: high and removed risk: high PR risk score: high labels Dec 2, 2026
@adinauer
adinauer marked this pull request as ready for review December 2, 2026 16:01
@adinauer
adinauer requested a review from a team as a code owner December 2, 2026 16:01
@adinauer
adinauer requested review from 0xadam-brown and runningcode and removed request for a team December 2, 2026 16:01
@github-actions github-actions Bot added risk: high PR risk score: high and removed risk: high PR risk score: high labels Dec 2, 2026

@runningcode runningcode left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So my understanding is that we only ever enable one profiler at a time. That make sense since they consume a lot of resources.
The way the code here is set, it seems like if both are enabled, we prefer the deprecated one, can we change that to prefer the UI Profiling?
We should probably make this behavior when both are enabled more clear in the docs and maybe the changelog too.

Comment thread CHANGELOG.md

### Breaking Changes

- Android: Disable the legacy `Debug`-based profiler by default. Set `enableLegacyProfiling` or the `io.sentry.profiling.enable-legacy-profiling` manifest option to `true` to continue profiling below API 35 or using transaction-based profiling ([#6837](https://github.com/getsentry/sentry-java/pull/6837))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I just added a link to the docs to how to enable the UI Profiling.

Suggested change
- Android: Disable the legacy `Debug`-based profiler by default. Set `enableLegacyProfiling` or the `io.sentry.profiling.enable-legacy-profiling` manifest option to `true` to continue profiling below API 35 or using transaction-based profiling ([#6837](https://github.com/getsentry/sentry-java/pull/6837))
- Android: Disable the legacy `Debug`-based profiler by default. Set `enableLegacyProfiling` or the `io.sentry.profiling.enable-legacy-profiling` manifest option to `true` to continue profiling below API 35 or switch to using [UI Profiling](https://docs.sentry.io/platforms/android/profiling/) ([#6837](https://github.com/getsentry/sentry-java/pull/6837))

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

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants