sentry-cocoa icon indicating copy to clipboard operation
sentry-cocoa copied to clipboard

ref(logging): refactor SentryCrashLog into SentryAsyncSafeLog

Open armcknight opened this issue 1 year ago • 4 comments

Picks up more in the direction I wanted to go in vs https://github.com/getsentry/sentry-cocoa/pull/4088

This prepares the implementation currently from the KSCrash fork for more general async-safe use cases, by renaming things. This is also required by some of the profiler stuff, for example. There should be no changes to any actual implementation logic.

Followed by #4102, which fixes the build error in this branch related to it being unable to find one of the ObjC log methods: 4102 removes the objc portion of the old crash logger entirely, replacing its usages with SentryLog.

#skip-changelog

armcknight avatar Jun 21 '24 21:06 armcknight

@brustolin Please see https://github.com/getsentry/sentry-cocoa/pull/4113 which fixes the test breakages, then i'll merge that into this, and merge forward into all the other branches to make sure their checks all pass afterwards

armcknight avatar Jun 24 '24 22:06 armcknight

Codecov Report

Attention: Patch coverage is 53.11653% with 173 lines in your changes missing coverage. Please review.

Project coverage is 91.365%. Comparing base (4597906) to head (008c9f1).

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #4101       +/-   ##
=============================================
+ Coverage   91.362%   91.365%   +0.002%     
=============================================
  Files          609       604        -5     
  Lines        48396     48214      -182     
  Branches     17420     17314      -106     
=============================================
- Hits         44216     44051      -165     
+ Misses        4088      4069       -19     
- Partials        92        94        +2     
Files Coverage Δ
Sources/Sentry/SentryAsyncSafeLog.c 100.000% <100.000%> (ø)
Sources/Sentry/SentryFileManager.m 93.023% <ø> (-0.259%) :arrow_down:
Sources/Sentry/include/SentryLog.h 90.000% <100.000%> (ø)
...entryCrash/Installations/SentryCrashInstallation.m 46.913% <ø> (ø)
...s/SentryCrash/Recording/SentryCrashReportVersion.h 100.000% <100.000%> (ø)
...entryCrash/Recording/Tools/SentryCrashCPU_x86_64.c 100.000% <100.000%> (ø)
...es/SentryCrash/Recording/Tools/SentryCrashMemory.c 90.196% <ø> (ø)
...rces/SentryCrash/Recording/Tools/SentryCrashObjC.c 57.491% <ø> (-0.276%) :arrow_down:
...Recording/Tools/SentryCrashStackCursor_Backtrace.c 100.000% <ø> (ø)
...ding/Tools/SentryCrashStackCursor_MachineContext.c 89.130% <ø> (-4.348%) :arrow_down:
... and 33 more

... and 19 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 4597906...008c9f1. Read the comment docs.

codecov[bot] avatar Jun 25 '24 15:06 codecov[bot]

Performance metrics :rocket:

  Plain With Sentry Diff
Startup time 1235.00 ms 1246.56 ms 11.56 ms
Size 21.58 KiB 681.72 KiB 660.14 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
c02142228d34fd596517f17e64955e2b9a895f28 1199.15 ms 1222.20 ms 23.05 ms
38b36f5735cfc98c4645f4c06a30a3442a858dbd 1218.48 ms 1246.61 ms 28.13 ms
443723aa376086e3d7a07f442638e9ccac7ac2bf 1205.24 ms 1220.52 ms 15.28 ms
3ea21f5004b1b347fe430434d623860de393f15f 1250.80 ms 1258.88 ms 8.08 ms
ec879f70f0d29af2973f51b1737f646393bf9dfd 1304.84 ms 1337.04 ms 32.20 ms
154f7957aeae4eb52783f77fc0308786bd528eab 1225.53 ms 1231.04 ms 5.51 ms
699d76f9a51f68a4eb730ca4438110d077ed8e36 1217.12 ms 1236.33 ms 19.20 ms
c8dbe735adc49b67a92bacb74930d826a23ca7ee 1235.49 ms 1250.57 ms 15.08 ms
06548c0f88eefd4a54851752c7d33f4270e34ba9 1226.71 ms 1252.37 ms 25.66 ms
4f660b47e71cdc0c0caee5d074c56945f709fc60 1225.44 ms 1230.18 ms 4.75 ms

App size

Revision Plain With Sentry Diff
c02142228d34fd596517f17e64955e2b9a895f28 20.76 KiB 435.64 KiB 414.88 KiB
38b36f5735cfc98c4645f4c06a30a3442a858dbd 21.58 KiB 616.35 KiB 594.77 KiB
443723aa376086e3d7a07f442638e9ccac7ac2bf 20.76 KiB 414.44 KiB 393.68 KiB
3ea21f5004b1b347fe430434d623860de393f15f 22.84 KiB 402.63 KiB 379.78 KiB
ec879f70f0d29af2973f51b1737f646393bf9dfd 21.58 KiB 669.68 KiB 648.10 KiB
154f7957aeae4eb52783f77fc0308786bd528eab 20.76 KiB 435.25 KiB 414.49 KiB
699d76f9a51f68a4eb730ca4438110d077ed8e36 21.58 KiB 631.82 KiB 610.24 KiB
c8dbe735adc49b67a92bacb74930d826a23ca7ee 21.58 KiB 615.91 KiB 594.33 KiB
06548c0f88eefd4a54851752c7d33f4270e34ba9 20.76 KiB 427.36 KiB 406.59 KiB
4f660b47e71cdc0c0caee5d074c56945f709fc60 22.85 KiB 408.84 KiB 385.99 KiB

Previous results on branch: armcknight/ref/crashlogger-repurpose/1-rename

Startup times

Revision Plain With Sentry Diff
1248c83784092f0917cd3e9c7bda70c7b48df5ba 1236.46 ms 1245.64 ms 9.18 ms
a517205eafe774fdad22de395b6409a3e9239b99 1205.49 ms 1228.69 ms 23.20 ms
bddda2270ef8e6ee5b47f7f67bad8f8c82bde5fe 1240.19 ms 1246.08 ms 5.89 ms
a2ebce693cd501b2ec1440a2528360a81a4eb5a7 1226.90 ms 1243.02 ms 16.13 ms

App size

Revision Plain With Sentry Diff
1248c83784092f0917cd3e9c7bda70c7b48df5ba 21.58 KiB 672.51 KiB 650.93 KiB
a517205eafe774fdad22de395b6409a3e9239b99 21.58 KiB 672.52 KiB 650.94 KiB
bddda2270ef8e6ee5b47f7f67bad8f8c82bde5fe 21.58 KiB 674.50 KiB 652.92 KiB
a2ebce693cd501b2ec1440a2528360a81a4eb5a7 21.58 KiB 672.66 KiB 651.08 KiB

github-actions[bot] avatar Jun 25 '24 16:06 github-actions[bot]

🚨 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/SentryNetworkTracker.m

github-actions[bot] avatar Jun 28 '24 23:06 github-actions[bot]