Skip to content

Add sentry private SPM #5269

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add sentry private SPM #5269

wants to merge 1 commit into from

Conversation

noahsmartin
Copy link
Contributor

@noahsmartin noahsmartin commented May 20, 2025

This adds a new SPM target "_SentryPrivate" to hold all the objc code that swift needs to access. The name matches the existing name, so Swift code that uses @_implementationOnly import SentryPrivate does not need to be changed to compile with SPM.

A bit of code needed to be pulled out of SentryFileManager to be used from code that Swift depends on, without bringing all of SentryFileManager. I put that code all into FileUtils.m. Other than that the only other notable change is the addition of @_spi(Private) public since Swift classes that are visible to objc need to be public in SPM.

#skip-changelog

@noahsmartin noahsmartin force-pushed the addSentryPrivateSPM branch from 18dd8b5 to 991acbd Compare May 20, 2025 21:30
Copy link

codecov bot commented May 20, 2025

Codecov Report

Attention: Patch coverage is 94.44444% with 6 lines in your changes missing coverage. Please review.

Project coverage is 92.791%. Comparing base (32b4f2b) to head (5f54fc5).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
Sources/Sentry/_SentryPrivate/FileUtils.m 94.117% 5 Missing ⚠️
...tryTests/Networking/SentryHttpTransportTests.swift 85.714% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #5269       +/-   ##
=============================================
- Coverage   92.899%   92.791%   -0.109%     
=============================================
  Files          688       689        +1     
  Lines        86276     86272        -4     
  Branches     31191     30103     -1088     
=============================================
- Hits         80150     80053       -97     
- Misses        6027      6121       +94     
+ Partials        99        98        -1     
Files with missing lines Coverage Δ
SentryTestUtils/SentryLogExtensions.swift 100.000% <ø> (ø)
Sources/Sentry/SentryFileManager.m 94.453% <ø> (+0.040%) ⬆️
Sources/Sentry/_SentryPrivate/SentryAsyncSafeLog.c 100.000% <ø> (ø)
Sources/Sentry/_SentryPrivate/SentryCrashDebug.c 81.818% <ø> (ø)
Sources/Sentry/_SentryPrivate/SentryError.mm 100.000% <ø> (ø)
Sources/Sentry/_SentryPrivate/SentryLogC.m 94.117% <ø> (ø)
...ources/Sentry/_SentryPrivate/SentryMachLogging.cpp 3.517% <ø> (ø)
...Sentry/_SentryPrivate/include/SentryAsyncSafeLog.h 84.615% <ø> (ø)
Sources/Sentry/_SentryPrivate/include/SentryLog.h 90.000% <ø> (ø)
...entry/_SentryPrivate/include/SentryMachLogging.hpp 70.588% <ø> (ø)
... and 19 more

... and 20 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 32b4f2b...5f54fc5. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@noahsmartin noahsmartin force-pushed the addSentryPrivateSPM branch 5 times, most recently from 3d6456a to 2271185 Compare May 20, 2025 21:56
Copy link
Contributor

github-actions bot commented May 20, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1214.76 ms 1245.67 ms 30.91 ms
Size 23.76 KiB 821.12 KiB 797.36 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
e84bc3f 1201.49 ms 1232.82 ms 31.33 ms
676e429 1225.76 ms 1235.49 ms 9.73 ms
d3630c3 1248.52 ms 1262.70 ms 14.18 ms
97797b4 1199.27 ms 1213.54 ms 14.27 ms
8d16504 1235.50 ms 1258.76 ms 23.26 ms
90e653b 1238.94 ms 1258.20 ms 19.26 ms
2911760 1215.37 ms 1248.76 ms 33.39 ms
6bc5ae5 1207.23 ms 1216.66 ms 9.43 ms
f5a9f3f 1238.20 ms 1246.65 ms 8.45 ms
d1988b7 1205.20 ms 1234.10 ms 28.90 ms

App size

Revision Plain With Sentry Diff
e84bc3f 20.76 KiB 434.72 KiB 413.96 KiB
676e429 21.58 KiB 614.73 KiB 593.15 KiB
d3630c3 22.84 KiB 403.19 KiB 380.34 KiB
97797b4 22.85 KiB 408.72 KiB 385.87 KiB
8d16504 20.76 KiB 434.92 KiB 414.16 KiB
90e653b 21.58 KiB 714.13 KiB 692.55 KiB
2911760 21.58 KiB 697.69 KiB 676.11 KiB
6bc5ae5 20.76 KiB 401.39 KiB 380.63 KiB
f5a9f3f 22.31 KiB 775.15 KiB 752.83 KiB
d1988b7 22.32 KiB 819.55 KiB 797.23 KiB

Previous results on branch: addSentryPrivateSPM

Startup times

Revision Plain With Sentry Diff
d6a3262 1214.78 ms 1225.83 ms 11.05 ms
5614e74 1235.21 ms 1258.16 ms 22.95 ms

App size

Revision Plain With Sentry Diff
d6a3262 23.76 KiB 821.12 KiB 797.35 KiB
5614e74 23.76 KiB 821.11 KiB 797.35 KiB

@noahsmartin noahsmartin force-pushed the addSentryPrivateSPM branch 3 times, most recently from acfe644 to 87282dc Compare May 20, 2025 22:37
@noahsmartin noahsmartin force-pushed the addSentryPrivateSPM branch from bead0ae to 5f54fc5 Compare May 20, 2025 23:11
Copy link
Contributor

🚨 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:

  • Sources/Sentry/SentryFileManager.m

@noahsmartin noahsmartin marked this pull request as ready for review May 21, 2025 12:04
Copy link
Member

@philipphofmann philipphofmann left a comment

Choose a reason for hiding this comment

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

I'm a bit unsure about the naming of _SentryPrivate, because it contains public ObjC header files. That confuses me and feels wrong.

Also a bit confusing to me is that the Xcode structure doesn't match the folder structure. It can get confusing where to add a new public header file or a new header file in general. Do you think we should consider reflecting the actual folder structure with the Xcode groups so it's less confusing?

Apart from that, I think this PR goes in the right direction.

@philprime
Copy link
Contributor

Also a bit confusing to me is that the Xcode structure doesn't match the folder structure. It can get confusing where to add a new public header file or a new header file in general.

I would highly appreciate the Xcode project structure reflecting the file hierarchy. We can not use synchronized folders yet, due to using older Xcode versions, but at some point we could migrate.

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.

3 participants