You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implementations should at least make the 64 least significant bits
34
+
Implementations should at least make the 56 least significant bits
35
35
uniformly random. Samplers like the `TraceIdRatioBased` sampler rely on
36
36
this randomness to make sampling decisions.
37
37
38
+
If the implementation does randomly generate the 56 least significant bits,
39
+
it should also implement `is_trace_id_random` to return True.
40
+
38
41
See `the specification on TraceIdRatioBased <https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk.md#traceidratiobased>`_.
39
42
40
43
Returns:
41
44
A 128-bit int for use as a trace ID
42
45
"""
43
46
47
+
@abc.abstractmethod
48
+
defis_trace_id_random(self) ->bool:
49
+
"""Indicates whether generated trace IDs are random.
50
+
51
+
When True, the `trace-id` field will have the `random-trace-id` flag set
52
+
in the W3C traceparent header. Per the W3C Trace Context specification,
53
+
this indicates that at least the 7 rightmost bytes (56 bits) of the
54
+
trace ID were generated randomly with uniform distribution.
55
+
56
+
See `the W3C Trace Context specification <https://www.w3.org/TR/trace-context-2/#considerations-for-trace-id-field-generation>`_.
57
+
58
+
Returns:
59
+
True if this generator produces random IDs, False otherwise.
60
+
"""
61
+
44
62
45
63
classRandomIdGenerator(IdGenerator):
46
64
"""The default ID generator for TracerProvider which randomly generates all
0 commit comments