Skip to content
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

internal(replay): Add IgnoreWrapper class for hybrid SDKs #4522

Merged
merged 5 commits into from
Nov 12, 2024

Conversation

krystofwoldrich
Copy link
Member

📜 Description

This PR adds IgnoreWrapper functionality to Replay Redaction logic.

Why is this needed? In RN JS we don't have access to the native view instances directly. So we create a native wrapper class which we can use from JS.

💚 How did you test it?

rn sample app, unit and integration tests

📝 Checklist

You have to check all boxes before merging:

  • I reviewed the submitted code.
  • 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.
  • 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.

#skip-changelog

Copy link

codecov bot commented Nov 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.562%. Comparing base (489fbb8) to head (fcaefd2).
Report is 7 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #4522       +/-   ##
=============================================
+ Coverage   91.511%   91.562%   +0.050%     
=============================================
  Files          615       615               
  Lines        69470     69698      +228     
  Branches     24916     24959       +43     
=============================================
+ Hits         63573     63817      +244     
+ Misses        5804      5789       -15     
+ Partials        93        92        -1     
Files with missing lines Coverage Δ
Sources/Sentry/PrivateSentrySDKOnly.mm 89.119% <100.000%> (+0.470%) ⬆️
Sources/Swift/Tools/SentryViewPhotographer.swift 92.405% <100.000%> (+0.624%) ⬆️
Sources/Swift/Tools/UIRedactBuilder.swift 93.721% <100.000%> (+0.828%) ⬆️
Tests/SentryTests/PrivateSentrySDKOnlyTests.swift 99.736% <100.000%> (+0.025%) ⬆️
Tests/SentryTests/UIRedactBuilderTests.swift 100.000% <100.000%> (ø)

... and 18 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 489fbb8...fcaefd2. Read the comment docs.

Copy link

github-actions bot commented Nov 11, 2024

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1240.51 ms 1264.80 ms 24.29 ms
Size 22.30 KiB 730.75 KiB 708.45 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
189b629 1197.02 ms 1216.88 ms 19.86 ms
408f43e 1229.31 ms 1247.52 ms 18.21 ms
caa37b6 1221.19 ms 1238.71 ms 17.52 ms
a54df45 1232.62 ms 1247.30 ms 14.68 ms
61a1a2b 1222.73 ms 1245.35 ms 22.62 ms
e34db45 1211.48 ms 1224.45 ms 12.97 ms
add8416 1270.72 ms 1300.38 ms 29.66 ms
1b69ee7 1240.63 ms 1259.24 ms 18.61 ms
b3fd863 1217.81 ms 1231.31 ms 13.50 ms
7e757f4 1229.31 ms 1252.00 ms 22.69 ms

App size

Revision Plain With Sentry Diff
189b629 20.76 KiB 399.69 KiB 378.93 KiB
408f43e 21.58 KiB 573.17 KiB 551.59 KiB
caa37b6 21.58 KiB 424.34 KiB 402.76 KiB
a54df45 20.76 KiB 434.88 KiB 414.12 KiB
61a1a2b 21.58 KiB 424.34 KiB 402.76 KiB
e34db45 21.58 KiB 671.30 KiB 649.72 KiB
add8416 21.58 KiB 541.91 KiB 520.33 KiB
1b69ee7 21.58 KiB 707.42 KiB 685.84 KiB
b3fd863 21.58 KiB 706.85 KiB 685.27 KiB
7e757f4 21.58 KiB 682.40 KiB 660.82 KiB

Previous results on branch: kw/replay/add-ignore-wrapper-for-hybrids

Startup times

Revision Plain With Sentry Diff
9de41a6 1235.78 ms 1248.89 ms 13.11 ms

App size

Revision Plain With Sentry Diff
9de41a6 21.90 KiB 730.22 KiB 708.32 KiB

Copy link
Contributor

@brustolin brustolin left a comment

Choose a reason for hiding this comment

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

Just a few code improvement suggestions: In Swift, it’s better to use guard for simple early return, since the compiler will enforce the early return.

Apart from that, it’s all good.

Sources/Swift/Tools/UIRedactBuilder.swift Outdated Show resolved Hide resolved
Sources/Swift/Tools/UIRedactBuilder.swift Outdated Show resolved Hide resolved
Sources/Swift/Tools/UIRedactBuilder.swift Outdated Show resolved Hide resolved
@krystofwoldrich
Copy link
Member Author

@brustolin Ready for a second pass. I fixed the guards and added RedactContainer.

To fix the issue where RedactContainer would be overwritten by IgnoreContainer in the following setup IgnoreContainer -> RedactContainer -> 'This should be redacted'

Copy link
Contributor

@brustolin brustolin left a comment

Choose a reason for hiding this comment

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

Thanks for renaming the API

Sources/Swift/Tools/SentryViewPhotographer.swift Outdated Show resolved Hide resolved
Sources/Swift/Tools/UIRedactBuilder.swift Outdated Show resolved Hide resolved
@krystofwoldrich krystofwoldrich merged commit 656fdf1 into main Nov 12, 2024
63 of 65 checks passed
@krystofwoldrich krystofwoldrich deleted the kw/replay/add-ignore-wrapper-for-hybrids branch November 12, 2024 11:56
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.

2 participants