Skip to content

Deobfuscate ANR profile stack frames #5510

Description

@linear-code

Description

At the moment, the Sentry flamegraph UI displays ANR stack frames in an obfuscated state, even when customers have uploaded ProGuard/R8 mapping files via the sentry-android-gradle-plugin.

This issue covers the work required to deobfuscate those frames. It assumes we've already completed #5509, which covers a number of backend changes we'll need to piggyback on.

What's broken

  1. At the gate: The monolith's deobfuscation dispatch is gated by platform in SHOULD_DEOBFUSCATE, where SHOULD_DEOBFUSCATE = frozenset(["android"]). ANR profile chunks currently ship platform="java", so they skip the gate entirely and reach GCS obfuscated. (Bill ANR profiles as UI Profile Hours instead of Continuous Profile Hours #5509 will fix this by flipping the platform.)
  2. In the body: Even once the gate passes, the deobfuscation code reads profile["build_id"] and iterates profile["profile"]["methods"] – both legacy Android profile fields that sample-v2 chunks don't have. It would KeyError and drop the chunk.

Proposed approach

Monolith

Add a sample-v2-aware branch to _deobfuscate that reads debug_meta.images for ProGuard UUIDs, builds a JvmStacktrace from profile.frames, calls Symbolicator's /symbolicate-jvm, and re-stitches the response back, including 1-to-N inline expansion. Also wire _get_release_package as a fallback for release_package (ANR chunks have no linked transaction, so transaction_metadata.app.identifier is empty).

Remove the Perfetto branch's _is_android_sample_v2 → False skip-gate. This change lands in lockstep with the Perfetto migration.

SDK

In captureAnrProfile, explicitly construct debug_meta from the persisted prior-run ProGuard UUID (the ANR happened in the prior process, so the prior run's UUID is the correct one). The implicit attach in SentryClient.captureProfileChunk already puts a ProGuard image on the wire since 8.5.0, so this is a correctness-edge fix, not pipeline-blocking.

Also plumb chunk platform through StackTraceConverter so each frame carries platform and in_app. Without these, vroomrs's normalisation overwrites in_app to false on every JVM frame.

Symbolicator and vroom

No changes needed

Metadata

Metadata

Assignees

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions