Skip to content

Commit 69e8a1d

Browse files
cleptriclforst
andauthored
Clarify sampled for Propagated Random Value (#12315)
Co-authored-by: Luca Forstner <[email protected]>
1 parent 579569b commit 69e8a1d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ The random value is set according to the following rules:
236236
2. It is _recommended_ to generate the random number deterministically using the trace ID as seed or source of randomness. The exact method by which the random number is created is implementation defined and may vary between SDK implementations. See 4. on why this behaviour is desirable.
237237
3. On incoming traces, an SDK assumes the `sample_rand` value along with the rest of the DSC, overriding an existing value if needed.
238238
4. If `sample_rand` is missing on an incoming trace, the SDK creates and from now on propagates a new random number on-the-fly, based on the following rules:
239-
1. If `sample_rate` and `sampled` are propgated, create `sample_rand` so that it adheres to the invariant. This means, for a decision of `True` generate a random number in half-open range `[0, rate)` and for a decision of `False` generate a random number in range `[rate, 1]`.
239+
1. If `sample_rate` and the sampling decision (from the `sentry-trace` header) are propgated, create `sample_rand` so that it adheres to the invariant. This means, for a decision of `True` generate a random number in half-open range `[0, rate)` and for a decision of `False` generate a random number in range `[rate, 1]`.
240240
2. If the sampling decision is missing, generate a random number in range of `[0, 1)` (including 0.0, excluding 1.0), like for a new trace.
241241

242242
The SDK should always use the stored random number (`sentry-sample_rand`) for sampling decisions and should no longer rely on `math.random()` or similar functions in tracing code:

0 commit comments

Comments
 (0)