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

Source Context support if not using split-debug-info #1314

Open
Tracked by #42
marandaneto opened this issue Mar 7, 2023 · 6 comments
Open
Tracked by #42

Source Context support if not using split-debug-info #1314

marandaneto opened this issue Mar 7, 2023 · 6 comments

Comments

@marandaneto
Copy link
Contributor

marandaneto commented Mar 7, 2023

Description

Sentry already offers Source context support but only when using split-debug-info as well.
https://docs.sentry.io/platforms/flutter/troubleshooting/#source-context

This issue is to make it possible without the split-debug-info as well.
This would need changes in the SDK related to SentryStackFrame#fileName and/or SentryStackFrame#absPath cus we strip the path to the last segment due to PII.

It might need changes on https://github.com/getsentry/symbolicator as well.

For context: what is source context.

@vaind
Copy link
Collaborator

vaind commented Mar 19, 2023

SentryStackFrame#absPath cus we strip the path to the last segment due to PII.

Just wanted to say paths to source files/debug files aren't considered PII in other SDKs, AFAICT. Nor are they stripped from the debug-files during upload of course because that would render them useless.

@marandaneto
Copy link
Contributor Author

SentryStackFrame#absPath cus we strip the path to the last segment due to PII.

Just wanted to say paths to source files/debug files aren't considered PII in other SDKs, AFAICT. Nor are they stripped from the debug-files during upload of course because that would render them useless.

I recall asking this back then and it was considered PII, I will double-check this.

@marandaneto
Copy link
Contributor Author

marandaneto commented Apr 24, 2023

Ps: Right now the absPath is the very same as fileName which is just the last segment of the Frame.uri, for example: dart:ui/hooks.dart becomes hooks.dart, I've changed to the full Uri to test it out.

For Flutter, the absPath will have then the format below:

dart:ui/hooks.dart (from the Dart SDK itself)
package:flutter/src/gestures/binding.dart (from the Flutter SDK itself)
package:sentry_flutter_example/main.dart (from the App itself)

Right now we don't send the debug image list if the app isn't compiled with split-debug-info.
I've changed that to test it and it results in all the debug images Unreferenced since the frames don't contain the instructionAddr, so they are not processed at all.

instructionAddr is only available if the Frame is of the type UnparsedFrame which means the app was compiled with split-debug-info.

The debug files if no split-debug-info is passed don't have sources:

Debug Info File Check
Type: elf library
Contained debug identifiers:
> Debug ID: bf4aa6bc-f74c-57b6-3475-8117432454de
Code ID: bca64abf4cf7b65734758117432454de
Arch: arm64
Contained debug information:
> symtab, unwind
Usable: yes

When using split-debug-info:

Debug Info File Check
Type: elf debug companion
Contained debug identifiers:
> Debug ID: bf4aa6bc-1cde-fefb-31bb-8f1cd6036d60
Code ID: bca64abfde1cfbfe31bb8f1cd6036d60
Arch: arm64
Contained debug information:
> symtab, debug
Usable: yes

When using split-debug-info AND obfuscate:

Debug Info File Check
Type: elf debug companion
Contained debug identifiers:
> Debug ID: bf4aa6bc-7bfc-1709-31bb-8f1c3e639eb9
Code ID: bca64abffc7b091731bb8f1c3e639eb9
Arch: arm64
Contained debug information:
> symtab, debug
Usable: yes

So only when using split-debug-info either alone or with obfuscate has the debug information.

When compiling the Flutter app without split-debug-info but with debug, the debug file has the debug info instead of only symtab and unwind, but that is irrelevant because each build has its own debug Ids and codeIds.

@marandaneto
Copy link
Contributor Author

Seems like supporting Source code context for apps not using split-debug-info would require quite a bit of work, probably making our own version of source bundle or loading source code context directly from GH using heuristics to determine the file path of each file, based on the given absPath.

Flutter is pushing to make the adoption of split-debug-info more and more due to better optimizations and smaller bundle sizes, not sure if it's worth the effort.
https://docs.flutter.dev/deployment/obfuscate#obfuscating-your-app
https://docs.flutter.dev/perf/app-size#reducing-app-size

@vaind
Copy link
Collaborator

vaind commented Apr 24, 2023

For completeness, copy-pasting our conversation from Discord
image

TLDR;

  • we need a "debug id" that would be stored during app build in dart code and sent over when reporting frames - achievable e.g. by --dart-define - this could be called by starting flutter build through the sentry_dart_plugin. The plugin would use the same debug id when creating a source bundle and uploading to Sentry.
  • sentry-cli needs to be updated to support creating source-bundles with custom debug IDs.
  • symbolicator may need an update to resolve these paths

@marandaneto
Copy link
Contributor Author

FE already does something similar with the absPath -> package heuristics https://github.com/getsentry/sentry/blob/0260a8769124adad82ada598ed960b36468bf233/src/sentry/utils/event_frames.py#L59-L79
This is for Stack Trace Linking IIRC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

4 participants