Skip to content

Commit

Permalink
pack integers not strings
Browse files Browse the repository at this point in the history
  • Loading branch information
mabdinur committed Jun 13, 2024
1 parent 3c84f1f commit f416397
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/datadog/opentelemetry/sdk/propagator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def extract(
digest = @datadog_propagator.extract(carrier)
return context unless digest

# Converts the {Numeric} Datadog id object to OpenTelemetry's byte array format.
trace_id = [format('%032x', digest.trace_id)].pack('H32')
span_id = [format('%016x', digest.span_id)].pack('H16')
# Converts the {Numeric} Datadog id object to OpenTelemetry's byte array format.
trace_id = [digest.trace_id >> 64, digest.trace_id & 0xFFFFFFFFFFFFFFFF].pack('Q>Q>') # 128-bit unsigned, big-endian integer
span_id = [digest.span_id].pack('Q>') # 64-bit unsigned, big-endian integer

if digest.trace_state || digest.trace_flags
trace_flags = ::OpenTelemetry::Trace::TraceFlags.from_byte(digest.trace_flags)
Expand Down

0 comments on commit f416397

Please sign in to comment.