Skip to content

Conversation

@denrase
Copy link
Collaborator

@denrase denrase commented Oct 23, 2025

📜 Description

  • Adds capture(log:scope:) methods to Client
  • Adds logger API to Hub
  • Moves attributes enrichment of logs into batcher, so that hub/scope calls also get them.
  • Provides additional workarounds for circular issues regarding Logs an ObjC/Swift
  • Adds public initializers to SentryLog, so users can actually create them for hub/client method usage.

💡 Motivation and Context

Closes #6503

💚 How did you test it?

Unit tests

📝 Checklist

You have to check all boxes before merging:

  • 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.
  • I updated the wizard 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.

@denrase
Copy link
Collaborator Author

denrase commented Oct 23, 2025

@philipphofmann Hacked this together. Works locally. If there are no other blockers, everything should work out without breaking existing public API.

@codecov
Copy link

codecov bot commented Oct 23, 2025

Codecov Report

❌ Patch coverage is 93.24324% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.729%. Comparing base (3a3d93b) to head (75e78bc).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
Sources/Swift/SentryHub.swift 0.000% 5 Missing ⚠️
Sources/Swift/Helper/SentrySDK.swift 71.428% 2 Missing ⚠️
Sources/Swift/SentryClient.swift 0.000% 2 Missing ⚠️
Sources/Swift/Tools/SentryLogBatcher.swift 98.611% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #6518       +/-   ##
=============================================
- Coverage   85.163%   84.729%   -0.435%     
=============================================
  Files          453       447        -6     
  Lines        27689     27379      -310     
  Branches     12111     11971      -140     
=============================================
- Hits         23581     23198      -383     
- Misses        4063      4134       +71     
- Partials        45        47        +2     
Files with missing lines Coverage Δ
SentryTestUtils/Sources/TestClient.swift 86.792% <100.000%> (+0.125%) ⬆️
Sources/Sentry/SentryClient.m 97.431% <100.000%> (-1.640%) ⬇️
Sources/Sentry/SentryHub.m 96.534% <100.000%> (+0.189%) ⬆️
Sources/Sentry/SentrySDKInternal.m 86.100% <ø> (-0.054%) ⬇️
Sources/Swift/Protocol/SentryLog.swift 100.000% <100.000%> (ø)
Sources/Swift/Tools/SentryLogger.swift 100.000% <100.000%> (+0.735%) ⬆️
Sources/Swift/Tools/SentryLogBatcher.swift 98.373% <98.611%> (+0.098%) ⬆️
Sources/Swift/Helper/SentrySDK.swift 81.521% <71.428%> (-5.767%) ⬇️
Sources/Swift/SentryClient.swift 7.894% <0.000%> (-0.439%) ⬇️
Sources/Swift/SentryHub.swift 0.000% <0.000%> (ø)

... and 72 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 3a3d93b...75e78bc. Read the comment docs.

@denrase denrase changed the title Logs: Hub and Client APIs Structured Logs: Add captureLog to Hub and Client Oct 24, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 24, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1223.19 ms 1251.33 ms 28.13 ms
Size 23.75 KiB 1.00 MiB 1001.60 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
d1c4916 1216.66 ms 1244.73 ms 28.08 ms
d1c0538 1227.49 ms 1246.96 ms 19.47 ms
cc02c0d 1234.69 ms 1247.15 ms 12.46 ms
23b6a91 1227.73 ms 1262.93 ms 35.20 ms
ea2e54c 1207.78 ms 1218.13 ms 10.35 ms
6c0b61e 1194.21 ms 1218.74 ms 24.53 ms
83d27f6 1233.56 ms 1259.24 ms 25.68 ms
1a34ddc 1217.79 ms 1242.17 ms 24.38 ms
d05d866 1211.78 ms 1230.96 ms 19.18 ms
bc0a04c 1226.83 ms 1255.04 ms 28.21 ms

App size

Revision Plain With Sentry Diff
d1c4916 23.75 KiB 981.31 KiB 957.56 KiB
d1c0538 23.75 KiB 928.87 KiB 905.12 KiB
cc02c0d 23.75 KiB 912.37 KiB 888.62 KiB
23b6a91 23.75 KiB 1004.80 KiB 981.06 KiB
ea2e54c 23.75 KiB 919.70 KiB 895.95 KiB
6c0b61e 23.75 KiB 1.02 MiB 1019.10 KiB
83d27f6 23.75 KiB 928.88 KiB 905.13 KiB
1a34ddc 23.75 KiB 919.90 KiB 896.15 KiB
d05d866 23.75 KiB 878.60 KiB 854.85 KiB
bc0a04c 23.75 KiB 933.32 KiB 909.57 KiB

Previous results on branch: denrase/logs-in-hub-and-client

Startup times

Revision Plain With Sentry Diff
db59d5d 1217.41 ms 1240.59 ms 23.18 ms
31d864b 1212.77 ms 1246.85 ms 34.08 ms
391bd71 1231.72 ms 1262.83 ms 31.11 ms
90fcb79 1220.14 ms 1258.02 ms 37.88 ms
cf93b3b 1224.50 ms 1246.35 ms 21.85 ms
225f528 1211.81 ms 1252.58 ms 40.77 ms
a429649 1216.39 ms 1217.77 ms 1.39 ms
08821c7 1206.15 ms 1239.35 ms 33.20 ms
9df70d3 1228.40 ms 1262.55 ms 34.16 ms

App size

Revision Plain With Sentry Diff
db59d5d 23.75 KiB 1.01 MiB 1006.79 KiB
31d864b 23.75 KiB 1.00 MiB 1003.12 KiB
391bd71 23.75 KiB 1.00 MiB 1004.71 KiB
90fcb79 23.75 KiB 1.00 MiB 1002.61 KiB
cf93b3b 23.75 KiB 1.00 MiB 1003.12 KiB
225f528 23.75 KiB 1.01 MiB 1006.79 KiB
a429649 23.75 KiB 1.00 MiB 1002.92 KiB
08821c7 23.75 KiB 1.02 MiB 1017.66 KiB
9df70d3 23.75 KiB 1.01 MiB 1006.51 KiB

@denrase denrase marked this pull request as ready for review October 24, 2025 14:22
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

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.

LGTM, when ditching the force cast #6518 (comment). Thanks @denrase

@denrase denrase enabled auto-merge (squash) November 6, 2025 13:57
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.

Two more comments. Thanks

@denrase denrase merged commit 324157f into main Nov 7, 2025
125 of 131 checks passed
@denrase denrase deleted the denrase/logs-in-hub-and-client branch November 7, 2025 13:23
philipphofmann added a commit that referenced this pull request Nov 10, 2025
philipphofmann added a commit that referenced this pull request Nov 10, 2025
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.

Logs: Hub and Client APIs

4 participants