From c524b43fa37673027ab7fed29ca12bd16a719c6b Mon Sep 17 00:00:00 2001 From: jtrzupek Date: Fri, 19 Jun 2026 20:07:32 +0200 Subject: [PATCH] fix(mobile): drop background ANR noise from Sentry (beforeSend) Android Background ANRs captured via AppExitInfo (GOON-1D) are OS-side noise: the OS freezes a backgrounded app and reports it as not-responding, with zero JS/app frames and nothing to fix. beforeSend now drops events that are ANRs (ApplicationNotResponding) AND backgrounded (contexts.app.in_foreground === false). Foreground ANRs are kept (those can be real jank). Co-Authored-By: Claude Opus 4.8 (1M context) --- mobile/App.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mobile/App.tsx b/mobile/App.tsx index d36162c..25110b0 100644 --- a/mobile/App.tsx +++ b/mobile/App.tsx @@ -60,6 +60,16 @@ if (SENTRY_DSN) { // Lokalna wersja appki — dystyngwuje builds w Sentry release filter. expo-constants // czyta `version` z `app.json` (a nie z package.json), więc tutaj `expoConfig.version`. release: `goon-mobile@${Constants.expoConfig?.version ?? '0.0.0'}`, + // Filtr szumu: Android Background ANR (łapany przez AppExitInfo) to OS zamrażający + // apkę w TLE i raportujący "nie odpowiada" — zero ramek JS/app, nic do naprawy + // (GOON-1D). Dropujemy TYLKO background; foreground ANR zostaje (realny jank). + beforeSend: (event) => { + const isAnr = event.exception?.values?.some( + (v) => v?.type === 'ApplicationNotResponding' || /\bANR\b/.test(v?.value || ''), + ); + if (isAnr && event.contexts?.app?.in_foreground === false) return null; + return event; + }, // Boot diagnostic: jeden message przy starcie z tagiem `source:boot` pozwala // potwierdzić że SDK rzeczywiście wysyła. Jeśli w Sentry nie ma go po starcie // appki → init nie startuje albo zaprzeszł blockera (network/DNS/uplink).