Skip to content

Commit 3def233

Browse files
antonissentrivana
authored andcommitted
docs: Add strict trace continuation for React Native (#16984)
## DESCRIBE YOUR PR Add `strictTraceContinuation` and `orgId` documentation to the React Native distributed tracing guide. **Changes:** - **`react-native.mdx`** — Add strict trace continuation section with explanation and code examples ## IS YOUR CHANGE URGENT? - [ ] Urgent deadline (GA date, etc.): - [ ] Other deadline: - [x] None: Not urgent, can wait up to 1 week+ ⚠️ Should be merged after getsentry/sentry-react-native#5829 is released ## PRE-MERGE CHECKLIST - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs)
1 parent 7a7dec2 commit 3def233

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

platform-includes/distributed-tracing/how-to-use/react-native.mdx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,33 @@ Sentry.init({
88
```
99

1010
If you're using version `5.9.x` or below, you'll need to have our <PlatformLink to="/tracing/">tracing feature enabled</PlatformLink> in order for distributed tracing to work.
11+
12+
### Strict Trace Continuation
13+
14+
When your application receives requests, they might include `sentry-trace` and `baggage` headers from an upstream service that is also using Sentry.
15+
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,
16+
as it can lead to unwanted traces, increased billing, and skewed performance data.
17+
18+
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.
19+
Otherwise, it starts a new trace.
20+
21+
```javascript {4}
22+
Sentry.init({
23+
dsn: "___PUBLIC_DSN___",
24+
tracesSampleRate: 1.0,
25+
// Ensure that only traces from your own organization are continued
26+
strictTraceContinuation: true,
27+
});
28+
```
29+
30+
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:
31+
32+
```javascript {5}
33+
Sentry.init({
34+
dsn: "___PUBLIC_DSN___",
35+
tracesSampleRate: 1.0,
36+
strictTraceContinuation: true,
37+
// Manually provide your organization ID (overrides organization ID parsed from DSN)
38+
orgId: 12345,
39+
});
40+
```

0 commit comments

Comments
 (0)