Skip to content

feat(tracing): Add extend app start API for standalone app start#6392

Open
antonis wants to merge 8 commits into
mainfrom
antonis/rn-675-add-api-to-extend-app-start-react-native
Open

feat(tracing): Add extend app start API for standalone app start#6392
antonis wants to merge 8 commits into
mainfrom
antonis/rn-675-add-api-to-extend-app-start-react-native

Conversation

@antonis

@antonis antonis commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

📢 Type of change

  • New feature
  • Enhancement

📜 Description

Adds an experimental, opt-in API to extend the standalone app start window so work done after SDK initialization (remote config, session restore, splash-screen dismissal, etc.) is included in the app start measurement

💡 Motivation and Context

Closes #6303

Closes #5936

💚 How did you test it?

CI, Manual

📝 Checklist

🔮 Next steps

…675)

Add experimental `extendAppStart()`, `finishExtendedAppStart()`, and
`getExtendedAppStartSpan()` to keep the standalone `app.start` transaction open
past the auto-detected end so post-init work (remote config, session restore,
etc.) is included and can be broken down into child spans under an
`app.start.extended` span.

- `extendAppStart()` cancels the deferred auto-capture, holds the transaction
  open, and starts a 30s deadline.
- `finishExtendedAppStart()` finalizes: trims the end to the last child (floored
  at the default app start end) and sets the measurement at finalization.
- On the deadline the transaction is captured but the `app.vitals.start`
  measurement is suppressed (never emit a ~30s app start).
- `attachAppStartToTransactionEvent` now takes `suppressMeasurement` and returns
  whether it attached, so the finalize path decides send vs skip.

Standalone-only. `appLoaded()` stays as-is for now; its deprecation and removal,
plus making standalone the default, are handled together in RN-676 (v9).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Jul 2, 2026

Copy link
Copy Markdown

RN-675

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • feat(tracing): Add extend app start API for standalone app start by antonis in #6392

🤖 This preview updates automatically when you update the PR.

@github-actions

github-actions Bot commented Jul 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 1242fc2

Comment thread CHANGELOG.md Outdated
Comment thread packages/core/src/js/tracing/integrations/appStart.ts
Comment thread packages/core/src/js/tracing/integrations/appStart.ts
Comment thread packages/core/src/js/tracing/integrations/appStart.ts
Comment thread packages/core/src/js/tracing/integrations/appStart.ts Outdated
Comment thread packages/core/src/js/tracing/integrations/appStart.ts Outdated
Comment thread packages/core/etc/sentry-react-native.api.md
Comment thread packages/core/src/js/sdk.tsx
Comment thread packages/core/src/js/tracing/integrations/appStart.ts
antonis and others added 2 commits July 2, 2026 14:49
- extendAppStart(): claim the run only after confirming a recording span, so a
  sampled-out/disabled run falls back to the normal capture path.
- Cap the 60s app start sanity check on the native window, not the extended end,
  so a legitimately extended app start is not dropped.
- Thread the extended end explicitly instead of mutating shared appStartEndData,
  so the extended end survives without wrap()/appLoaded().
- Guard app start attach with a run generation so a finish suspended at the
  native-data await bails when a new runApplication run starts, instead of
  corrupting the new run's state.
- finishExtendedAppStart() returns Promise<void> so callers can await before flush().

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment thread packages/core/src/js/tracing/integrations/appStart.ts
Comment thread packages/core/src/js/tracing/integrations/appStart.ts Outdated
antonis and others added 2 commits July 2, 2026 15:03
The app start attach also awaits fetchNativeFramesDelay (~2s) after the first
generation check; a runApplication reset during that window could still send a
stale standalone transaction. Re-check the generation before reporting success.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…e (RN-675)

- getLatestChildSpanEndTimestamp was computed on the root transaction, which
  includes the extended (wrapper) span itself; since the wrapper ends at
  finalization time, the transaction was pinned to the finishExtendedAppStart()
  call rather than the last instrumented child. Compute the trim from the
  wrapper's children (excluding the wrapper) on the explicit-finish path, end the
  wrapper at that trimmed time so it never outlives the root, and keep the
  full-window end on the deadline path. Floored at the default app start end and
  the wrapper start.
- Regenerate the API report against @sentry/core 10.63.0 (restores the
  deeplinkIntegration signature that a stale local build had reverted).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@antonis antonis added the ready-to-merge Triggers the full CI test suite label Jul 2, 2026
@antonis antonis changed the title feat(tracing): Add extend app start API for standalone app start (RN-675) feat(tracing): Add extend app start API for standalone app start Jul 2, 2026
@sentry

sentry Bot commented Jul 2, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
Sentry RN io.sentry.reactnative.sample 8.17.0 (95) Release

⚙️ sentry-react-native Build Distribution Settings

@antonis

antonis commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

@sentry review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 53bc223. Configure here.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3813.85 ms 1219.14 ms -2594.71 ms
Size 4.98 MiB 6.51 MiB 1.54 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
21a1e70+dirty 3834.15 ms 1218.43 ms -2615.73 ms
882f8ae+dirty 3840.30 ms 1224.41 ms -2615.88 ms
15d4514+dirty 3840.17 ms 1225.79 ms -2614.38 ms
0b5a379+dirty 3828.91 ms 1214.12 ms -2614.79 ms
f3215d3+dirty 3842.73 ms 1219.33 ms -2623.40 ms
ab203f9+dirty 3848.07 ms 1219.71 ms -2628.35 ms
6177334+dirty 3834.85 ms 1217.58 ms -2617.28 ms
5257d80+dirty 3854.39 ms 1234.28 ms -2620.11 ms
9474ead+dirty 3864.29 ms 1223.55 ms -2640.74 ms
1122a96+dirty 3823.10 ms 1218.64 ms -2604.46 ms

App size

Revision Plain With Sentry Diff
21a1e70+dirty 4.98 MiB 6.46 MiB 1.49 MiB
882f8ae+dirty 5.15 MiB 6.70 MiB 1.54 MiB
15d4514+dirty 5.15 MiB 6.70 MiB 1.55 MiB
0b5a379+dirty 5.15 MiB 6.70 MiB 1.54 MiB
f3215d3+dirty 5.15 MiB 6.67 MiB 1.52 MiB
ab203f9+dirty 4.98 MiB 6.51 MiB 1.53 MiB
6177334+dirty 5.15 MiB 6.68 MiB 1.53 MiB
5257d80+dirty 5.15 MiB 6.69 MiB 1.54 MiB
9474ead+dirty 5.15 MiB 6.71 MiB 1.55 MiB
1122a96+dirty 5.15 MiB 6.68 MiB 1.53 MiB

antonis and others added 2 commits July 2, 2026 16:04
…ased

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

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3844.98 ms 1223.57 ms -2621.41 ms
Size 4.98 MiB 6.51 MiB 1.54 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
eb93136+dirty 3846.51 ms 1226.13 ms -2620.39 ms
ad66da3+dirty 3855.02 ms 1213.43 ms -2641.59 ms
b04af96+dirty 3830.54 ms 1206.11 ms -2624.44 ms
9210ae6+dirty 3834.11 ms 1216.64 ms -2617.47 ms
ca9d079+dirty 3818.62 ms 1216.72 ms -2601.90 ms
09a902f+dirty 3847.65 ms 1221.31 ms -2626.34 ms
5a21b51+dirty 3837.87 ms 1223.47 ms -2614.40 ms
d038a14+dirty 3831.11 ms 1216.30 ms -2614.81 ms
64630e5+dirty 3845.49 ms 1215.19 ms -2630.30 ms
f3215d3+dirty 3846.08 ms 1231.85 ms -2614.23 ms

App size

Revision Plain With Sentry Diff
eb93136+dirty 5.15 MiB 6.69 MiB 1.53 MiB
ad66da3+dirty 5.15 MiB 6.67 MiB 1.51 MiB
b04af96+dirty 4.98 MiB 6.54 MiB 1.56 MiB
9210ae6+dirty 5.15 MiB 6.68 MiB 1.53 MiB
ca9d079+dirty 5.15 MiB 6.69 MiB 1.53 MiB
09a902f+dirty 4.98 MiB 6.46 MiB 1.49 MiB
5a21b51+dirty 5.15 MiB 6.67 MiB 1.51 MiB
d038a14+dirty 5.15 MiB 6.67 MiB 1.51 MiB
64630e5+dirty 4.98 MiB 6.46 MiB 1.49 MiB
f3215d3+dirty 5.15 MiB 6.67 MiB 1.52 MiB

@antonis antonis marked this pull request as ready for review July 2, 2026 15:06
@antonis antonis requested review from a team, alwx and lucas-zimerman as code owners July 2, 2026 15:06
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 454.83 ms 522.62 ms 67.80 ms
Size 49.74 MiB 55.09 MiB 5.35 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
0d9949d+dirty 414.88 ms 428.68 ms 13.81 ms
a736b76+dirty 405.78 ms 458.74 ms 52.96 ms
5569641+dirty 465.92 ms 532.22 ms 66.30 ms
580fb5c+dirty 515.72 ms 585.38 ms 69.66 ms
7ff4d0f+dirty 403.38 ms 427.06 ms 23.68 ms
6177334+dirty 404.80 ms 456.74 ms 51.94 ms
1e5d96d+dirty 423.33 ms 482.46 ms 59.13 ms
f170ec3+dirty 505.96 ms 551.88 ms 45.92 ms
20fbd51+dirty 594.38 ms 655.35 ms 60.97 ms
f3215d3+dirty 396.53 ms 436.66 ms 40.13 ms

App size

Revision Plain With Sentry Diff
0d9949d+dirty 43.94 MiB 48.99 MiB 5.05 MiB
a736b76+dirty 48.30 MiB 53.48 MiB 5.18 MiB
5569641+dirty 48.30 MiB 53.48 MiB 5.18 MiB
580fb5c+dirty 49.74 MiB 54.79 MiB 5.05 MiB
7ff4d0f+dirty 48.30 MiB 53.60 MiB 5.30 MiB
6177334+dirty 48.30 MiB 53.54 MiB 5.23 MiB
1e5d96d+dirty 49.74 MiB 54.81 MiB 5.07 MiB
f170ec3+dirty 48.30 MiB 53.57 MiB 5.26 MiB
20fbd51+dirty 49.74 MiB 54.81 MiB 5.07 MiB
f3215d3+dirty 48.30 MiB 53.49 MiB 5.19 MiB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Triggers the full CI test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add API to extend app start (React Native) app.start.cold / app.start.warm → allow nesting; or make it be controlled somehow

1 participant