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

fix: Edge case for swizzleClassNameExclude #4405

Merged
merged 6 commits into from
Oct 8, 2024

Conversation

philipphofmann
Copy link
Member

📜 Description

Skip creating transactions for UIViewControllers ignored for swizzling via the option swizzleClassNameExclude. Due to some edge cases with nib files, the SDK doesn't swizzle the loadView method of the UIViewController subclasses, but instead, it swizzles the UIViewController.loadView method directly. Although the SDK doesn't swizzle the classes specified in swizzleClassNameExclude, it created transactions. Now, this is fixed.

💡 Motivation and Context

Fixes GH-4386

💚 How did you test it?

Unit test.

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

🔮 Next steps

Skip creating transactions for UIViewControllers ignored for swizzling
via the option swizzleClassNameExclude. Due to some edge cases with nib
files, the SDK doesn't swizzle the loadView method of the
UIViewController subclasses, but instead, it swizzles the
UIViewController.loadView method directly. Although the SDK doesn't
swizzle the classes specified in swizzleClassNameExclude, it created
transactions. Now, this is fixed.

Fixes GH-4386
Copy link

github-actions bot commented Oct 7, 2024

🚨 Detected changes in high risk code 🚨

High-risk code can easily blow up and is hard to test. We had severe bugs in the past. Be extra careful when changing these files, and have an extra careful look at these:

  • Sources/Sentry/SentrySubClassFinder.m

Copy link

codecov bot commented Oct 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.288%. Comparing base (913fab7) to head (feaec67).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #4405       +/-   ##
=============================================
+ Coverage   91.272%   91.288%   +0.015%     
=============================================
  Files          607       609        +2     
  Lines        49395     49519      +124     
  Branches     17718     17824      +106     
=============================================
+ Hits         45084     45205      +121     
- Misses        4218      4221        +3     
  Partials        93        93               
Files with missing lines Coverage Δ
Sources/Sentry/SentrySubClassFinder.m 92.682% <100.000%> (-0.341%) ⬇️
.../Sentry/SentryUIViewControllerPerformanceTracker.m 99.074% <100.000%> (+0.040%) ⬆️
Sources/Sentry/SentryUIViewControllerSwizzling.m 88.018% <100.000%> (+0.399%) ⬆️
...grations/Performance/SwizzleClassNameExclude.swift 100.000% <100.000%> (ø)
...entryUIViewControllerPerformanceTrackerTests.swift 98.030% <100.000%> (+0.053%) ⬆️
...troller/SentryUIViewControllerSwizzlingTests.swift 98.947% <100.000%> (+0.022%) ⬆️

... and 16 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 913fab7...feaec67. Read the comment docs.

Copy link

github-actions bot commented Oct 7, 2024

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1244.17 ms 1256.02 ms 11.85 ms
Size 21.58 KiB 704.24 KiB 682.66 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
5616e0a 1224.12 ms 1249.86 ms 25.74 ms
94b89eb 1236.08 ms 1264.58 ms 28.50 ms
265f000 1232.96 ms 1249.10 ms 16.15 ms
e0f077c 1224.65 ms 1243.52 ms 18.87 ms
e998fd0 1254.41 ms 1272.78 ms 18.37 ms
78d5983 1229.98 ms 1245.60 ms 15.62 ms
efb0147 1245.26 ms 1266.94 ms 21.68 ms
f79ec31 1235.18 ms 1255.38 ms 20.20 ms
bbe89d8 1239.18 ms 1250.46 ms 11.28 ms
d6ff82c 1219.06 ms 1244.31 ms 25.24 ms

App size

Revision Plain With Sentry Diff
5616e0a 22.85 KiB 407.44 KiB 384.59 KiB
94b89eb 20.76 KiB 399.20 KiB 378.43 KiB
265f000 21.58 KiB 616.76 KiB 595.18 KiB
e0f077c 22.85 KiB 412.59 KiB 389.74 KiB
e998fd0 21.58 KiB 414.59 KiB 393.01 KiB
78d5983 20.76 KiB 427.80 KiB 407.04 KiB
efb0147 22.84 KiB 403.52 KiB 380.67 KiB
f79ec31 21.58 KiB 544.72 KiB 523.14 KiB
bbe89d8 20.76 KiB 435.66 KiB 414.90 KiB
d6ff82c 21.58 KiB 616.14 KiB 594.56 KiB

Previous results on branch: fix/swizzle-class-name-exclude

Startup times

Revision Plain With Sentry Diff
1ab4dc1 1232.12 ms 1251.65 ms 19.52 ms
1c20131 1232.33 ms 1255.73 ms 23.40 ms

App size

Revision Plain With Sentry Diff
1ab4dc1 21.58 KiB 730.53 KiB 708.95 KiB
1c20131 21.58 KiB 729.65 KiB 708.07 KiB

The SDK didn't exclude the RootViewController from swizzling when
ignored by the option swizzleClassNameExclude. This is fixed now.

Fixes GH-4385
Copy link

github-actions bot commented Oct 8, 2024

🚨 Detected changes in high risk code 🚨

High-risk code can easily blow up and is hard to test. We had severe bugs in the past. Be extra careful when changing these files, and have an extra careful look at these:

  • Sources/Sentry/SentrySubClassFinder.m
  • Sources/Sentry/SentryUIViewControllerSwizzling.m

Copy link

github-actions bot commented Oct 8, 2024

🚨 Detected changes in high risk code 🚨

High-risk code can easily blow up and is hard to test. We had severe bugs in the past. Be extra careful when changing these files, and have an extra careful look at these:

  • Sources/Sentry/SentrySubClassFinder.m
  • Sources/Sentry/SentryUIViewControllerSwizzling.m

Copy link

github-actions bot commented Oct 8, 2024

🚨 Detected changes in high risk code 🚨

High-risk code can easily blow up and is hard to test. We had severe bugs in the past. Be extra careful when changing these files, and have an extra careful look at these:

  • Sources/Sentry/SentrySubClassFinder.m
  • Sources/Sentry/SentryUIViewControllerSwizzling.m

Copy link

github-actions bot commented Oct 8, 2024

🚨 Detected changes in high risk code 🚨

High-risk code can easily blow up and is hard to test. We had severe bugs in the past. Be extra careful when changing these files, and have an extra careful look at these:

  • Sources/Sentry/SentrySubClassFinder.m
  • Sources/Sentry/SentryUIViewControllerSwizzling.m

@philipphofmann philipphofmann merged commit 9cd19dd into main Oct 8, 2024
65 checks passed
@philipphofmann philipphofmann deleted the fix/swizzle-class-name-exclude branch October 8, 2024 13:22
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.

swizzleClassNameExcludes is ignored for loadView
2 participants