Skip to content

Commit 2204814

Browse files
committed
Remove out-of-scope items
1 parent d3f0615 commit 2204814

File tree

1 file changed

+0
-36
lines changed

1 file changed

+0
-36
lines changed

develop-docs/sdk/telemetry/spans/span-sampling.mdx

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -20,43 +20,7 @@ The `tracesSampler` callback must receive sufficient arguments from users to def
2020
This can include but is not limited to certain attributes from the root span, such as HTTP headers.
2121
The return value of the `tracesSampler` is a float between `0.0` and `1.0`.
2222

23-
```js
24-
Sentry.init({
25-
tracesSampler: ({ name, attributes, parentSampleRate }) => {
26-
// Inherit the trace parent's sample rate if there is one. Sampling is deterministic
27-
// for one trace, e.g. if the parent was sampled, all children will be sampled at the same rate.
28-
if (typeof parentSampleRate === "number") {
29-
return parentSampleRate;
30-
}
31-
32-
// Else, use a default sample rate (replacing tracesSampleRate).
33-
return 0.5;
34-
}
35-
})
36-
```
37-
38-
The `parentSampleRate` is a propagated value inside the baggage, using key `sentry-sample_rand`.
39-
The value stems from a truly random number between 0 and 1, generated when a new trace is started. If the SDK does not receive such a number in an incoming trace, a new, truly random number between 0 and 1 is generated.
40-
41-
In the following cases, the SDK must compare sample rates against this `parentSampleRate` instead of `math.random()`:
42-
43-
- When a `tracesSampler` is configured, i.e. `trace["sentry-sample_rand"] < tracesSampler()`
44-
45-
- When the SDK is the head of trace, this applies to sample decisions based on `tracesSampleRate`, e.g. `trace['sentry-sample_rand'] < config.tracesSampleRate`
46-
47-
If the `sentry-sample_rate` (`parentSampleRate`) is not available for any reason for an inbound trace, but the trace has the sampled flag set to true, the SDK injects `parentSampleRate: 1.0` into the `tracesSampler`.
48-
4923
If no `tracesSampler` is configured, a propagated sampling decision via the traceparent takes precedence over the `tracesSampleRate`. This behavior can be disabled by defining a `tracesSampler`.
50-
51-
## Parent Sampling Origins
52-
53-
If the SDK can parse an org ID from the configured DSN, this value 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`.
54-
55-
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 parent sampling decisions applies.
56-
57-
This behavior can be disabled by setting `strictTracePropagation: false` in the SDK init call.
58-
59-
The SDK must be configurable with an optional `org: <org-id>` setting that takes precedence over the parsed value from the DSN.
6024

6125
## Filter spans with `ignoreSpans` & integration config
6226

0 commit comments

Comments
 (0)