impr(profiling): always remove launch profile config after starting
I realized after rereading https://github.com/getsentry/sentry-cocoa/issues/3637#issuecomment-2787837554 that even if we consider a launch profile unable to be stopped as a misconfiguration we can't currently avoid at runtime, this leads to every launch afterwards also starting the launch profiling. We should instead consider not starting the SDK as disabling launch profiling, the same as if the SDK had never been started in an app.
It also increases safety such that if the app crashes between the time a launch profile starts (especially if it's a crash due to the profiler), and a call to SentrySDK.startWithOptions would've disabled launch profiling, launch profiling won't keep starting again on every subsequent launch.
To achieve this we should always remove the config file once we're done with it for that launch. Configuring to disable launch profiling already removed any file present; now, starting the launch profiler also removes it.
This also helps with issues like https://github.com/getsentry/sentry-cocoa/issues/5366
#skip-changelog
Codecov Report
Attention: Patch coverage is 93.54839% with 2 lines in your changes missing coverage. Please review.
Project coverage is 86.274%. Comparing base (
035974f) to head (d5c1c73). Report is 12 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| ...es/Sentry/Profiling/SentryProfilerSerialization.mm | 0.000% | 2 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #5318 +/- ##
=============================================
+ Coverage 86.199% 86.274% +0.074%
=============================================
Files 407 407
Lines 35072 35096 +24
Branches 15228 15238 +10
=============================================
+ Hits 30232 30279 +47
+ Misses 4793 4769 -24
- Partials 47 48 +1
| Files with missing lines | Coverage Δ | |
|---|---|---|
| Sources/Sentry/Profiling/SentryLaunchProfiling.m | 96.774% <100.000%> (+7.759%) |
:arrow_up: |
| ...urces/Sentry/Profiling/SentryProfilerTestHelpers.m | 87.804% <100.000%> (ø) |
|
| Sources/Sentry/SentryFileManager.m | 94.491% <100.000%> (+0.031%) |
:arrow_up: |
| ...es/Sentry/Profiling/SentryProfilerSerialization.mm | 85.227% <0.000%> (-0.651%) |
:arrow_down: |
... and 10 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 dataPowered by Codecov. Last update 035974f...d5c1c73. Read the comment docs.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Performance metrics :rocket:
| Plain | With Sentry | Diff | |
|---|---|---|---|
| Startup time | 1224.17 ms | 1250.91 ms | 26.74 ms |
| Size | 23.75 KiB | 874.45 KiB | 850.71 KiB |
Baseline results on branch: main
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 9389467c9cdd312f2afdc506855632657ea91913 | 1218.62 ms | 1244.86 ms | 26.24 ms |
| f92cfa9b1199c75411a263d2d9bc2df8ea8029cf | 1228.45 ms | 1251.33 ms | 22.88 ms |
| 079bcc8e93f62975c92c81d3bb58ab8d2541e3ab | 1217.88 ms | 1234.88 ms | 17.00 ms |
| 701b301b0777a6cbe3bd97f45be62cb72edd1eb7 | 1226.10 ms | 1245.57 ms | 19.47 ms |
| 65f8d2e8357c2013bf9a267344f7b8fe780b0534 | 1221.15 ms | 1243.96 ms | 22.81 ms |
| c63e0fe2b22bebeb8715f20e5e4361f766cd4d6a | 1230.58 ms | 1253.94 ms | 23.35 ms |
| db9572abd5878e7fc709b0da9863fe416ca8bc01 | 1223.13 ms | 1241.60 ms | 18.47 ms |
| 8fd192fe7ea5c067c5d9aff71f01f93590664747 | 1202.10 ms | 1220.19 ms | 18.09 ms |
| 248195076dafba5bac1b3aa7668eacd5267886e2 | 1221.04 ms | 1248.98 ms | 27.94 ms |
| 51f74d7f7217c4dd878ee94087f21336417b3598 | 1236.31 ms | 1247.43 ms | 11.12 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 9389467c9cdd312f2afdc506855632657ea91913 | 23.75 KiB | 866.51 KiB | 842.76 KiB |
| f92cfa9b1199c75411a263d2d9bc2df8ea8029cf | 23.75 KiB | 855.38 KiB | 831.62 KiB |
| 079bcc8e93f62975c92c81d3bb58ab8d2541e3ab | 23.74 KiB | 874.07 KiB | 850.33 KiB |
| 701b301b0777a6cbe3bd97f45be62cb72edd1eb7 | 23.75 KiB | 867.16 KiB | 843.41 KiB |
| 65f8d2e8357c2013bf9a267344f7b8fe780b0534 | 23.74 KiB | 872.67 KiB | 848.93 KiB |
| c63e0fe2b22bebeb8715f20e5e4361f766cd4d6a | 23.74 KiB | 874.08 KiB | 850.33 KiB |
| db9572abd5878e7fc709b0da9863fe416ca8bc01 | 23.75 KiB | 858.64 KiB | 834.89 KiB |
| 8fd192fe7ea5c067c5d9aff71f01f93590664747 | 23.74 KiB | 872.75 KiB | 849.01 KiB |
| 248195076dafba5bac1b3aa7668eacd5267886e2 | 23.74 KiB | 872.74 KiB | 849.00 KiB |
| 51f74d7f7217c4dd878ee94087f21336417b3598 | 23.74 KiB | 874.08 KiB | 850.34 KiB |
Previous results on branch: armcknight/fix/launch-profile-rerun
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 2a489401a351cdd0bbf5bb9f9806e40bb0af4d5a | 1224.67 ms | 1246.10 ms | 21.43 ms |
| d20940cd89956f22a1a1e3a24a20ae4569548523 | 1210.45 ms | 1242.30 ms | 31.85 ms |
| 990929bc6f23be6d53cd8803fa54772b852490f6 | 1225.96 ms | 1246.51 ms | 20.55 ms |
| 6be3673b20a5140e2540020046966ec7cb182aa7 | 1215.00 ms | 1236.02 ms | 21.02 ms |
| 2ba623fbe22c12b695b9d75d75f48a2bf5768926 | 1219.96 ms | 1225.08 ms | 5.12 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 2a489401a351cdd0bbf5bb9f9806e40bb0af4d5a | 23.75 KiB | 874.45 KiB | 850.71 KiB |
| d20940cd89956f22a1a1e3a24a20ae4569548523 | 23.75 KiB | 874.46 KiB | 850.71 KiB |
| 990929bc6f23be6d53cd8803fa54772b852490f6 | 23.75 KiB | 872.95 KiB | 849.21 KiB |
| 6be3673b20a5140e2540020046966ec7cb182aa7 | 23.75 KiB | 850.99 KiB | 827.24 KiB |
| 2ba623fbe22c12b695b9d75d75f48a2bf5768926 | 23.75 KiB | 872.95 KiB | 849.21 KiB |
For some reason tests are failing In CI but not locally, i'm debugging.
🚨 Detected changes in high risk code 🚨
High-risk code can easily blow up and is hard to test. We had severe bugs in the past. Be extra careful when changing these files, and have an extra careful look at these:
- [x] Sources/Sentry/SentryFileManager.m