Skip to content

Commit 420d652

Browse files
committed
Add new strictTracePropagation behaviour
1 parent 52f3343 commit 420d652

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

develop-docs/sdk/telemetry/traces/index.mdx

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,34 @@ This Option replaces the non-standardized `tracingOrigins` option which was prev
7474

7575
### `strictTracePropagation`
7676

77-
This should be a boolean value. Default is `false`. This option controls trace continuation from unknown 3rd party services that happen to be instrumented by a Sentry SDK.
77+
This must be a boolean value. Default is `false`. This option controls trace continuation from unknown 3rd party services that happen to be instrumented by a Sentry SDK.
7878

79-
If the SDK can parse an org ID from the configured DSN, it must be propagated as a baggage entry with the key `sentry-org`. Given a DSN of `https://[email protected]/1`, the org ID is `1`, based on `o1`.
79+
If the SDK is able parse an org ID from the configured DSN, it must be propagated as a baggage entry with the key `sentry-org`. Given a DSN of `https://[email protected]/1`, the org ID is `1`, based on `o1`.
8080

81-
On incoming traces, the SDK must compare the `sentry-org` baggage value against its own parsed value from the DSN. Only if both match, the trace is continued. If there is no match, neither the trace ID, the parent sampling decision nor the baggage should be taken into account.
82-
The SDK should behave like it is the head of trace in this case.
81+
Addiotnally, the SDK must be configurable with an optional `org: <org-id>` setting that takes precedence over the parsed value from the DSN. This option should be set when running a self-hosted version of Sentry or if a non-standard Sentry DSN is used, such as when using a local Relay.
82+
83+
On incoming traces, the SDK must compare the `sentry-org` baggage value against its own parsed value from the DSN or org setting. Only if both match, the trace is continued. If there is no match, neither the trace ID, the parent sampling decision nor the baggage should be taken into account.
84+
The SDK should behave like it is the head of trace in this case, and not consider any propagted values.
8385

8486
This behavior can be disabled by setting `strictTracePropagation: false` in the SDK init call.
85-
Initially, SDKs should introduce the this option with a default value of `false`.
87+
Initially, SDKs must introduce the this option with a default value of `false`.
8688
Once the majority of SDKs introduced this option, we will change the default value to `true` (in a major version bump) making it opt-out.
8789

88-
The SDK must be configurable with an optional `org: <org-id>` setting that takes precedence over the parsed value from the DSN. This option should be set when running a self-hosted version of Sentry or if a non-standard Sentry DSN is used, such as when using a local Relay.
90+
Regardless of `strictTracePropagation` being set to `true` or `false`, if the SDK is either configured with a `org` or was able to parse the value from the DSN, incoming traces containing an `org` value in the baggage that does not match the one from the receiving SDK, the trace is not continuned.
91+
92+
Examples:
93+
94+
baggage: `sentry-org: 1`, SDK config: `org: 1, strictTracePropagation: false` -> continue trace
95+
baggage: `sentry-org: none`, SDK config: `org: 1, strictTracePropagation: false` -> continue trace
96+
baggage: `sentry-org: 1`, SDK config: `org: none, strictTracePropagation: false` -> continue trace
97+
baggage: `sentry-org: none`, SDK config: `org: none, strictTracePropagation: false` -> continue trace
98+
baggage: `sentry-org: 1`, SDK config: `org: 2, strictTracePropagation: false` -> drop trace
99+
100+
baggage: `sentry-org: 1`, SDK config: `org: 1, strictTracePropagation: true` -> continue trace
101+
baggage: `sentry-org: none`, SDK config: `org: 1, strictTracePropagation: true` -> drop trace
102+
baggage: `sentry-org: 1`, SDK config: `org: none, strictTracePropagation: true` -> drop trace
103+
baggage: `sentry-org: none`, SDK config: `org: none, strictTracePropagation: true` -> continue trace
104+
baggage: `sentry-org: 1`, SDK config: `org: 2, strictTracePropagation: true` -> drop trace
89105

90106
### `traceOptionsRequests`
91107

0 commit comments

Comments
 (0)