ref: Extract getAppStartMeasurement into SentryAppStartMeasurementProvider#7655
Conversation
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. This PR will not appear in the changelog. 🤖 This preview updates automatically when you update the PR. |
…vider Move the app start measurement retrieval logic from SentryTracer into a standalone SentryAppStartMeasurementProvider class to decouple it from the tracer and prepare for a future Swift rewrite. Agent transcript: https://claudescope.sentry.dev/share/-ySeYAQr0t_-TzVJYh7grS4nvSpo6f1NKAIEUc4__60
e6b0fbd to
9f136f6
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7655 +/- ##
=============================================
- Coverage 85.356% 85.353% -0.004%
=============================================
Files 483 484 +1
Lines 28785 28785
Branches 12501 12513 +12
=============================================
- Hits 24570 24569 -1
- Misses 4168 4170 +2
+ Partials 47 46 -1
... and 4 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Call SentryAppStartMeasurementProvider.reset() directly from ClearTestState and the provider tests instead of routing through SentryTracer's forwarding method. Agent transcript: https://claudescope.sentry.dev/share/L1InLC1w4Xm6HgEp2bHk-sJ2wtr9fRfQ08BpwGE4JSs
Sentry Build Distribution
|
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 8ef5e41 | 1214.14 ms | 1248.52 ms | 34.38 ms |
| 45eb835 | 1210.40 ms | 1233.39 ms | 22.99 ms |
| 80963bd | 1194.76 ms | 1212.13 ms | 17.38 ms |
| e03f459 | 1222.56 ms | 1255.94 ms | 33.37 ms |
| e01eafa | 1223.36 ms | 1252.43 ms | 29.07 ms |
| b9e1a29 | 1216.41 ms | 1255.80 ms | 39.39 ms |
| 64e79c5 | 1207.36 ms | 1244.96 ms | 37.60 ms |
| 5807865 | 1230.73 ms | 1259.50 ms | 28.77 ms |
| 3bff9ff | 1217.72 ms | 1246.43 ms | 28.71 ms |
| 93d7fdf | 1225.77 ms | 1259.79 ms | 34.02 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 8ef5e41 | 24.14 KiB | 1.10 MiB | 1.08 MiB |
| 45eb835 | 24.14 KiB | 1.07 MiB | 1.04 MiB |
| 80963bd | 24.14 KiB | 1.11 MiB | 1.09 MiB |
| e03f459 | 24.14 KiB | 1.11 MiB | 1.09 MiB |
| e01eafa | 24.14 KiB | 1.07 MiB | 1.04 MiB |
| b9e1a29 | 24.14 KiB | 1.11 MiB | 1.09 MiB |
| 64e79c5 | 24.14 KiB | 1.11 MiB | 1.09 MiB |
| 5807865 | 24.14 KiB | 1.06 MiB | 1.04 MiB |
| 3bff9ff | 24.14 KiB | 1.11 MiB | 1.09 MiB |
| 93d7fdf | 24.14 KiB | 1.11 MiB | 1.08 MiB |
Previous results on branch: ref/extract-app-start-measurement-provider
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| c5afe8e | 1225.36 ms | 1261.82 ms | 36.45 ms |
| 28f1760 | 1226.86 ms | 1268.62 ms | 41.77 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| c5afe8e | 24.14 KiB | 1.12 MiB | 1.10 MiB |
| 28f1760 | 24.14 KiB | 1.12 MiB | 1.10 MiB |
Remove unused profilerReferenceID parameter, add header docs, and fix stale TSan suppression. Agent transcript: https://claudescope.sentry.dev/share/YCbJaiw4eo47tyRGdPdNfyWa3VZueptJtPoevH1S97A
Fix trailing closure ambiguity with DispatchWorkItem and remove non-existent profilerReferenceID parameter. Agent transcript: https://claudescope.sentry.dev/share/boilLz21_S-f8uu_dcXvext-dAi2MAY8xkbK2zEafW4
Sentry Build Distribution
|
The platform guards for app start cleanup in clearTestState were missing os(visionOS), causing appStartMeasurementRead to never reset between tests on visionOS. This made tests that depend on app start measurement data fail when run after other tests that consume the measurement. Agent transcript: https://claudescope.sentry.dev/share/XRVuiHsfZrr_PPrwGDvT9RkHPcp6AxGP1tIDaq2H4CU
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Test platform guard missing visionOS unlike production code
- Updated platform guard from
#if os(iOS) || os(tvOS)to#if os(iOS) || os(tvOS) || os(visionOS)to match production code and ClearTestState.swift.
- Updated platform guard from
Or push these changes by commenting:
@cursor push 60e2a398aa
Preview (60e2a398aa)
diff --git a/Tests/SentryTests/Integrations/Performance/AppStartTracking/SentryAppStartMeasurementProviderTests.swift b/Tests/SentryTests/Integrations/Performance/AppStartTracking/SentryAppStartMeasurementProviderTests.swift
--- a/Tests/SentryTests/Integrations/Performance/AppStartTracking/SentryAppStartMeasurementProviderTests.swift
+++ b/Tests/SentryTests/Integrations/Performance/AppStartTracking/SentryAppStartMeasurementProviderTests.swift
@@ -1,7 +1,7 @@
@_spi(Private) @testable import Sentry
import XCTest
-#if os(iOS) || os(tvOS)
+#if os(iOS) || os(tvOS) || os(visionOS)
class SentryAppStartMeasurementProviderTests: XCTestCase {
@@ -304,4 +304,4 @@
}
}
-#endif // os(iOS) || os(tvOS)
+#endif // os(iOS) || os(tvOS) || os(visionOS)Aligns the test file's platform guard with SENTRY_HAS_UIKIT which includes TARGET_OS_VISION, ensuring test coverage on visionOS.
Sentry Build Distribution
|
Sentry Build Distribution
|
Sentry Build Distribution
|
Sentry Build Distribution
|
Sentry Build Distribution
|
itaybre
left a comment
There was a problem hiding this comment.
LGTM, with a small question
…vider (#7655) Extract getAppStartMeasurement from SentryTracer into a standalone SentryAppStartMeasurementProvider class. Pure refactoring — no logic changes. Small additional cleanup: removed the profilerReferenceID parameter from the provider API since it was only used in a debug log message and not needed for the logic.

Description
Extract
getAppStartMeasurementfromSentryTracerinto a standaloneSentryAppStartMeasurementProviderclass. Pure refactoring — no logic changes.Small additional cleanup: removed the
profilerReferenceIDparameter from the provider API since it was only used in a debug log message and not needed for the logic.The next step is to convert this logic, actually, to Swift. First did the extraction in Objective-C, so it's easy to review then.
#skip-changelog
Closes #7661