diff --git a/lib/datadog/opentelemetry/sdk/span_processor.rb b/lib/datadog/opentelemetry/sdk/span_processor.rb index c031b94c89..a74142738f 100644 --- a/lib/datadog/opentelemetry/sdk/span_processor.rb +++ b/lib/datadog/opentelemetry/sdk/span_processor.rb @@ -92,14 +92,14 @@ def start_datadog_span(span) unless span.links.nil? datadog_span.links = span.links.map do |link| Datadog::Tracing::SpanLink.new( - attributes: link.attributes, - digest: Datadog::Tracing::TraceDigest.new( - trace_id: link.span_context.trace_id, - span_id: link.span_context.span_id, + Datadog::Tracing::TraceDigest.new( + trace_id: link.span_context.trace_id.unpack1('Q'), + span_id: link.span_context.span_id.unpack1('Q'), trace_flags: (link.span_context.trace_flags&.sampled? ? 1 : 0), trace_state: link.span_context.tracestate&.to_s, span_remote: link.span_context.remote?, - ) + ), + attributes: link.attributes ) end end diff --git a/spec/datadog/opentelemetry_spec.rb b/spec/datadog/opentelemetry_spec.rb index 2585030509..710f6d781a 100644 --- a/spec/datadog/opentelemetry_spec.rb +++ b/spec/datadog/opentelemetry_spec.rb @@ -322,8 +322,8 @@ let(:sc1) { OpenTelemetry::Trace::SpanContext.new(trace_id: 36893488147419103231, span_id: 2) } let(:sc2) do OpenTelemetry::Trace::SpanContext.new( - trace_id: 1234534, - span_id: 67890, + trace_id: [1234534].pack('Q'), + span_id: [67890].pack('Q'), trace_flags: OpenTelemetry::Trace::TraceFlags::SAMPLED, tracestate: OpenTelemetry::Trace::Tracestate.from_string('otel=blahxd') )