Skip to content

feat(extend-app-start): [3/4] Materialize extended app start span and extend the vital#5608

Draft
buenaflor wants to merge 2 commits into
feat/app-start-extension-androidfrom
feat/app-start-extension-materialize
Draft

feat(extend-app-start): [3/4] Materialize extended app start span and extend the vital#5608
buenaflor wants to merge 2 commits into
feat/app-start-extension-androidfrom
feat/app-start-extension-materialize

Conversation

@buenaflor

@buenaflor buenaflor commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

PR Stack (Extend App Start)


📜 Description

Wires the deferred extended span into the app start measurement and makes the feature work end-to-end:

  • ActivityLifecycleIntegration — a materializeExtendedAppStart(parent) helper attaches an app.start.extended_app_start ("Extended App Start") child in all three paths: standalone (app.start transaction), non-standalone (under the app.start.cold/warm span of the ui.load transaction), and headless. The standalone and headless transactions get waitForChildren + a deadline when an extension is pending, so they stay open until the extension finishes (the ui.load transaction already does).
  • PerformanceAndroidEventProcessor — the app start vital now measures process start → extended end on a user finish. When the extension hits the deadline (DEADLINE_EXCEEDED), the measurement is suppressed entirely so we never emit an artificially inflated (~30s) value; the app start spans are still attached. Non-extended app starts are unchanged.
  • AppStartMetrics — adds isAppStartExtended(), resets extension state in onAppStartSpansSent() (so a stale span can't affect a later warm start), and relaxes the extend guard's foreground check so headless app starts can be extended (the window guards still apply).

app_start_type is inherited automatically — the extended span lives under the app start span, so the transaction still carries the App-context start_type.

💡 Motivation and Context

Third PR of the stack implementing the app start extension API (part of #5553). This is the PR where the extension actually affects the trace and the vital.

💚 How did you test it?

Unit tests (TDD):

  • ActivityLifecycleIntegrationTest — standalone / non-standalone / headless each attach the app.start.extended_app_start child; standalone & headless transactions stay open until finishAppStart().
  • PerformanceAndroidEventProcessorTest — extended end drives the cold measurement; deadline finish suppresses the measurement.
  • AppStartMetricsTest — extension allowed when not in foreground (headless).

./gradlew :sentry-android-core:apiCheck, spotless, and the full :sentry-android-core unit suite pass.

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

🔮 Next steps

[4/4] — add the public Sentry.extendAppStart() / Sentry.finishAppStart() / Sentry.getExtendedAppStartSpan() facade.

⚠️ Merge this PR using a merge commit (not squash). Only the collection branch is squash-merged into main.

#skip-changelog

buenaflor and others added 2 commits June 23, 2026 14:13
…tartMetrics extension state

Adds ExtendedAppStartSpan, a deferred ISpan that buffers an early finish and
materializes into a real child span once the app start transaction exists.
AppStartMetrics now implements IAppStartExtender with window guards,
materialization state, and a deadline-aware end-time accessor for the app start
vital. Registered via AndroidOptionsInitializer.

Inert end-to-end until ALI materializes the span (PR3) and the public Sentry
facade is added (PR4).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…d the vital

Wires the deferred extended span into all three app start transaction paths
(standalone, non-standalone ui.load, headless) via a materializeExtendedAppStart
helper, holding each transaction open with waitForChildren + deadline until the
extension finishes. The app start vital now measures process start to the
extended end on a user finish, and is suppressed entirely when the extension
hits the deadline (never emitting an inflated ~30s value). The extend guard
ignores the foreground check so headless app starts can also be extended.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

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 0f8ee4d

@sentry

sentry Bot commented Jun 23, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

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

⚙️ sentry-android Build Distribution Settings

@github-actions

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 313.73 ms 373.92 ms 60.19 ms
Size 0 B 0 B 0 B

Baseline results on branch: feat/app-start-extension-android

Startup times

Revision Plain With Sentry Diff
b76203f 336.02 ms 403.42 ms 67.40 ms

App size

Revision Plain With Sentry Diff
b76203f 0 B 0 B 0 B

@buenaflor buenaflor force-pushed the feat/app-start-extension-android branch from 54be119 to d2b96ad Compare June 24, 2026 10:47
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.

1 participant