Skip to content

Conversation

denrase
Copy link
Collaborator

@denrase denrase commented Jul 22, 2025

#skip-changelog

📜 Description

  • Add beforeSendLog callback to SentryOptions
  • Changes SentryLog struct and sub-structures to NSObject for interoperability.
  • Introduces an options extension for SPM builds, due to issue with compiling a Swift type in ObjC layer.

💡 Motivation and Context

Closes #5668

💚 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 denrase marked this pull request as ready for review July 22, 2025 09:44
Copy link

codecov bot commented Jul 22, 2025

Codecov Report

❌ Patch coverage is 97.36842% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.675%. Comparing base (ae16459) to head (5a0f736).
⚠️ Report is 7 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
Sources/Swift/Protocol/SentryLogAttribute.swift 93.975% 5 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #5678       +/-   ##
=============================================
+ Coverage   86.655%   86.675%   +0.020%     
=============================================
  Files          423       423               
  Lines        36405     36505      +100     
  Branches     17229     17273       +44     
=============================================
+ Hits         31547     31641       +94     
- Misses        4813      4819        +6     
  Partials        45        45               
Files with missing lines Coverage Δ
Sources/Sentry/SentryOptions.m 97.460% <100.000%> (+0.049%) ⬆️
Sources/Swift/Protocol/SentryLog.swift 100.000% <100.000%> (ø)
Sources/Swift/Protocol/SentryLogLevel.swift 100.000% <100.000%> (ø)
Sources/Swift/Protocol/SentryLogMessage.swift 100.000% <100.000%> (ø)
Sources/Swift/Tools/SentryLogger.swift 99.404% <100.000%> (+0.025%) ⬆️
Sources/Swift/Protocol/SentryLogAttribute.swift 95.000% <93.975%> (-5.000%) ⬇️

... and 8 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 ae16459...5a0f736. Read the comment docs.

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.

Good progress, left some comments

@denrase denrase requested a review from philprime July 28, 2025 08:56
Copy link
Contributor

github-actions bot commented Jul 28, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1230.26 ms 1249.38 ms 19.12 ms
Size 23.75 KiB 919.69 KiB 895.94 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
92a02b8 1220.89 ms 1249.27 ms 28.37 ms
0b5fd21 1237.52 ms 1251.36 ms 13.84 ms
f97a070 1218.88 ms 1253.12 ms 34.24 ms
55f739c 1226.06 ms 1248.78 ms 22.71 ms
42cfd79 1222.13 ms 1244.23 ms 22.10 ms
5d238d3 1228.94 ms 1253.04 ms 24.10 ms
37183fe 1212.33 ms 1238.92 ms 26.59 ms
c63e0fe 1230.58 ms 1253.94 ms 23.35 ms
d38165b 1211.41 ms 1242.49 ms 31.08 ms
db9572a 1200.27 ms 1234.80 ms 34.53 ms

App size

Revision Plain With Sentry Diff
92a02b8 23.75 KiB 913.17 KiB 889.42 KiB
0b5fd21 23.75 KiB 912.78 KiB 889.03 KiB
f97a070 23.75 KiB 858.68 KiB 834.93 KiB
55f739c 23.75 KiB 858.73 KiB 834.98 KiB
42cfd79 23.75 KiB 880.20 KiB 856.45 KiB
5d238d3 23.75 KiB 913.62 KiB 889.88 KiB
37183fe 23.75 KiB 913.63 KiB 889.87 KiB
c63e0fe 23.74 KiB 874.08 KiB 850.33 KiB
d38165b 23.75 KiB 855.37 KiB 831.62 KiB
db9572a 23.75 KiB 858.69 KiB 834.93 KiB

Previous results on branch: feat/structured-logs-before-send

Startup times

Revision Plain With Sentry Diff
fc721e9 1226.10 ms 1252.48 ms 26.37 ms
8b314c4 1237.20 ms 1265.29 ms 28.08 ms
a315a86 1235.70 ms 1264.02 ms 28.33 ms

App size

Revision Plain With Sentry Diff
fc721e9 23.75 KiB 919.62 KiB 895.87 KiB
8b314c4 23.74 KiB 919.50 KiB 895.76 KiB
a315a86 23.75 KiB 913.20 KiB 889.45 KiB

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 unsure about the MutableSentryLog approach.

@denrase denrase requested a review from philipphofmann July 28, 2025 12:11
@denrase denrase changed the title Structured Logs: beforeSendLog Add beforeSendLog callback to SentryOptions Aug 4, 2025
denrase added 3 commits August 4, 2025 09:59
# Conflicts:
#	Sources/Swift/Tools/SentryLogger.swift
#	sdk_api.json
#	sdk_api_V9.json
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.

Good progress, left a couple of comments

@denrase denrase requested a review from philprime August 4, 2025 14:46
@denrase denrase requested a review from noahsmartin August 5, 2025 06:57
@denrase denrase requested a review from philprime August 7, 2025 11:48
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

cursor[bot]

This comment was marked as outdated.

@denrase denrase merged commit ea2e54c into main Aug 11, 2025
120 of 121 checks passed
@denrase denrase deleted the feat/structured-logs-before-send branch August 11, 2025 13:14
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.

Structured Logs: beforeSendLog
4 participants