Skip to content

ref(android): Hand InternalServices to the SDK's integrations - #6832

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

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

Conversation

@runningcode

@runningcode runningcode commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

📜 Description

The SDK's integrations implement InternalIntegration, so Sentry.init passes them InternalServices and they take their executor and envelope cache from it instead of from SentryOptions.

final class AnrV2Integration implements InternalIntegration {

  // The old entry point keeps working: it builds InternalServices over what's on the options.
  public void register(IScopes scopes, SentryOptions options) {
    register(scopes, options, LegacyOptionsBridge.servicesOf(options));   // creates nothing
  }

  public void register(IScopes scopes, SentryOptions options, InternalServices services) {
    this.executorService = services.getExecutorService();
    new ApplicationExitInfoHistoryDispatcher(…, services.getEnvelopeDiskCache());
  }
}

// The tests declare exactly what the integration uses.
val services = InternalServices.builder()
  .executorService(ImmediateExecutorService())
  .envelopeDiskCache(cache)
  .buildForTest()                        // reading anything else throws
sut.register(scopes, options, services)
  • ANR v2, Tombstone and MemoryLimiter use both the executor and the cache, and they move here in full rather than being split across the cache and executor PRs.
  • The other integrations (ActivityLifecycle, Anr, AppComponentsBreadcrumbs, EnvelopeFileObserver, FeedbackShake, SendCachedEnvelope, SystemEventsBreadcrumbs, AnrProfiling, and SendCachedEnvelopeFireAndForget in sentry) store the executor from InternalServices in a volatile field.
  • register stays final where it was.

💡 Motivation and Context

Part of JAVA-817. Stacked on #6830.

💚 How did you test it?

The ANR, Tombstone and MemoryLimiter tests now use strict test InternalServices. Other integration tests are unchanged and still go through the two-argument register.

📝 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.

🤖 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 added the risk: high PR risk score: high label Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

PR risk: high

For commit 8db9e2f.

Main concerns: reach, public contract, host performance.

Rules that block low also fired:

  • R4: a public API record changed: sentry-android-core/api/sentry-android-core.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-integrations branch from 9c190de to 2daac80 Compare December 3, 2026 12:24
@github-actions github-actions Bot added risk: high PR risk score: high and removed risk: high PR risk score: high labels Dec 3, 2026
@runningcode
runningcode force-pushed the no/sentryruntime-integrations branch from 2daac80 to 793c9bb Compare December 3, 2026 12:52
@github-actions github-actions Bot added risk: high PR risk score: high and removed risk: high PR risk score: high labels Dec 3, 2026
@runningcode
runningcode force-pushed the no/sentryruntime-integrations branch from 793c9bb to 619f3c5 Compare December 3, 2026 14:51
@github-actions github-actions Bot removed the risk: high PR risk score: high label Dec 3, 2026
@runningcode runningcode changed the title ref(android): Hand SentryRuntime to the SDK's integrations ref(android): Hand InternalServices to the SDK's integrations Dec 3, 2026
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Dec 3, 2026
The SDK's integrations become InternalIntegrations, so Sentry.init
passes them InternalServices and they take their executor and envelope cache
from it instead of from SentryOptions. Their two-argument register keeps
working by building InternalServices over the internal services on the options.

The ANR, Tombstone and MemoryLimiter tests now build strict InternalServices
holding only what each integration uses.

Part of JAVA-817

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@runningcode
runningcode force-pushed the no/sentryruntime-integrations branch from 619f3c5 to 8db9e2f Compare December 3, 2026 15:03
@github-actions github-actions Bot added risk: high PR risk score: high 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:26
@runningcode
runningcode requested review from a team and adinauer as code owners December 3, 2026 15:27
@runningcode
runningcode requested review from 0xadam-brown and markushi and removed request for a team December 3, 2026 15:27
@github-actions github-actions Bot added risk: high PR risk score: high and removed risk: high PR risk score: high 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: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant