Skip to content

Commit e99a85d

Browse files
authored
fix: ensure random part of trace id is uniformly distributed (#558)
* fix: ensure random part of trace id is uniformly distributed * Apply suggestions from review
1 parent f7a3706 commit e99a85d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

spec/20-http_request_header_format.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ There are two additional options that vendors MAY follow:
185185
The second least significant bit of the trace-flags field denotes the `random-trace-id` flag.
186186

187187
When starting or restarting a trace (that is, when the participant generates a new `trace-id`), the following rules apply:
188-
* If that flag is set, at least the right-most 7 bytes of the `trace-id` MUST be random (or pseudo-random).
188+
* If that flag is set, at least the right-most 7 bytes of the `trace-id` MUST be selected randomly (or pseudo-randomly) with uniform distribution over the interval [0..2^56-1].
189189
* If the flag is not set, the `trace-id` MAY still be randomly (or pseudo-randomly) generated.
190190
* When unset, the `trace-id` MAY be generated in any way that satisfies the requirements of the [trace ID format](#trace-id).
191191
* When at least the right-most 7 bytes of the `trace-id` are randomly (or pseudo-randomly) generated, the `random-trace-id` flag SHOULD be set to `1`.

spec/60-trace-id-format.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ also allows tracing vendors to base sampling decisions on `trace-id` field value
2323
and avoid propagating an additional sampling context.
2424

2525
If the `random-trace-id` flag is set, at least the right-most 7 bytes of the
26-
`trace-id` MUST be randomly (or pseudo-randomly) generated.
26+
`trace-id` MUST be selected randomly (or pseudo-randomly) with uniform distribution
27+
over the interval [0..2^56-1].
2728

2829
As shown in the next section, if part of the `trace-id` is nonrandom,
2930
it is important for the random part of the `trace-id` to be as far right in the

0 commit comments

Comments
 (0)