Skip to content

Commit 6dad99a

Browse files
mozziusclaude
andauthored
Stop native Sentry from tracing every request (#12349)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent cb58887 commit 6dad99a

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

‎src/logger/sentry/setup/index.ts‎

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import {getGlobalScope, init} from '@sentry/react-native'
1+
import {
2+
getGlobalScope,
3+
init,
4+
reactNativeTracingIntegration,
5+
} from '@sentry/react-native'
26

37
import {featureFlagsIntegration} from '#/logger/sentry/featureFlags'
48
import {dropExpectedNetworkErrors} from '#/logger/sentry/network-errors'
@@ -15,7 +19,25 @@ init({
1519
dist: env.BUNDLE_IDENTIFIER,
1620
release: env.SENTRY_RELEASE,
1721
beforeSend: dropExpectedNetworkErrors,
18-
integrations: [featureFlagsIntegration],
22+
integrations: [
23+
featureFlagsIntegration,
24+
/*
25+
* Setting tracesSampleRate adds this integration by default, which wraps
26+
* every XHR/fetch in a span. Our only spans are the manual video ones,
27+
* which are inactive, so request spans almost never have a parent and get
28+
* discarded on device (millions a day as no_parent_span) after the work
29+
* of creating them. Overriding it by name keeps the rest of the
30+
* integration but skips request instrumentation.
31+
*/
32+
reactNativeTracingIntegration({traceFetch: false, traceXHR: false}),
33+
],
34+
/*
35+
* On native the SDK defaults this to match every URL, which adds
36+
* sentry-trace and baggage headers (release, environment, public key) to
37+
* requests to every host, including third-party PDSes and CDNs. None of our
38+
* backends read them, so propagate to nothing.
39+
*/
40+
tracePropagationTargets: [],
1941
ignoreErrors: [
2042
/*
2143
* Unknown internals errors

0 commit comments

Comments
 (0)