getsentry / getsentry/sentry-dart

Flutter class types symbolication (AOT and Web)

Open
#1,565 3 comments 6 reactions 0 assignees View on GitHub
Dart Errors Feature symbolication
Dominant language
Dart
Stars
873
Forks
299
Avg merge
2d 7h
Merged PRs (30d)
30

Description

### Description

Depends on [https://github.com/getsentry/sentry-dart/issues/2805](), [https://github.com/dart-lang/sdk/issues/51941]()

For AOT-compiled apps, it's currently not possible to symbolicate class types because debug files don't contain the minified name to associate with the symbolicated name.
The very same problem exists with Flutter Web and source maps, the source maps contain the minified name but not the symbolicated name.

When compiling your Fluter app with obfuscation enabled, you can combine it with an extra parameter that spits out a mapping file (`--save-obfuscation-map`).

`flutter build ios --split-debug-info=symbols --obfuscate --extra-gen-snapshot-options=--save-obfuscation-map=mapping.json`

The `mapping.json` file contains the information we need to symbolicate class types.

This file should be uploaded to Sentry via the Dart plugin and Sentry CLI, then the Sentry symbolication process should take that into consideration, it's somehow similar to a proguard mapping file.

The first thing that should be symbolicated is the `exception.type` which is responsible for building the issue's titles as well.
We can expand that later on for VH, breadcrumbs, etc.

For Flutter Web, there's no way to associate the mapping file via a `buildId` of sorts, the current way is only possible via `release` and `dist` similar to source maps which is problematic, hence asking support for that natively (Also on Web) [https://github.com/dart-lang/sdk/issues/51941]().

For Flutter AOT apps, Flutter's beta channel already supports reading the `buildId` at runtime, via [https://github.com/dart-lang/sdk/issues/51941]()
It'd be possible to associate the mapping file with this Id, most likely we need to associate the mapping file with multiple Ids since the apps can be compiled with different architectures/bundles/etc, most likely generating multiple `buildId`s, but still a single mapping file.

Sentry-CLI/or tools like `readelf` could read the `buildId`s (`code id` section) of the compiled binaries and upload the mapping file making the association with such Ids.
Sentry SDK sets the `buildId` at runtime in the `event.debug_meta` similar to proguard, so the only process left is to do the symbolication during event ingestion.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.