Skip to content

Conversation

philprime
Copy link
Member

@philprime philprime commented Aug 25, 2025

📜 Description

Changes the attachment processors to reuse the output of previous integrations, to not drop attachments.

💡 Motivation and Context

When enabling the options attachScreenshot and attachViewHierarchy, the two respective integrations SentryScreenshotIntegration and SentryViewHierarchyIntegration are installed respectively.

The current implementation of the [SentryClient processAttachmentsForEvent:attachments:] is simply replacing the processedAttachments containing the output of the previous integration, instead of merging the result, therefore only one integration can be used at a time.

This PR changes the loop to call each processor with the output of previous ones. This allows processors to add and remove attachments of previous processors. This also introduces an implicit order of integrations based on the installation order in SentryOptionsInternal.m.

We are ignoring this order for now, as we only have two integrations processing attachments, and they are both only adding attachments to the result. I added a note in the code for this.

💚 How did you test it?

TBD

📝 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.

@philprime philprime self-assigned this Aug 25, 2025
Copy link

codecov bot commented Aug 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.726%. Comparing base (073562b) to head (dca5a8c).
⚠️ Report is 6 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #5989       +/-   ##
=============================================
+ Coverage   86.672%   86.726%   +0.054%     
=============================================
  Files          424       424               
  Lines        36714     36713        -1     
  Branches     17363     17364        +1     
=============================================
+ Hits         31821     31840       +19     
+ Misses        4846      4827       -19     
+ Partials        47        46        -1     
Files with missing lines Coverage Δ
Sources/Sentry/SentryClient.m 98.936% <100.000%> (+0.001%) ⬆️
Sources/Sentry/SentryScreenshotIntegration.m 91.836% <100.000%> (-0.321%) ⬇️

... and 11 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 073562b...dca5a8c. Read the comment docs.

Copy link
Contributor

github-actions bot commented Aug 25, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1229.85 ms 1255.11 ms 25.25 ms
Size 23.75 KiB 927.08 KiB 903.33 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
c5bedc0 1203.83 ms 1236.17 ms 32.33 ms
aadbffe 1228.73 ms 1251.59 ms 22.86 ms
2de3f92 1207.56 ms 1234.96 ms 27.40 ms
ed85746 1231.79 ms 1248.55 ms 16.75 ms
21efa18 1227.73 ms 1250.04 ms 22.31 ms
7148f97 1235.09 ms 1258.07 ms 22.98 ms
d0f70ce 1226.54 ms 1247.04 ms 20.50 ms
5bf2b17 1213.53 ms 1238.54 ms 25.01 ms
1339919 1214.82 ms 1238.98 ms 24.16 ms
2a36c3f 1227.27 ms 1246.89 ms 19.63 ms

App size

Revision Plain With Sentry Diff
c5bedc0 23.75 KiB 920.63 KiB 896.89 KiB
aadbffe 23.75 KiB 912.77 KiB 889.02 KiB
2de3f92 23.75 KiB 919.69 KiB 895.94 KiB
ed85746 23.75 KiB 920.83 KiB 897.08 KiB
21efa18 23.75 KiB 919.70 KiB 895.95 KiB
7148f97 23.75 KiB 854.78 KiB 831.03 KiB
d0f70ce 23.75 KiB 913.09 KiB 889.34 KiB
5bf2b17 23.75 KiB 913.27 KiB 889.52 KiB
1339919 23.75 KiB 919.70 KiB 895.95 KiB
2a36c3f 23.75 KiB 874.45 KiB 850.71 KiB

Previous results on branch: philprime/fix-attachment-processing

Startup times

Revision Plain With Sentry Diff
6c9100d 1239.02 ms 1263.27 ms 24.24 ms
0421faf 1223.55 ms 1247.63 ms 24.08 ms

App size

Revision Plain With Sentry Diff
6c9100d 23.74 KiB 926.48 KiB 902.73 KiB
0421faf 23.75 KiB 926.72 KiB 902.96 KiB

@philprime philprime marked this pull request as ready for review August 26, 2025 15:14
Copy link
Contributor

@itaybre itaybre left a comment

Choose a reason for hiding this comment

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

LGTM

@philprime philprime added the Waiting for: CI 🤖 Marks PR as ready-for-merge when CI passes. To be replaced with required checks. label Aug 27, 2025
@philprime philprime enabled auto-merge (squash) August 27, 2025 15:01
@philprime philprime merged commit 4b992b4 into main Aug 28, 2025
152 of 157 checks passed
@philprime philprime deleted the philprime/fix-attachment-processing branch August 28, 2025 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Waiting for: CI 🤖 Marks PR as ready-for-merge when CI passes. To be replaced with required checks.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants