getsentry / sentry-cocoa

The official Sentry SDK for iOS, tvOS, macOS, watchOS.
https://sentry.io/for/cocoa/
MIT License
817 stars 330 forks source link

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

Closed krystofwoldrich closed 2 weeks ago

krystofwoldrich commented 2 weeks ago

:scroll: 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.

:green_heart: How did you test it?

rn sample app, unit and integration tests

:pencil: Checklist

You have to check all boxes before merging:

skip-changelog

codecov[bot] commented 2 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4522/graphs/tree.svg?width=650&height=150&src=pr&token=PTZKtOJlrs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry)](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4522?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) ```diff @@ 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](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4522?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) | Coverage Δ | | |---|---|---| | [Sources/Sentry/PrivateSentrySDKOnly.mm](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4522?src=pr&el=tree&filepath=Sources%2FSentry%2FPrivateSentrySDKOnly.mm&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-U291cmNlcy9TZW50cnkvUHJpdmF0ZVNlbnRyeVNES09ubHkubW0=) | `89.119% <100.000%> (+0.470%)` | :arrow_up: | | [Sources/Swift/Tools/SentryViewPhotographer.swift](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4522?src=pr&el=tree&filepath=Sources%2FSwift%2FTools%2FSentryViewPhotographer.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-U291cmNlcy9Td2lmdC9Ub29scy9TZW50cnlWaWV3UGhvdG9ncmFwaGVyLnN3aWZ0) | `92.405% <100.000%> (+0.624%)` | :arrow_up: | | [Sources/Swift/Tools/UIRedactBuilder.swift](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4522?src=pr&el=tree&filepath=Sources%2FSwift%2FTools%2FUIRedactBuilder.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-U291cmNlcy9Td2lmdC9Ub29scy9VSVJlZGFjdEJ1aWxkZXIuc3dpZnQ=) | `93.721% <100.000%> (+0.828%)` | :arrow_up: | | [Tests/SentryTests/PrivateSentrySDKOnlyTests.swift](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4522?src=pr&el=tree&filepath=Tests%2FSentryTests%2FPrivateSentrySDKOnlyTests.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-VGVzdHMvU2VudHJ5VGVzdHMvUHJpdmF0ZVNlbnRyeVNES09ubHlUZXN0cy5zd2lmdA==) | `99.736% <100.000%> (+0.025%)` | :arrow_up: | | [Tests/SentryTests/UIRedactBuilderTests.swift](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4522?src=pr&el=tree&filepath=Tests%2FSentryTests%2FUIRedactBuilderTests.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-VGVzdHMvU2VudHJ5VGVzdHMvVUlSZWRhY3RCdWlsZGVyVGVzdHMuc3dpZnQ=) | `100.000% <100.000%> (ø)` | | ... and [18 files with indirect coverage changes](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4522/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4522?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4522?dropdown=coverage&src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry). Last update [489fbb8...fcaefd2](https://app.codecov.io/gh/getsentry/sentry-cocoa/pull/4522?dropdown=coverage&src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry).
github-actions[bot] commented 2 weeks ago

Performance metrics :rocket:

  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
189b629d5a298996eab145de40c744b2438861a0 1197.02 ms 1216.88 ms 19.86 ms
408f43e509276bf959d3780c88aa4a4e95368675 1229.31 ms 1247.52 ms 18.21 ms
caa37b6a9327677a43fa8b0eacd55e4ec9b248a1 1221.19 ms 1238.71 ms 17.52 ms
a54df4535aadb3606834acff5a75044d305dbea6 1232.62 ms 1247.30 ms 14.68 ms
61a1a2b3fdf32536035a5559fda92e54c7065f68 1222.73 ms 1245.35 ms 22.62 ms
e34db456f28f88eeaa318cec312137e997fd6c1a 1211.48 ms 1224.45 ms 12.97 ms
add8416cd7e3d0f3e9234f9d747c185a8b55be55 1270.72 ms 1300.38 ms 29.66 ms
1b69ee70354889e88897c9484c5f71d132b3eccb 1240.63 ms 1259.24 ms 18.61 ms
b3fd86355a16083eb3a12caaadc1ecfd782e66a2 1217.81 ms 1231.31 ms 13.50 ms
7e757f454a638bb8a2510e6b336f9a740613accd 1229.31 ms 1252.00 ms 22.69 ms

App size

Revision Plain With Sentry Diff
189b629d5a298996eab145de40c744b2438861a0 20.76 KiB 399.69 KiB 378.93 KiB
408f43e509276bf959d3780c88aa4a4e95368675 21.58 KiB 573.17 KiB 551.59 KiB
caa37b6a9327677a43fa8b0eacd55e4ec9b248a1 21.58 KiB 424.34 KiB 402.76 KiB
a54df4535aadb3606834acff5a75044d305dbea6 20.76 KiB 434.88 KiB 414.12 KiB
61a1a2b3fdf32536035a5559fda92e54c7065f68 21.58 KiB 424.34 KiB 402.76 KiB
e34db456f28f88eeaa318cec312137e997fd6c1a 21.58 KiB 671.30 KiB 649.72 KiB
add8416cd7e3d0f3e9234f9d747c185a8b55be55 21.58 KiB 541.91 KiB 520.33 KiB
1b69ee70354889e88897c9484c5f71d132b3eccb 21.58 KiB 707.42 KiB 685.84 KiB
b3fd86355a16083eb3a12caaadc1ecfd782e66a2 21.58 KiB 706.85 KiB 685.27 KiB
7e757f454a638bb8a2510e6b336f9a740613accd 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
9de41a61057dcd30222c1d6668f40f6be12d4583 1235.78 ms 1248.89 ms 13.11 ms

App size

Revision Plain With Sentry Diff
9de41a61057dcd30222c1d6668f40f6be12d4583 21.90 KiB 730.22 KiB 708.32 KiB
krystofwoldrich commented 2 weeks ago

@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'