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
- `opentelemetry-api`, `opentelemetry-sdk`: add support for 'random-trace-id' flags in W3C traceparent header trace flags. Implementations of `IdGenerator` that do randomly generate the 56 least significant bits, should also implement a `is_trace_id_random` methods that returns `True`.
Implementations should at least make the 64 least significant bits
23
+
Implementations should at least make the 56 least significant bits
24
24
uniformly random. Samplers like the `TraceIdRatioBased` sampler rely on
25
25
this randomness to make sampling decisions.
26
26
27
+
If the implementation does randomly generate the 56 least significant bits,
28
+
it should also implement `is_trace_id_random` to return True.
29
+
27
30
See `the specification on TraceIdRatioBased <https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk.md#traceidratiobased>`_.
28
31
29
32
Returns:
30
33
A 128-bit int for use as a trace ID
31
34
"""
32
35
36
+
# pylint: disable=no-self-use
37
+
defis_trace_id_random(self) ->bool:
38
+
"""Indicates whether generated trace IDs are random.
39
+
40
+
When True, the `trace-id` field will have the `random-trace-id` flag set
41
+
in the W3C traceparent header. Per the W3C Trace Context specification,
42
+
this indicates that at least the 7 rightmost bytes (56 bits) of the
43
+
trace ID were generated randomly with uniform distribution.
44
+
45
+
See `the W3C Trace Context specification <https://www.w3.org/TR/trace-context-2/#considerations-for-trace-id-field-generation>`_.
46
+
47
+
Returns:
48
+
True if this generator produces random IDs, False otherwise.
49
+
"""
50
+
# By default, return False for backwards compatibility.
51
+
returnFalse
52
+
33
53
34
54
classRandomIdGenerator(IdGenerator):
35
55
"""The default ID generator for TracerProvider which randomly generates all
0 commit comments