mobile: re-add Sentry with conservative sampling and ignore list#14242
mobile: re-add Sentry with conservative sampling and ignore list#14242dylanjeffers wants to merge 1 commit intomainfrom
Conversation
Re-introduces @sentry/react-native to the mobile app, replacing the no-op initSentry() that was left behind after the RN 0.77 upgrade. Reuses the existing SENTRY_DSN already wired through env (same project as web; events are tagged platform=mobile so they can be filtered in the Sentry UI). - tracesSampleRate dropped from 1.0 (previous config) to 0.1 to preserve quota now that the rest of the perf integration is back online. - ignoreErrors filters known-noisy transient/cancellation cases so they don't drown out actionable signal. - navigationIntegration restored so React Navigation route changes show up as transactions again. Note: native side (Podfile, sentry.gradle, sentry.properties, source map upload step) still needs to be wired up in a follow-up — the JS init alone will report errors but symbolication and the CI release step won't work until that lands. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
|
Caution Review the following alerts detected in dependencies. According to your organization's Security Policy, you must resolve all "Block" alerts before proceeding. It is recommended to resolve "Warn" alerts too. Learn more about Socket for GitHub.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Summary
@sentry/react-native(^6.20.0) topackages/mobile, replacing the no-opinitSentry()left behind after the RN 0.77 upgrade.env.SENTRY_DSN(same DSN as web; events are taggedplatform=mobileso they're filterable in the Sentry UI).tracesSampleRatefrom1.0(previous config) to0.1to preserve quota.ignoreErrorslist for known-noisy transient/cancellation cases (network failures, AbortError, "User cancelled", non-Error rejections, etc.).navigationIntegrationso React Navigation route changes register as transactions.Context
Sentry was removed from mobile in
da4fd75f(the RN 0.77 upgrade) — likely because@sentry/react-native@6.11.0wasn't yet compatible. RN has since moved to 0.78.3 + React 19, and recent 6.x versions of the SDK support that combination. TheinitSentry()wrapper and itsApp.tsxcallsite were preserved during removal, so re-enabling is mostly a content swap inside one file.Follow-ups (not in this PR)
This PR only restores the JS-side integration. To get the full pipeline working, the following native pieces still need to be wired up:
ios/Podfile, runpod install, drop asentry.propertiesnext to the project, and add the source-map upload build phase.android/app/build.gradle, add a matchingsentry.properties.SENTRY_AUTH_TOKEN/SENTRY_ORG/SENTRY_PROJECTsecrets referenced in.github/workflows/mobile.ymlstill resolve to the right project for the upload step.^6.20.0was picked as a recent 6.x supporting RN 0.78 / React 19, but please confirm against your install/build before merging — adjust ifnpm installflags peer-dep issues.Without the native side, the JS will still call
Sentry.initand report errors over the network, but stacks won't be symbolicated and releases won't be associated with uploaded source maps.Test plan
npm installfrom repo root resolves@sentry/react-native@^6.20.0cleanly against RN 0.78.3 / React 19.npm run ios:dev) launches without runtime errors from Sentry init.npm run android:dev) launches without runtime errors from Sentry init.platform=mobile.Network request failedandUser cancellederrors are filtered out (do not appear in Sentry).🤖 Generated with Claude Code