Skip to content

ref(android): Inject the executor into init-time components - #6834

Open
runningcode wants to merge 1 commit into
no/sentryruntime-foundationfrom
no/sentryruntime-init-executor
Open

runningcode wants to merge 1 commit into
no/sentryruntime-foundationfrom
no/sentryruntime-init-executor

Conversation

@runningcode

@runningcode runningcode commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

📜 Description

SentryAndroid.init now creates the executor right after the customer's callback and passes it to everything initializeIntegrationsAndProcessors builds. Before, each component read it off SentryOptions.

// SentryAndroid.init, right after the customer's callback
+ executor = LegacyOptionsBridge.executorOrNew(options);   // an executor set on the options still wins
+ servicesBuilder.executorService(executor);
  initializeIntegrationsAndProcessors(options, executor, …);
    new AndroidConnectionStatusProvider(…, executor);
    new PersistingScopeObserver(options, executor);
    new AssetsModulesLoader(context, logger, executor);    // submits in its constructor
    new AndroidTransactionProfiler(…, executor);           // and the continuous profilers

// Sentry.init
- options.getExecutorService().submit(new MovePreviousSession(options));
+ services.getExecutorService().submit(new MovePreviousSession(options));
  // same for loadLazyFields, the options observers, the session finalizer and app-start profiling
  • NdkScopeObserver takes the executor in its constructor.
  • The old public constructors stay and read the executor off the options.
  • Code that can only get SentryOptions on 8.x reads the executor through LegacyOptionsBridge.executorOf(options). Each of these sites needs a decision in 9.0:
    • the Spring continuous profiler bean, which is created before Sentry.init;
    • AndroidLoggerBatchProcessor and AndroidMetricsBatchProcessor, created by the public create(options, client) factories;
    • SentryNdk.init and SentryNdkOutproc.init, which NdkIntegration calls by reflection;
    • InternalSentrySdk's session-file deletion.

💡 Motivation and Context

Part of JAVA-817. Stacked on #6830.

💚 How did you test it?

NdkScopeObserverTest now passes its executor in, and the profiler and options-initializer tests pass the executor explicitly.

📝 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

Retarget to main once #6830 merges. This conflicts with the disk-cache PR on the initializeIntegrationsAndProcessors signature; whichever merges second rebases.

Sentry.initConfigurations (old-profile cleanup, BackpressureMonitor, JVM continuous profiling) isn't in this PR: on this base it runs before InternalServices is built. #6831 moves that earlier and switches those sites.

🤖 Generated with Claude Code

#skip-changelog

@linear-code

linear-code Bot commented Dec 1, 2026

Copy link
Copy Markdown

JAVA-817

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • sentry-android-core/src/main/java/io/sentry/android/core/InternalSentrySdk.java

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

PR risk: medium

For commit 4219c6c.

Main concerns: reach, public contract, host performance.

Rules that block low also fired:

  • R4: a public API record changed: sentry-android-ndk/api/sentry-android-ndk.api, sentry/api/sentry.api

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

@sentry

sentry Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

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

⚙️ sentry-android Build Distribution Settings

@runningcode
runningcode force-pushed the no/sentryruntime-foundation branch from 4b9b580 to a993645 Compare December 3, 2026 12:24
@runningcode
runningcode force-pushed the no/sentryruntime-init-executor branch from fcf9137 to f56f221 Compare December 3, 2026 12:24
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Dec 3, 2026
@runningcode
runningcode force-pushed the no/sentryruntime-init-executor branch from f56f221 to d2985eb Compare December 3, 2026 12:52
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Dec 3, 2026
@runningcode
runningcode force-pushed the no/sentryruntime-init-executor branch from d2985eb to f6ec7cc Compare December 3, 2026 14:52
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Dec 3, 2026
SentryAndroid.init now creates the executor right after the customer's
callback and passes it to everything initializeIntegrationsAndProcessors
builds, so those components no longer read it off SentryOptions. The
NdkScopeObserver and Sentry.init's own session and observer tasks use
it too.

Code that can only receive SentryOptions on 8.x, such as the public
batch processor factories and the reflective SentryNdk.init, reads the
executor through LegacyOptionsBridge.executorOf, which marks each site
for 9.0.

Part of JAVA-817

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@runningcode
runningcode force-pushed the no/sentryruntime-init-executor branch from f6ec7cc to 4219c6c Compare December 3, 2026 15:03
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Dec 3, 2026
@runningcode
runningcode marked this pull request as ready for review December 3, 2026 15:31
@runningcode
runningcode requested review from a team and adinauer as code owners December 3, 2026 15:31
@runningcode
runningcode requested review from markushi and romtsn and removed request for a team December 3, 2026 15:31
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Dec 3, 2026

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: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant