Skip to content

Conversation

@noahsmartin
Copy link
Contributor

@noahsmartin noahsmartin commented Oct 31, 2025

This PR looks big in the line count, but only because it renamed some things. The real changes are just SentryId.h/.m, SentryClient.swift, and SentryHub.swift. All of these are pretty small.

Refactors the public interface of SentryClient and SentryHub to be in Swift. The implementation doesn't change at all I keep the old old classes around and just renamed them to SentryClientInternal and SentryHubInternal. This unblocks using SPM without any risk of a big Swift migration, and lets us migrate them when we want without affecting the public API.

Also converts SentryId to ObjC which is required for SPM, and lets us delete SentryIdWrapper. We can convert it to Swift again once all of the classes depending on it in the public API are also in Swift. Basically, this should be the last part of the public API to be in Swift.

#skip-changelog

Closes #6630

@codecov
Copy link

codecov bot commented Oct 31, 2025

Codecov Report

❌ Patch coverage is 46.60194% with 110 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.178%. Comparing base (9f8640f) to head (1b852ec).
⚠️ Report is 8 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
Sources/Swift/SentryHub.swift 0.000% 71 Missing ⚠️
Sources/Swift/SentryClient.swift 8.333% 33 Missing ⚠️
Sources/Sentry/SentryId.m 94.444% 0 Missing and 2 partials ⚠️
...rces/Swift/SentryCrash/SentryThreadInspector.swift 0.000% 2 Missing ⚠️
Sources/Sentry/SentryHub.m 94.117% 1 Missing ⚠️
Sources/Swift/Helper/SentrySDK.swift 92.307% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #6627       +/-   ##
=============================================
- Coverage   85.507%   85.178%   -0.330%     
=============================================
  Files          451       452        +1     
  Lines        27566     27669      +103     
  Branches     12069     12118       +49     
=============================================
- Hits         23571     23568        -3     
- Misses        3950      4055      +105     
- Partials        45        46        +1     
Files with missing lines Coverage Δ
SentryTestUtils/TestClient.swift 86.666% <ø> (ø)
SentryTestUtils/TestHub.swift 83.870% <ø> (ø)
Sources/Sentry/Profiling/SentryLaunchProfiling.m 80.681% <ø> (ø)
...entry/Profiling/SentryProfiledTracerConcurrency.mm 60.245% <100.000%> (+0.328%) ⬆️
...ces/Sentry/Profiling/SentryProfilerSerialization.m 63.636% <ø> (ø)
...ces/Sentry/Profiling/SentryProfilingSwiftHelpers.m 100.000% <ø> (ø)
Sources/Sentry/SentryClient.m 99.070% <ø> (ø)
...rces/Sentry/SentryDependencyContainerSwiftHelper.m 95.833% <100.000%> (-0.167%) ⬇️
Sources/Sentry/SentryOptionsInternal.m 99.543% <ø> (ø)
Sources/Sentry/SentryProfiler.mm 88.690% <ø> (ø)
... and 15 more

... and 2 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 9f8640f...1b852ec. Read the comment docs.

@noahsmartin noahsmartin force-pushed the clientHubSwift branch 10 times, most recently from e5f1cb6 to 376f35a Compare November 1, 2025 00:15
@github-actions
Copy link
Contributor

github-actions bot commented Nov 1, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1217.57 ms 1258.73 ms 41.16 ms
Size 23.75 KiB 1.02 MiB 1019.32 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
b41e6a7 1201.65 ms 1246.12 ms 44.47 ms
daeb716 1215.41 ms 1246.52 ms 31.11 ms
535ebd9 1194.59 ms 1219.84 ms 25.26 ms
b709887 1193.52 ms 1216.74 ms 23.22 ms
e98d6f5 1228.51 ms 1258.85 ms 30.34 ms
76f74df 1238.29 ms 1261.22 ms 22.94 ms
0b6776b 1230.18 ms 1262.06 ms 31.88 ms
9389467 1218.62 ms 1244.86 ms 26.24 ms
86eb6d5 1224.95 ms 1251.82 ms 26.87 ms
561321a 1229.60 ms 1252.55 ms 22.95 ms

App size

Revision Plain With Sentry Diff
b41e6a7 23.75 KiB 908.03 KiB 884.28 KiB
daeb716 23.75 KiB 928.16 KiB 904.41 KiB
535ebd9 23.75 KiB 1008.67 KiB 984.92 KiB
b709887 23.75 KiB 1.01 MiB 1016.14 KiB
e98d6f5 23.75 KiB 933.03 KiB 909.28 KiB
76f74df 23.75 KiB 879.61 KiB 855.86 KiB
0b6776b 23.75 KiB 968.23 KiB 944.49 KiB
9389467 23.75 KiB 866.51 KiB 842.76 KiB
86eb6d5 23.74 KiB 1.02 MiB 1016.53 KiB
561321a 23.75 KiB 963.18 KiB 939.43 KiB

Previous results on branch: clientHubSwift

Startup times

Revision Plain With Sentry Diff
2bb9538 1224.02 ms 1258.24 ms 34.22 ms

App size

Revision Plain With Sentry Diff
2bb9538 23.75 KiB 1.02 MiB 1020.22 KiB

@noahsmartin noahsmartin force-pushed the clientHubSwift branch 14 times, most recently from 48ac80a to bed31ff Compare November 3, 2025 00:55
@noahsmartin noahsmartin force-pushed the clientHubSwift branch 2 times, most recently from bbfbdc6 to 5169bbd Compare November 3, 2025 01:45
@philprime
Copy link
Member

@sentry review
@cursor review

Copy link
Member

@philprime philprime left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for doing this.

@noahsmartin noahsmartin merged commit f83dcc4 into main Nov 3, 2025
208 of 217 checks passed
@noahsmartin noahsmartin deleted the clientHubSwift branch November 3, 2025 14:24
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.

ref: SentryClient and SentryHub in Swift

3 participants