sentry-dart
sentry-dart copied to clipboard
add multiview helper to make the sentry multiview aware.
:scroll: Description
Currently, the Sentry Dart Plugin does not completely support the new multi-view feature for the web. Especially the SentryScreenshotWidget,SentryUserInteractionWidget and the WidgetsBindingIntegrationare incompatible.
Therefore we deactivate these features if we detect a multi-view application.
To find out if multiViewEnabled is set in the flutter_bootstrap.js I check the PlatformDispatcher.instance.implicitView return value.
In a regular non multiview app PlatformDispatcher.instance.implicitView returns a FlutterView object. If you try to call PlatformDispatcher.instance.implicitView you receive null. This is also explained here in the Flutter Docs
An alternative approach I found out, could be accessing the __flutterState object and look at the elements. In a regular non multiview application the first element is always a meta event.
For a MultiView App the
__flutterState only contains flutter-view elements for the number of active views.
In this example, there were two active views:
:bulb: Motivation and Context
Based on the discussion here I added a MultiViewHelper, which is only active for the Web Platform.
:green_heart: How did you test it?
local
:pencil: Checklist
- [x] I reviewed submitted code
- [ ] I added tests to verify changes
- [x] No new PII added or SDK only sends newly added PII if
sendDefaultPiiis enabled - [x] I updated the docs if needed
- [x] All tests passing
- [x] No breaking changes
:crystal_ball: Next steps
| Messages | |
|---|---|
| :book: | Do not forget to update Sentry-docs with your feature once the pull request gets approved. |
Generated by :no_entry_sign: dangerJS against bb385c516c3063a5f83a9817e30072aedf42e420
Codecov Report
Attention: Patch coverage is 81.81818% with 6 lines in your changes missing coverage. Please review.
Project coverage is 92.09%. Comparing base (
d7dc4e5) to head (bb385c5). Report is 1 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| ...ter/lib/src/utils/platform_dispatcher_wrapper.dart | 60.00% | 6 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #2366 +/- ##
==========================================
+ Coverage 88.98% 92.09% +3.10%
==========================================
Files 262 91 -171
Lines 8906 2946 -5960
==========================================
- Hits 7925 2713 -5212
+ Misses 981 233 -748
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Android Performance metrics :rocket:
| Plain | With Sentry | Diff | |
|---|---|---|---|
| Startup time | 435.59 ms | 501.94 ms | 66.35 ms |
| Size | 6.46 MiB | 7.48 MiB | 1.02 MiB |
Baseline results on branch: main
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 905bf99d7744be37601230aab5330a4e7c4aaa3f | 459.73 ms | 505.26 ms | 45.53 ms |
| 464b4d0afb863838e76307d3ea26f9d46df912ee | 320.71 ms | 380.02 ms | 59.31 ms |
| ea60f1069d6f61b271993984e324dd2bb104e580 | 456.23 ms | 494.48 ms | 38.25 ms |
| 1b0c8a3be09e06d28860933cadef8a6bf56a92dc | 479.78 ms | 521.18 ms | 41.40 ms |
| e893df57266c8bbe00cb0e1dfcc876875fc4debe | 310.60 ms | 380.58 ms | 69.98 ms |
| 0a23f9840336da9128fd8f15f1a373563820df64 | 377.19 ms | 416.18 ms | 39.00 ms |
| 691aa3b4663856a2ad6fbf24dec658b7f041d81a | 370.43 ms | 466.28 ms | 95.85 ms |
| 3e5ee375bd2c798addf97ddd5dac28201e4e1b8d | 317.56 ms | 366.84 ms | 49.28 ms |
| ca7f531d8ef46d53d71b084884c27cae425de945 | 395.69 ms | 497.82 ms | 102.12 ms |
| 4c13d972373dbb5d3070b60dc209f833d47bd2e3 | 455.34 ms | 509.42 ms | 54.08 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 905bf99d7744be37601230aab5330a4e7c4aaa3f | 6.49 MiB | 7.56 MiB | 1.07 MiB |
| 464b4d0afb863838e76307d3ea26f9d46df912ee | 6.06 MiB | 7.03 MiB | 990.27 KiB |
| ea60f1069d6f61b271993984e324dd2bb104e580 | 6.49 MiB | 7.55 MiB | 1.07 MiB |
| 1b0c8a3be09e06d28860933cadef8a6bf56a92dc | 6.49 MiB | 7.57 MiB | 1.08 MiB |
| e893df57266c8bbe00cb0e1dfcc876875fc4debe | 6.06 MiB | 7.09 MiB | 1.03 MiB |
| 0a23f9840336da9128fd8f15f1a373563820df64 | 6.06 MiB | 7.03 MiB | 996.97 KiB |
| 691aa3b4663856a2ad6fbf24dec658b7f041d81a | 5.94 MiB | 6.96 MiB | 1.02 MiB |
| 3e5ee375bd2c798addf97ddd5dac28201e4e1b8d | 5.94 MiB | 6.92 MiB | 1001.19 KiB |
| ca7f531d8ef46d53d71b084884c27cae425de945 | 6.33 MiB | 7.26 MiB | 949.75 KiB |
| 4c13d972373dbb5d3070b60dc209f833d47bd2e3 | 6.49 MiB | 7.56 MiB | 1.07 MiB |
Previous results on branch: feat/multiview-aware
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 2baf2a4f92583e68dd8c719bdf4bd95de94b1abf | 414.65 ms | 505.75 ms | 91.10 ms |
| be2b2dedae8a88000efb5d058626d23ded6c42b4 | 411.65 ms | 507.57 ms | 95.93 ms |
| df169ab9d2bf45b905c2e015a1c7a115494e7751 | 452.48 ms | 559.46 ms | 106.98 ms |
| 1d57db23026feb0126e9d1bbc70f1d00e7c13d53 | 542.49 ms | 649.24 ms | 106.75 ms |
| 72556e0260ade4776e97c2f58cacf3214c442da4 | 401.20 ms | 502.86 ms | 101.66 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 2baf2a4f92583e68dd8c719bdf4bd95de94b1abf | 6.46 MiB | 7.48 MiB | 1.02 MiB |
| be2b2dedae8a88000efb5d058626d23ded6c42b4 | 6.46 MiB | 7.48 MiB | 1.03 MiB |
| df169ab9d2bf45b905c2e015a1c7a115494e7751 | 6.46 MiB | 7.48 MiB | 1.03 MiB |
| 1d57db23026feb0126e9d1bbc70f1d00e7c13d53 | 6.46 MiB | 7.48 MiB | 1.03 MiB |
| 72556e0260ade4776e97c2f58cacf3214c442da4 | 6.46 MiB | 7.48 MiB | 1.02 MiB |
iOS Performance metrics :rocket:
| Plain | With Sentry | Diff | |
|---|---|---|---|
| Startup time | 1257.08 ms | 1268.57 ms | 11.49 ms |
| Size | 8.42 MiB | 9.91 MiB | 1.49 MiB |
Baseline results on branch: main
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 95c69e3311709c4a455d2c8b8d964ad11fc6fdd7 | 1223.94 ms | 1245.29 ms | 21.35 ms |
| 09c1f550c470c27444a89744002ef7ba6f65dbeb | 1258.11 ms | 1280.45 ms | 22.34 ms |
| 49a149b6624c052f31433241245b0c8b7a2194e0 | 1296.47 ms | 1320.20 ms | 23.73 ms |
| bffc2c57d27178214d7b567c9abbf911a4f61801 | 1239.76 ms | 1264.67 ms | 24.92 ms |
| b49bf00106d9589f78f4967539f5d7a99cc1e973 | 1248.00 ms | 1260.35 ms | 12.35 ms |
| a60913453866bc81901784aec6fa8aad023135f8 | 1254.50 ms | 1265.08 ms | 10.58 ms |
| d1488a1bce9359342af5062f910a087dc2250e6e | 1234.02 ms | 1244.98 ms | 10.96 ms |
| a24a1dbf1d0fdb00416b46a20a819e04c48f52a4 | 1257.71 ms | 1271.57 ms | 13.87 ms |
| 905bf99d7744be37601230aab5330a4e7c4aaa3f | 1240.84 ms | 1271.47 ms | 30.63 ms |
| 9da696df2d576d3a2ed069249da7eaed5441c653 | 1253.91 ms | 1267.68 ms | 13.77 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 95c69e3311709c4a455d2c8b8d964ad11fc6fdd7 | 8.33 MiB | 9.64 MiB | 1.31 MiB |
| 09c1f550c470c27444a89744002ef7ba6f65dbeb | 8.38 MiB | 9.74 MiB | 1.36 MiB |
| 49a149b6624c052f31433241245b0c8b7a2194e0 | 8.15 MiB | 9.12 MiB | 986.26 KiB |
| bffc2c57d27178214d7b567c9abbf911a4f61801 | 8.33 MiB | 9.40 MiB | 1.07 MiB |
| b49bf00106d9589f78f4967539f5d7a99cc1e973 | 8.10 MiB | 9.08 MiB | 1004.36 KiB |
| a60913453866bc81901784aec6fa8aad023135f8 | 8.16 MiB | 9.16 MiB | 1.01 MiB |
| d1488a1bce9359342af5062f910a087dc2250e6e | 8.42 MiB | 9.89 MiB | 1.47 MiB |
| a24a1dbf1d0fdb00416b46a20a819e04c48f52a4 | 8.42 MiB | 9.91 MiB | 1.49 MiB |
| 905bf99d7744be37601230aab5330a4e7c4aaa3f | 8.38 MiB | 9.74 MiB | 1.36 MiB |
| 9da696df2d576d3a2ed069249da7eaed5441c653 | 8.42 MiB | 9.91 MiB | 1.49 MiB |
Previous results on branch: feat/multiview-aware
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 2baf2a4f92583e68dd8c719bdf4bd95de94b1abf | 1255.74 ms | 1276.96 ms | 21.22 ms |
| 72556e0260ade4776e97c2f58cacf3214c442da4 | 1254.58 ms | 1269.53 ms | 14.95 ms |
| be2b2dedae8a88000efb5d058626d23ded6c42b4 | 1263.27 ms | 1272.61 ms | 9.35 ms |
| df169ab9d2bf45b905c2e015a1c7a115494e7751 | 1239.88 ms | 1259.89 ms | 20.02 ms |
| 1d57db23026feb0126e9d1bbc70f1d00e7c13d53 | 1245.47 ms | 1253.96 ms | 8.49 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 2baf2a4f92583e68dd8c719bdf4bd95de94b1abf | 8.42 MiB | 9.91 MiB | 1.49 MiB |
| 72556e0260ade4776e97c2f58cacf3214c442da4 | 8.42 MiB | 9.91 MiB | 1.49 MiB |
| be2b2dedae8a88000efb5d058626d23ded6c42b4 | 8.42 MiB | 9.91 MiB | 1.49 MiB |
| df169ab9d2bf45b905c2e015a1c7a115494e7751 | 8.42 MiB | 9.91 MiB | 1.49 MiB |
| 1d57db23026feb0126e9d1bbc70f1d00e7c13d53 | 8.42 MiB | 9.91 MiB | 1.49 MiB |
I'll put this PR into blocked until we can properly test it. Until then we will rely on docs to keep users informed about what to disable to make multiview work
I'll add an integration test for this
@buenaflor what do you recommend should this test cover?
@denrase I was thinking about creating a new app that has multiview enabled with an integration test that checks if the relevant sentry integrations are disabled but probably thats too much work, wdyt
otherwise what we could do is add an addition web integration_test case where we check that these integrations ScreenshotIntegration, WidgetsBindingIntegration are not disabled so we prevent potential regressions
I have already set up integration tests that run on web, see web_sdk_test.dart as an example