getsentry / sentry-dart

Sentry SDK for Dart and Flutter
https://sentry.io/for/flutter/
MIT License
766 stars 239 forks source link

fix: context defualts on native platforms other than iOS/Android #2439

Closed vaind closed 3 days ago

vaind commented 1 week ago

:scroll: Description

I've noticed windows doesn't have device context filled in. It's because originally we expected native integrations to sync from native iOS/Android to dart via LoadContexts(). This is not available with sentry-native which doesn't have such APIs.

To fix this, I've changed the logic to always set contexts in IoEnricherEventProcessor and made it so that it runs after the native _LoadContextsIntegrationEventProcessor. This way, the former will fill in the blanks all the time.

:bulb: Motivation and Context

:green_heart: How did you test it?

:pencil: Checklist

:crystal_ball: Next steps

codecov[bot] commented 1 week ago

Codecov Report

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

Project coverage is 86.84%. Comparing base (7f97e6c) to head (068659d). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2439 +/- ## ========================================== - Coverage 86.92% 86.84% -0.08% ========================================== Files 259 259 Lines 9245 9246 +1 ========================================== - Hits 8036 8030 -6 - Misses 1209 1216 +7 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

github-actions[bot] commented 1 week ago

Android Performance metrics :rocket:

  Plain With Sentry Diff
Startup time 456.45 ms 493.58 ms 37.13 ms
Size 6.49 MiB 7.56 MiB 1.07 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
1ac008b595f39f8eb8d7c8d67df3f9db827b7c1e 370.04 ms 435.58 ms 65.54 ms
4ad2751b7824f5312c9ddd3374520e03aaf107b3 374.58 ms 462.00 ms 87.42 ms
43760f991fd70985663607059a73897fe3123966 321.78 ms 366.77 ms 44.99 ms
fec92cc66e26e4c4884781314753c8f4e739539d 399.96 ms 479.26 ms 79.30 ms
c9d3212f2912cb01a1648be804a482edeee6b791 301.34 ms 361.58 ms 60.24 ms
5603ab240ccb170067baf128345a92757ee5de64 309.84 ms 345.20 ms 35.36 ms
3e9fb0ef61113312be4c21d9168d4043eca6c921 329.14 ms 359.16 ms 30.02 ms
6d317ea0c2dcfba0d8300bc7693d2dc292486d01 303.46 ms 356.06 ms 52.60 ms
1a938255a9c0a1073ccebbdb23a70ea2d435013e 347.31 ms 424.54 ms 77.23 ms
bffc2c57d27178214d7b567c9abbf911a4f61801 348.00 ms 399.89 ms 51.89 ms

App size

Revision Plain With Sentry Diff
1ac008b595f39f8eb8d7c8d67df3f9db827b7c1e 6.33 MiB 7.27 MiB 954.13 KiB
4ad2751b7824f5312c9ddd3374520e03aaf107b3 6.16 MiB 7.14 MiB 1010.86 KiB
43760f991fd70985663607059a73897fe3123966 6.15 MiB 7.13 MiB 1000.49 KiB
fec92cc66e26e4c4884781314753c8f4e739539d 6.35 MiB 7.33 MiB 1005.56 KiB
c9d3212f2912cb01a1648be804a482edeee6b791 6.16 MiB 7.14 MiB 1010.90 KiB
5603ab240ccb170067baf128345a92757ee5de64 5.94 MiB 6.95 MiB 1.01 MiB
3e9fb0ef61113312be4c21d9168d4043eca6c921 5.94 MiB 6.95 MiB 1.01 MiB
6d317ea0c2dcfba0d8300bc7693d2dc292486d01 5.94 MiB 6.92 MiB 1001.74 KiB
1a938255a9c0a1073ccebbdb23a70ea2d435013e 6.27 MiB 7.20 MiB 956.36 KiB
bffc2c57d27178214d7b567c9abbf911a4f61801 6.34 MiB 7.28 MiB 966.31 KiB

Previous results on branch: fix/native-contexts-propagation

Startup times

Revision Plain With Sentry Diff
0344dd88921f62ebd4464ac8acf37c54d3f99555 475.67 ms 511.56 ms 35.89 ms
c3fa61f67a440386b43584c686c0869eb0aad409 457.23 ms 520.26 ms 63.03 ms
ca374dd2067e4381b42bb508d5ca7a3ff0950c8b 471.09 ms 508.68 ms 37.59 ms
0eae47f25e9cc7c3ddb05b7568a1dea75b68edf5 436.68 ms 472.85 ms 36.17 ms

App size

Revision Plain With Sentry Diff
0344dd88921f62ebd4464ac8acf37c54d3f99555 6.49 MiB 7.56 MiB 1.07 MiB
c3fa61f67a440386b43584c686c0869eb0aad409 6.49 MiB 7.56 MiB 1.07 MiB
ca374dd2067e4381b42bb508d5ca7a3ff0950c8b 6.49 MiB 7.56 MiB 1.07 MiB
0eae47f25e9cc7c3ddb05b7568a1dea75b68edf5 6.49 MiB 7.56 MiB 1.07 MiB
github-actions[bot] commented 1 week ago

iOS Performance metrics :rocket:

  Plain With Sentry Diff
Startup time 1236.82 ms 1246.08 ms 9.27 ms
Size 8.38 MiB 9.78 MiB 1.40 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
6f3717a084265d352ec706090ecfd2f3dc6337d5 1259.84 ms 1280.90 ms 21.06 ms
e6b16cd4aa51b0236a52f4c6380d53b6d1a1aee9 1226.20 ms 1246.52 ms 20.32 ms
8fa393466a5d478f281e46cbc11e66c2b3db12d8 1252.79 ms 1272.41 ms 19.62 ms
cc807145d186a99a58be0997ef14e4f55a27adc1 1205.53 ms 1223.90 ms 18.37 ms
0a82a1ee1ab16b08941011233f534636569d7543 1233.56 ms 1244.56 ms 11.00 ms
3334ac176f15a6d39b435960620ea9a4919aae79 1259.22 ms 1275.40 ms 16.17 ms
256df44bb670822fc3087877f775a3d82bb476b0 1252.49 ms 1274.27 ms 21.78 ms
cf91c9da10875feced1ae3de5a5cb4e9b0fa14f0 1217.08 ms 1233.00 ms 15.92 ms
b728df439473e146f8721c7555cd54728a93b6cb 1287.43 ms 1293.94 ms 6.51 ms
61e71ec84d02fc022b00615b4d0bae341a641502 1243.14 ms 1257.21 ms 14.07 ms

App size

Revision Plain With Sentry Diff
6f3717a084265d352ec706090ecfd2f3dc6337d5 8.33 MiB 9.62 MiB 1.29 MiB
e6b16cd4aa51b0236a52f4c6380d53b6d1a1aee9 8.33 MiB 9.54 MiB 1.22 MiB
8fa393466a5d478f281e46cbc11e66c2b3db12d8 8.09 MiB 9.07 MiB 1000.86 KiB
cc807145d186a99a58be0997ef14e4f55a27adc1 8.33 MiB 9.40 MiB 1.07 MiB
0a82a1ee1ab16b08941011233f534636569d7543 8.29 MiB 9.37 MiB 1.08 MiB
3334ac176f15a6d39b435960620ea9a4919aae79 8.10 MiB 9.17 MiB 1.08 MiB
256df44bb670822fc3087877f775a3d82bb476b0 8.38 MiB 9.71 MiB 1.33 MiB
cf91c9da10875feced1ae3de5a5cb4e9b0fa14f0 8.33 MiB 9.40 MiB 1.07 MiB
b728df439473e146f8721c7555cd54728a93b6cb 8.15 MiB 9.15 MiB 1020.72 KiB
61e71ec84d02fc022b00615b4d0bae341a641502 8.33 MiB 9.40 MiB 1.07 MiB

Previous results on branch: fix/native-contexts-propagation

Startup times

Revision Plain With Sentry Diff
0344dd88921f62ebd4464ac8acf37c54d3f99555 1252.76 ms 1267.66 ms 14.90 ms
c3fa61f67a440386b43584c686c0869eb0aad409 1242.08 ms 1267.04 ms 24.96 ms
0eae47f25e9cc7c3ddb05b7568a1dea75b68edf5 1246.22 ms 1267.33 ms 21.11 ms
ca374dd2067e4381b42bb508d5ca7a3ff0950c8b 1231.43 ms 1256.87 ms 25.45 ms

App size

Revision Plain With Sentry Diff
0344dd88921f62ebd4464ac8acf37c54d3f99555 8.38 MiB 9.77 MiB 1.40 MiB
c3fa61f67a440386b43584c686c0869eb0aad409 8.38 MiB 9.77 MiB 1.40 MiB
0eae47f25e9cc7c3ddb05b7568a1dea75b68edf5 8.38 MiB 9.77 MiB 1.40 MiB
ca374dd2067e4381b42bb508d5ca7a3ff0950c8b 8.38 MiB 9.78 MiB 1.40 MiB