Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Accessing UI API on bg thread in enrichScope #4245

Merged
merged 8 commits into from
Aug 8, 2024

Conversation

philipphofmann
Copy link
Member

📜 Description

Fix accessing UIDevice in enrich scope, which could be called on a background thread by caching the system version in the SentryUIDeviceWrapper.

💡 Motivation and Context

Came up in #3836 (comment) and while investigating flaky tests.

💚 How did you test it?

Unit tests.

📝 Checklist

You have to check all boxes before merging:

  • I reviewed the submitted code.
  • 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.
  • 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

Fix accessing UIDevice in enrich scope, which could be called on a
background thread by caching the system version in the
SentryUIDeviceWrapper.
Copy link

codecov bot commented Aug 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.492%. Comparing base (65e8a5b) to head (2f93364).

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #4245       +/-   ##
=============================================
- Coverage   91.495%   91.492%   -0.003%     
=============================================
  Files          612       612               
  Lines        49455     49475       +20     
  Branches     17899     17903        +4     
=============================================
+ Hits         45249     45266       +17     
- Misses        4113      4117        +4     
+ Partials        93        92        -1     
Files Coverage Δ
Sources/Sentry/SentryCrashWrapper.m 94.594% <100.000%> (+0.074%) ⬆️
Sources/Sentry/SentryDependencyContainer.m 95.918% <ø> (-0.028%) ⬇️
Sources/Sentry/SentrySDK.m 88.826% <100.000%> (ø)
Sources/Sentry/SentryUIDeviceWrapper.m 92.857% <100.000%> (+1.948%) ⬆️
...ions/SentryCrash/SentryCrashIntegrationTests.swift 85.087% <100.000%> (+0.198%) ⬆️
Tests/SentryTests/SentrySDKTests.swift 96.762% <100.000%> (+1.349%) ⬆️

... and 7 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 65e8a5b...2f93364. Read the comment docs.

Copy link

github-actions bot commented Aug 7, 2024

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1231.64 ms 1251.91 ms 20.27 ms
Size 21.58 KiB 699.39 KiB 677.80 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
e8c8a05 1218.71 ms 1234.50 ms 15.79 ms
1ce939e 1222.22 ms 1243.26 ms 21.04 ms
6d541bc 1223.06 ms 1242.38 ms 19.32 ms
ceb2092 1205.27 ms 1221.44 ms 16.17 ms
2f8b3a8 1233.76 ms 1260.24 ms 26.48 ms
db533ee 1228.96 ms 1248.23 ms 19.28 ms
728804f 1235.26 ms 1254.20 ms 18.94 ms
034be1c 1222.67 ms 1236.22 ms 13.55 ms
2affdbd 1224.29 ms 1248.06 ms 23.77 ms
6a6a5b2 1243.67 ms 1252.51 ms 8.84 ms

App size

Revision Plain With Sentry Diff
e8c8a05 21.58 KiB 683.51 KiB 661.92 KiB
1ce939e 22.85 KiB 412.98 KiB 390.13 KiB
6d541bc 21.58 KiB 616.71 KiB 595.13 KiB
ceb2092 21.58 KiB 670.39 KiB 648.81 KiB
2f8b3a8 20.76 KiB 434.72 KiB 413.96 KiB
db533ee 21.58 KiB 547.02 KiB 525.44 KiB
728804f 22.85 KiB 411.76 KiB 388.91 KiB
034be1c 20.76 KiB 436.66 KiB 415.90 KiB
2affdbd 22.85 KiB 411.37 KiB 388.52 KiB
6a6a5b2 21.58 KiB 698.12 KiB 676.54 KiB

Previous results on branch: fix/ui-api-bg-thread-enrich-scope

Startup times

Revision Plain With Sentry Diff
b44935c 1218.29 ms 1230.31 ms 12.03 ms

App size

Revision Plain With Sentry Diff
b44935c 21.58 KiB 698.30 KiB 676.72 KiB

@philipphofmann philipphofmann merged commit 3603565 into main Aug 8, 2024
65 of 67 checks passed
@philipphofmann philipphofmann deleted the fix/ui-api-bg-thread-enrich-scope branch August 8, 2024 07:45
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.

2 participants