From 3cd34c286798cd4c7ab4b31aa2fdabac573c9767 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Tue, 17 Mar 2026 15:16:38 +0100 Subject: [PATCH] docs: Add strict trace continuation to React Native distributed tracing --- .../how-to-use/react-native.mdx | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/platform-includes/distributed-tracing/how-to-use/react-native.mdx b/platform-includes/distributed-tracing/how-to-use/react-native.mdx index cbad4b0a410588..2284ba7d0a1f38 100644 --- a/platform-includes/distributed-tracing/how-to-use/react-native.mdx +++ b/platform-includes/distributed-tracing/how-to-use/react-native.mdx @@ -8,3 +8,33 @@ Sentry.init({ ``` If you're using version `5.9.x` or below, you'll need to have our tracing feature enabled in order for distributed tracing to work. + +### Strict Trace Continuation + +When your application receives requests, they might include `sentry-trace` and `baggage` headers from an upstream service that is also using Sentry. +By default, the SDK will continue the trace from these incoming headers. However, this behavior can be undesirable if the requests are from a third-party service, +as it can lead to unwanted traces, increased billing, and skewed performance data. + +To prevent this, you can enable `strictTraceContinuation`. When this option is set to `true`, the SDK checks the incoming request for Sentry trace information and only continues the trace if it belongs to the same Sentry organization. +Otherwise, it starts a new trace. + +```javascript {4} +Sentry.init({ + dsn: "___PUBLIC_DSN___", + tracesSampleRate: 1.0, + // Ensure that only traces from your own organization are continued + strictTraceContinuation: true, +}); +``` + +The SDK automatically parses the organization ID from your DSN. If you use a DSN format that doesn't include the organization ID (number followed by the letter `"o"`), or if you need to override it, you can provide it manually using the `orgId` option: + +```javascript {5} +Sentry.init({ + dsn: "___PUBLIC_DSN___", + tracesSampleRate: 1.0, + strictTraceContinuation: true, + // Manually provide your organization ID (overrides organization ID parsed from DSN) + orgId: 12345, +}); +```