Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
If you're using the current version of our Capacitor SDK, distributed tracing will work out of the box.

To get around possible [Browser CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) issues, define your `tracePropagationTargets`.

```javascript
Sentry.init({
dsn: "___PUBLIC_DSN___",
tracesSampleRate: 1.0,
tracePropagationTargets: ["https://myproject.org", /^\/api\//],
});
```

### 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.
Comment thread
antonis marked this conversation as resolved.
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,
});
```

### Disabling Distributed Tracing

If you want to disable distributed tracing and ensure no Sentry trace headers are sent, you can configure your SDK like this:

```javascript
Sentry.init({
dsn: "___PUBLIC_DSN___",

// Overwrite the defaults to ensure no trace headers are sent
tracePropagationTargets: [],
});
```
Loading