From a22d50cf4affa83718a3f60cf3cdc830e0b2474d Mon Sep 17 00:00:00 2001 From: viglia Date: Mon, 18 Nov 2024 10:57:37 +0100 Subject: [PATCH] fix: prioritize stack trace rule over app.identifier (#529) * prioritize stack trace rule over app.identifier Whenever a frame is matched by a stack trace rule, we should prioritize the rule. If no rule matched the frame then we can fall back on app.identifier. --- CHANGELOG.md | 1 + internal/profile/android.go | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6455658..a9fff13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,7 @@ - Return the duration measured by the profiler. ([#516](https://github.com/getsentry/vroom/pull/516), [#517](https://github.com/getsentry/vroom/pull/517)) - Annotate functions to the right thread. ([#523](https://github.com/getsentry/vroom/pull/523)) - Should write the profiler id. ([#528](https://github.com/getsentry/vroom/pull/528)) +- Prioritize stack trace rule over app.identifier ([#529](https://github.com/getsentry/vroom/pull/529)) **Internal**: diff --git a/internal/profile/android.go b/internal/profile/android.go index d647e5f..a7a8656 100644 --- a/internal/profile/android.go +++ b/internal/profile/android.go @@ -41,6 +41,7 @@ type ( DeobfuscationStatus string `json:"deobfuscation_status,omitempty"` // for react-native apps where we have js frames turned into android methods JsSymbolicated *bool `json:"symbolicated,omitempty"` + OrigInApp *int8 `json:"orig_in_app,omitempty"` } ) @@ -374,12 +375,21 @@ func (p *Android) NormalizeMethods(pi profileInterface) { for j := range method.InlineFrames { inlineMethod := method.InlineFrames[j] + if inlineMethod.Data.OrigInApp != nil { + continue + } inApp := inlineMethod.isApplicationFrame(appIdentifier) inlineMethod.InApp = &inApp method.InlineFrames[j] = inlineMethod } + // If a stack trace rule was applied to a given + // frame this should have the precedence over the + // appIdentifier. + if method.Data.OrigInApp != nil { + continue + } inApp := method.isApplicationFrame(appIdentifier) method.InApp = &inApp