getsentry / sentry-dart

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

fix: load contexts not setting the user #2089

Closed buenaflor closed 3 months ago

buenaflor commented 3 months ago

:scroll: Description

By default the user's ip address is now {{auto}} so the user object is never null, however when loading the native context we check if user == null then we retrieve it. and by default we get the ID that way. but since the user is never null now by default, we don't retrieve it anymore.

https://github.com/getsentry/sentry-dart/blob/main/flutter/lib/src/integrations/load_contexts_integration.dart#L113

Solution: move setting the default ipAddress to after the event processors have run

:bulb: Motivation and Context

Fixes #2062

:green_heart: How did you test it?

Added another test + manual testing

:pencil: Checklist

:crystal_ball: Next steps

codecov[bot] commented 3 months ago

Codecov Report

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

Project coverage is 95.25%. Comparing base (0b22d2d) to head (6ebd295).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2089 +/- ## ======================================= Coverage 95.25% 95.25% ======================================= Files 54 54 Lines 1791 1791 ======================================= Hits 1706 1706 Misses 85 85 ```

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

github-actions[bot] commented 3 months ago

Android Performance metrics :rocket:

  Plain With Sentry Diff
Startup time 375.50 ms 453.22 ms 77.72 ms
Size 6.35 MiB 7.34 MiB 1008.36 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
8f88a49d613434f898cd280880fbd122370dfffa 364.98 ms 413.78 ms 48.80 ms
daa1b330099908feace526008680693a69587afc 366.98 ms 451.59 ms 84.61 ms
04db237c887e97fd4e5843a50e97135e2e03ce53 330.16 ms 428.38 ms 98.22 ms
afa6e2a6ded2f7dbb4530fe3974fdbb30db1f914 349.73 ms 428.48 ms 78.75 ms
e2d89fc73b84c81801b638f4be7c488d53b7960d 323.84 ms 376.23 ms 52.39 ms
86d48419a55b5e88a17d31b0574e7e2974d4c18b 286.35 ms 372.43 ms 86.08 ms
8609bd8dd7ea572e5d241a59643c7570e5621bda 359.76 ms 437.40 ms 77.64 ms
72dfc836ec6ac6176efb374c4c1c3e3871f4117e 298.62 ms 340.14 ms 41.52 ms
870f5ebb0389ee8870a702da61188f0c7826b7e1 329.45 ms 369.29 ms 39.84 ms
f79eecfc96c81e45b312c72aea32e4943329666b 341.35 ms 388.98 ms 47.63 ms

App size

Revision Plain With Sentry Diff
8f88a49d613434f898cd280880fbd122370dfffa 6.34 MiB 7.30 MiB 979.60 KiB
daa1b330099908feace526008680693a69587afc 6.27 MiB 7.20 MiB 956.36 KiB
04db237c887e97fd4e5843a50e97135e2e03ce53 5.94 MiB 6.95 MiB 1.01 MiB
afa6e2a6ded2f7dbb4530fe3974fdbb30db1f914 6.27 MiB 7.20 MiB 955.69 KiB
e2d89fc73b84c81801b638f4be7c488d53b7960d 6.06 MiB 7.03 MiB 989.37 KiB
86d48419a55b5e88a17d31b0574e7e2974d4c18b 6.15 MiB 7.13 MiB 1000.49 KiB
8609bd8dd7ea572e5d241a59643c7570e5621bda 6.27 MiB 7.20 MiB 959.07 KiB
72dfc836ec6ac6176efb374c4c1c3e3871f4117e 5.94 MiB 6.92 MiB 1001.71 KiB
870f5ebb0389ee8870a702da61188f0c7826b7e1 5.94 MiB 6.92 MiB 1005.77 KiB
f79eecfc96c81e45b312c72aea32e4943329666b 6.15 MiB 7.13 MiB 1000.07 KiB

Previous results on branch: fix/affected-user-metric

Startup times

Revision Plain With Sentry Diff
4182952c3e5365358e59b5c806c3251d7cba6346 371.37 ms 441.41 ms 70.04 ms
e42f0697f760f48c1d8d1f20cddbc0f185a87ac1 370.96 ms 450.21 ms 79.26 ms
39b67f2cab2d9cc926ab545707654799970a0b97 444.76 ms 522.12 ms 77.37 ms
77e659f1ff8a69335c6932e9bea56e130364ef26 426.14 ms 491.68 ms 65.54 ms
d14f2064cd288d4e6b24923e05cfc7100623e437 410.54 ms 487.51 ms 76.97 ms

App size

Revision Plain With Sentry Diff
4182952c3e5365358e59b5c806c3251d7cba6346 6.35 MiB 7.34 MiB 1008.09 KiB
e42f0697f760f48c1d8d1f20cddbc0f185a87ac1 6.35 MiB 7.34 MiB 1008.08 KiB
39b67f2cab2d9cc926ab545707654799970a0b97 6.35 MiB 7.33 MiB 1006.04 KiB
77e659f1ff8a69335c6932e9bea56e130364ef26 6.35 MiB 7.34 MiB 1008.08 KiB
d14f2064cd288d4e6b24923e05cfc7100623e437 6.35 MiB 7.34 MiB 1008.08 KiB
github-actions[bot] commented 3 months ago

iOS Performance metrics :rocket:

  Plain With Sentry Diff
Startup time 1216.92 ms 1243.81 ms 26.89 ms
Size 8.33 MiB 9.55 MiB 1.21 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
3f23617e3346caa128c5f27b9c935de4974c3067 1261.93 ms 1286.10 ms 24.17 ms
ca7f531d8ef46d53d71b084884c27cae425de945 1242.51 ms 1282.61 ms 40.10 ms
d78342459141e1798a213da74ad13e89235cbe31 1265.71 ms 1277.00 ms 11.29 ms
754cdbe8e837db0c3e8d6cebf13feee66f651444 1261.67 ms 1280.88 ms 19.20 ms
a7acb24b1deda7eb424909eeb9e0f6897cba2cf0 1296.71 ms 1317.69 ms 20.98 ms
f2db4ece59961760d0017bb7b0592fc561ab79f0 1244.14 ms 1259.79 ms 15.65 ms
25e9b5900ecb2ddc682fe68375964943fe087595 1289.76 ms 1295.27 ms 5.51 ms
683fd34f35c964a36534f6df6b3d4cb325f5069c 1239.83 ms 1259.08 ms 19.25 ms
b8562d01376a7efe9af802ab0abd9d8226eb4bd7 1249.92 ms 1267.56 ms 17.64 ms
3e9fb0ef61113312be4c21d9168d4043eca6c921 1262.49 ms 1280.65 ms 18.16 ms

App size

Revision Plain With Sentry Diff
3f23617e3346caa128c5f27b9c935de4974c3067 8.16 MiB 9.17 MiB 1.01 MiB
ca7f531d8ef46d53d71b084884c27cae425de945 8.32 MiB 9.38 MiB 1.06 MiB
d78342459141e1798a213da74ad13e89235cbe31 8.29 MiB 9.38 MiB 1.09 MiB
754cdbe8e837db0c3e8d6cebf13feee66f651444 8.29 MiB 9.37 MiB 1.08 MiB
a7acb24b1deda7eb424909eeb9e0f6897cba2cf0 8.16 MiB 9.17 MiB 1.01 MiB
f2db4ece59961760d0017bb7b0592fc561ab79f0 8.10 MiB 9.16 MiB 1.07 MiB
25e9b5900ecb2ddc682fe68375964943fe087595 8.16 MiB 9.15 MiB 1021.15 KiB
683fd34f35c964a36534f6df6b3d4cb325f5069c 8.28 MiB 9.34 MiB 1.06 MiB
b8562d01376a7efe9af802ab0abd9d8226eb4bd7 8.33 MiB 9.54 MiB 1.22 MiB
3e9fb0ef61113312be4c21d9168d4043eca6c921 8.15 MiB 9.12 MiB 989.77 KiB

Previous results on branch: fix/affected-user-metric

Startup times

Revision Plain With Sentry Diff
e42f0697f760f48c1d8d1f20cddbc0f185a87ac1 1249.78 ms 1266.40 ms 16.62 ms
39b67f2cab2d9cc926ab545707654799970a0b97 1238.86 ms 1258.29 ms 19.43 ms
d14f2064cd288d4e6b24923e05cfc7100623e437 1226.80 ms 1247.76 ms 20.96 ms
4182952c3e5365358e59b5c806c3251d7cba6346 1256.10 ms 1277.30 ms 21.20 ms

App size

Revision Plain With Sentry Diff
e42f0697f760f48c1d8d1f20cddbc0f185a87ac1 8.33 MiB 9.55 MiB 1.21 MiB
39b67f2cab2d9cc926ab545707654799970a0b97 8.33 MiB 9.54 MiB 1.22 MiB
d14f2064cd288d4e6b24923e05cfc7100623e437 8.33 MiB 9.55 MiB 1.21 MiB
4182952c3e5365358e59b5c806c3251d7cba6346 8.33 MiB 9.55 MiB 1.21 MiB