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

Feat/only send debug images referenced in the stacktrace for events #2329

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

martinhaintz
Copy link
Collaborator

📜 Description

Instead of sending all debug images in case of errors, we only want to send the referenced debug images of the stacktrace to be sent.

💡 Motivation and Context

close #1755

💚 How did you test it?

??

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPii is enabled
  • I updated the docs if needed
  • All tests passing
  • No breaking changes

🔮 Next steps

Copy link
Contributor

github-actions bot commented Oct 7, 2024

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 2cc98f6

Copy link

codecov bot commented Oct 7, 2024

Codecov Report

Attention: Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 85.10%. Comparing base (f3a18f2) to head (2cc98f6).

Files with missing lines Patch % Lines
flutter/lib/src/native/sentry_native_channel.dart 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2329      +/-   ##
==========================================
+ Coverage   84.81%   85.10%   +0.29%     
==========================================
  Files         253       79     -174     
  Lines        9054     2786    -6268     
==========================================
- Hits         7679     2371    -5308     
+ Misses       1375      415     -960     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@martinhaintz
Copy link
Collaborator Author

@buenaflor any ideas, what would be the best way to test this? print and log are disabled in Flutter for release builds.

Copy link
Contributor

github-actions bot commented Oct 7, 2024

Android Performance metrics 🚀

  Plain With Sentry Diff
Startup time 424.36 ms 472.90 ms 48.54 ms
Size 6.49 MiB 7.57 MiB 1.08 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
7273303 415.33 ms 491.51 ms 76.18 ms
a609134 350.12 ms 404.12 ms 54.00 ms
21d4150 379.31 ms 449.23 ms 69.93 ms
78eeed5 298.35 ms 361.63 ms 63.28 ms
5f443de 412.30 ms 491.67 ms 79.37 ms
50bdfad 395.22 ms 461.21 ms 65.98 ms
9555112 448.81 ms 488.89 ms 40.08 ms
c57d3b7 413.56 ms 508.80 ms 95.24 ms
d783424 302.08 ms 368.10 ms 66.02 ms
d189e01 328.67 ms 397.12 ms 68.45 ms

App size

Revision Plain With Sentry Diff
7273303 6.34 MiB 7.29 MiB 970.36 KiB
a609134 5.94 MiB 6.95 MiB 1.01 MiB
21d4150 5.94 MiB 6.97 MiB 1.03 MiB
78eeed5 6.16 MiB 7.14 MiB 1009.97 KiB
5f443de 6.35 MiB 7.34 MiB 1008.00 KiB
50bdfad 6.33 MiB 7.30 MiB 987.47 KiB
9555112 6.52 MiB 7.59 MiB 1.06 MiB
c57d3b7 6.33 MiB 7.30 MiB 992.08 KiB
d783424 6.16 MiB 7.14 MiB 1007.48 KiB
d189e01 6.16 MiB 7.14 MiB 1009.90 KiB

Previous results on branch: feat/only-send-debug-images-referenced-in-the-stacktrace-for-events

Startup times

Revision Plain With Sentry Diff
18890a0 500.08 ms 537.72 ms 37.64 ms
ad79f89 503.92 ms 507.65 ms 3.74 ms
fa97c64 472.71 ms 530.63 ms 57.92 ms
bad0c67 463.64 ms 517.10 ms 53.46 ms
0fef294 469.37 ms 509.82 ms 40.45 ms

App size

Revision Plain With Sentry Diff
18890a0 6.49 MiB 7.57 MiB 1.08 MiB
ad79f89 6.49 MiB 7.56 MiB 1.07 MiB
fa97c64 6.49 MiB 7.56 MiB 1.07 MiB
bad0c67 6.49 MiB 7.56 MiB 1.07 MiB
0fef294 6.49 MiB 7.56 MiB 1.07 MiB

Copy link
Contributor

github-actions bot commented Oct 7, 2024

iOS Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1250.93 ms 1273.89 ms 22.96 ms
Size 8.38 MiB 9.75 MiB 1.37 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
333903e 1251.15 ms 1270.21 ms 19.06 ms
d53c6fa 1254.86 ms 1270.83 ms 15.97 ms
b66cc27 1249.64 ms 1275.57 ms 25.94 ms
bf8d36c 1238.33 ms 1258.71 ms 20.38 ms
ffae3e3 1215.82 ms 1238.49 ms 22.67 ms
6fedcab 1242.33 ms 1269.66 ms 27.33 ms
ba9c106 1241.76 ms 1265.15 ms 23.40 ms
bc29768 1247.25 ms 1268.63 ms 21.38 ms
a4c4f8c 1217.77 ms 1245.88 ms 28.11 ms
3e5078c 1239.73 ms 1248.69 ms 8.96 ms

App size

Revision Plain With Sentry Diff
333903e 8.10 MiB 9.16 MiB 1.06 MiB
d53c6fa 8.29 MiB 9.39 MiB 1.10 MiB
b66cc27 8.38 MiB 9.74 MiB 1.36 MiB
bf8d36c 8.38 MiB 9.74 MiB 1.36 MiB
ffae3e3 8.28 MiB 9.33 MiB 1.05 MiB
6fedcab 8.32 MiB 9.50 MiB 1.18 MiB
ba9c106 8.32 MiB 9.38 MiB 1.06 MiB
bc29768 8.32 MiB 9.38 MiB 1.05 MiB
a4c4f8c 8.38 MiB 9.74 MiB 1.36 MiB
3e5078c 8.28 MiB 9.34 MiB 1.06 MiB

Previous results on branch: feat/only-send-debug-images-referenced-in-the-stacktrace-for-events

Startup times

Revision Plain With Sentry Diff
ad79f89 1258.51 ms 1281.02 ms 22.51 ms
fa97c64 1264.96 ms 1289.26 ms 24.30 ms
bad0c67 1252.14 ms 1262.27 ms 10.13 ms
18890a0 1252.71 ms 1274.23 ms 21.51 ms
0fef294 1228.18 ms 1237.88 ms 9.69 ms

App size

Revision Plain With Sentry Diff
ad79f89 8.38 MiB 9.75 MiB 1.37 MiB
fa97c64 8.38 MiB 9.74 MiB 1.36 MiB
bad0c67 8.38 MiB 9.74 MiB 1.36 MiB
18890a0 8.38 MiB 9.75 MiB 1.37 MiB
0fef294 8.38 MiB 9.74 MiB 1.36 MiB

Copy link
Contributor

@buenaflor buenaflor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a quick look and fixed it locally. here's several things that went wrong:

  • platform channels do not support Set, read here about the supported types, which means we need to use List to pass the instruction addresses from flutter to native. We can continue using sets when parsing the addresses but when communicating between platform layers these need to be converted to List. generally this may be something that we can improve for type safety when interacting through platform channels. I was surprised that this didn't trigger any error or warning
  • UInt64(instructionAddr) is not correct because the base it uses to convert the String is base 10 but the instruction addresses we are dealing with are hex so we need to adjust the radix/base to 16 => UInt64(instructionAddr, radix: 16) but this won't still work because the instruction addresses we pass in contain the 0x prefix which we also need to remove before we convert it to UInt64
  • In the native channel loadDebugImages function you changed Map<dynamic, dynamic> to Map<dynamic, Set<String>> which doesn't work because DebugMeta fields won't match this
  • if the debug images that we parsed from the stacktrace is empty, we should always return all debug images with PrivateSentrySDKOnly.getDebugImages(). This did not work because it was only triggered by the condition if the passed instruction addresses are null or empty and not if the parsed images afterwards are empty

flutter/ios/Classes/SentryFlutterPluginApple.swift Outdated Show resolved Hide resolved
flutter/ios/Classes/SentryFlutterPluginApple.swift Outdated Show resolved Hide resolved
flutter/ios/Classes/SentryFlutterPluginApple.swift Outdated Show resolved Hide resolved
flutter/lib/src/native/sentry_native_channel.dart Outdated Show resolved Hide resolved
flutter/lib/src/native/sentry_native_binding.dart Outdated Show resolved Hide resolved
martinhaintz and others added 7 commits October 11, 2024 11:05
Co-authored-by: Giancarlo Buenaflor <giancarlo_buenaflor@yahoo.com>
Co-authored-by: Giancarlo Buenaflor <giancarlo_buenaflor@yahoo.com>
Co-authored-by: Giancarlo Buenaflor <giancarlo_buenaflor@yahoo.com>
Co-authored-by: Giancarlo Buenaflor <giancarlo_buenaflor@yahoo.com>
Co-authored-by: Giancarlo Buenaflor <giancarlo_buenaflor@yahoo.com>
Co-authored-by: Giancarlo Buenaflor <giancarlo_buenaflor@yahoo.com>
Copy link
Contributor

🚨 Detected changes in high risk code 🚨

High-risk code has higher potential to break the SDK and may be hard to test. To prevent severe bugs, apply the rollout process for releasing such changes and be extra careful when changing and reviewing these files:

  • flutter/ios/Classes/SentryFlutterPluginApple.swift

@martinhaintz martinhaintz marked this pull request as ready for review October 11, 2024 16:57
@martinhaintz martinhaintz enabled auto-merge (squash) October 11, 2024 16:58
@getsentry getsentry deleted a comment from github-actions bot Oct 11, 2024
@getsentry getsentry deleted a comment from github-actions bot Oct 11, 2024
@getsentry getsentry deleted a comment from github-actions bot Oct 11, 2024
@getsentry getsentry deleted a comment from github-actions bot Oct 11, 2024
@buenaflor
Copy link
Contributor

buenaflor commented Oct 14, 2024

as per this comment we will not use getDebugImagesForAddresses due to performance reasons.

Instead we should use SentryDebugImageProvider.getDebugImagesFromCacheForFrames or SentryDebugImageProvider. getDebugImagesFromCacheForThreads, however I think the former is the one more suited for us which will be part of Sentry Cocoa 8.39.0.

This PR is blocked until cocoa 8.39.0 is released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Only send debug images referenced in the stacktrace for events
3 participants