Class: Datadog::OpenTelemetry::SDK::IdGenerator
- Inherits:
-
Object
- Object
- Datadog::OpenTelemetry::SDK::IdGenerator
- Extended by:
- OpenTelemetry::Trace
- Defined in:
- lib/datadog/opentelemetry/sdk/id_generator.rb
Overview
Generates Datadog-compatible IDs for OpenTelemetry traces. OpenTelemetry traces already produce Datadog-compatible IDs.
Class Method Summary collapse
-
.generate_trace_id ⇒ String
Generates a valid trace identifier, a 16-byte string with at least one non-zero byte.
Class Method Details
.generate_trace_id ⇒ String
Generates a valid trace identifier, a 16-byte string with at least one non-zero byte.
16 17 18 19 20 21 |
# File 'lib/datadog/opentelemetry/sdk/id_generator.rb', line 16 def generate_trace_id loop do id = Random.bytes(8) # DEV: Change to 16 (16*8-byte) when 128-bit trace_id is supported. return id unless id == ::OpenTelemetry::Trace::INVALID_SPAN_ID end end |