Skip to content

ref: Extract getAppStartMeasurement into SentryAppStartMeasurementProvider#7655

Merged
philipphofmann merged 10 commits into
mainfrom
ref/extract-app-start-measurement-provider
Mar 11, 2026
Merged

ref: Extract getAppStartMeasurement into SentryAppStartMeasurementProvider#7655
philipphofmann merged 10 commits into
mainfrom
ref/extract-app-start-measurement-provider

Conversation

@philipphofmann

@philipphofmann philipphofmann commented Mar 9, 2026

Copy link
Copy Markdown
Member

Description

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.

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

@github-actions

github-actions Bot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

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


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
@philipphofmann philipphofmann force-pushed the ref/extract-app-start-measurement-provider branch from e6b0fbd to 9f136f6 Compare March 9, 2026 15:22
@codecov

codecov Bot commented Mar 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.68293% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.353%. Comparing base (546d386) to head (df35a6a).
⚠️ Report is 7 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
Sources/Sentry/SentryAppStartMeasurementProvider.m 91.891% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@              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     
Files with missing lines Coverage Δ
SentryTestUtils/Sources/ClearTestState.swift 83.333% <100.000%> (ø)
Sources/Sentry/SentryTracer.m 98.258% <100.000%> (+0.536%) ⬆️
Sources/Sentry/SentryAppStartMeasurementProvider.m 91.891% <91.891%> (ø)

... and 4 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 546d386...df35a6a. Read the comment docs.

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
@philipphofmann philipphofmann added the ready-to-merge Use this label to trigger all PR workflows label Mar 9, 2026
@sentry

sentry Bot commented Mar 9, 2026

Copy link
Copy Markdown

Sentry Build Distribution

App Version Configuration
App 9.6.0 (1) Release

@github-actions

github-actions Bot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1218.63 ms 1254.44 ms 35.81 ms
Size 24.14 KiB 1.12 MiB 1.10 MiB

Baseline results on branch: main

Startup times

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

@sentry

sentry Bot commented Mar 10, 2026

Copy link
Copy Markdown

Sentry Build Distribution

App Version Configuration
App 9.6.0 (1) Release

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

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

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.

Create PR

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)
This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

Aligns the test file's platform guard with SENTRY_HAS_UIKIT which
includes TARGET_OS_VISION, ensuring test coverage on visionOS.
@sentry

sentry Bot commented Mar 10, 2026

Copy link
Copy Markdown

Sentry Build Distribution

App Version Configuration
App 9.6.0 (1) Release

@sentry

sentry Bot commented Mar 10, 2026

Copy link
Copy Markdown

Sentry Build Distribution

App Version Configuration
App 9.6.0 (1) Release

@sentry

sentry Bot commented Mar 10, 2026

Copy link
Copy Markdown

Sentry Build Distribution

App Version Configuration
App 9.6.0 (1) Release

@sentry

sentry Bot commented Mar 10, 2026

Copy link
Copy Markdown

Sentry Build Distribution

App Version Configuration
App 9.6.0 (1) Release

@sentry

sentry Bot commented Mar 10, 2026

Copy link
Copy Markdown

Sentry Build Distribution

App Version Configuration
App 9.6.0 (1) Release

@itaybre itaybre left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, with a small question

Comment thread Sources/Sentry/SentryAppStartMeasurementProvider.m
@philipphofmann philipphofmann enabled auto-merge (squash) March 11, 2026 10:32
@philipphofmann philipphofmann merged commit 2c7a266 into main Mar 11, 2026
227 of 229 checks passed
@philipphofmann philipphofmann deleted the ref/extract-app-start-measurement-provider branch March 11, 2026 10:44
philprime pushed a commit that referenced this pull request Mar 11, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Use this label to trigger all PR workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ref: Extract getAppStartMeasurement into SentryAppStartMeasurementProvider

2 participants