feat: Return extended app launch span from extendAppLaunch()#7985
Conversation
|
📲 Install BuildsiOS
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7985 +/- ##
========================================
Coverage ? 86.570%
========================================
Files ? 550
Lines ? 31692
Branches ? 13029
========================================
Hits ? 27436
Misses ? 4207
Partials ? 49
Continue to review full report in Codecov by Sentry.
|
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| ba824fc | 1212.75 ms | 1244.29 ms | 31.54 ms |
| 48fa69f | 1221.60 ms | 1251.52 ms | 29.92 ms |
| e3070ad | 1201.60 ms | 1235.70 ms | 34.10 ms |
| 9da166b | 1222.40 ms | 1250.24 ms | 27.84 ms |
| 6b08499 | 1231.61 ms | 1241.90 ms | 10.29 ms |
| 1770336 | 1225.09 ms | 1251.32 ms | 26.23 ms |
| 9c19a06 | 1217.77 ms | 1248.98 ms | 31.21 ms |
| bc68ff6 | 1227.02 ms | 1254.89 ms | 27.87 ms |
| a7c42d9 | 1217.25 ms | 1253.98 ms | 36.73 ms |
| 8180609 | 1214.67 ms | 1243.36 ms | 28.69 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| ba824fc | 24.14 KiB | 1.17 MiB | 1.15 MiB |
| 48fa69f | 24.14 KiB | 1.15 MiB | 1.13 MiB |
| e3070ad | 24.14 KiB | 1.16 MiB | 1.14 MiB |
| 9da166b | 24.14 KiB | 1.16 MiB | 1.14 MiB |
| 6b08499 | 24.14 KiB | 1.15 MiB | 1.13 MiB |
| 1770336 | 24.14 KiB | 1.15 MiB | 1.13 MiB |
| 9c19a06 | 24.14 KiB | 1.16 MiB | 1.13 MiB |
| bc68ff6 | 24.14 KiB | 1.16 MiB | 1.14 MiB |
| a7c42d9 | 24.14 KiB | 1.15 MiB | 1.13 MiB |
| 8180609 | 24.14 KiB | 1.16 MiB | 1.13 MiB |
philprime
left a comment
There was a problem hiding this comment.
Approved but please consider implementing the feedback
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a0f6fc8. Configure here.
Allow users to add child spans to the extended app launch span, enabling granular breakdown of the app start period. The return value is @discardableResult for backward compatibility. The tracer is now created eagerly in extend() and waits for both the app start measurement (from report()) and the user finishing the span before completing the transaction, preventing a race condition.
Store tracerConfiguration under the initial lock in extend() so report() can safely set the measurement even if the tracer object hasn't been stored yet. If report() wins the race and sets the measurement first, extend() detects this and calls tracer.finish() after storing it.
Read the pre-generated appStartTraceId from SentryAppStartMeasurementProvider so the extended app launch transaction shares the same trace as the first UIVC transaction, preserving distributed trace correlation.
Return existing span on duplicate extend() calls instead of creating an orphaned tracer. Consolidated into a single lock block. Added debug logging to setAppStartMeasurement and shouldFinishTracer paths.
a0f6fc8 to
c09bdc6
Compare

Summary
SentrySDK.extendAppLaunch()now returns the extended app launchSpan?, allowing users to add child spans for granular breakdown of the app start period@discardableResultso this is not a breaking changefinishExtendedAppLaunch()is preserved for backward compatibilityStandaloneTransactionStrategy.createTracer()to avoid duplicationreport()) and the user finishing the span before completing the transactionExample usage
Test plan
sdk_api.jsonregenerated