Skip to content

Commit

Permalink
The trace_id should be a string.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Feb 8, 2024
1 parent 565a6a9 commit 6990a6f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/console/output/datadog/wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def call(subject = nil, *arguments, **options, &block)

def format_trace_id(id)
# 128-bit tracing is not supported by the Datadog agent, so we need to convert it to 64-bit. We expect that this will be changed in the future.
::Datadog::Tracing::Utils::TraceId.to_low_order(id)
::Datadog::Tracing::Utils::TraceId.to_low_order(id).to_s
end
end
end
Expand Down
8 changes: 6 additions & 2 deletions test/console/output/datadog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@
end

with "datadog trace" do
def correlation_trace_id(span)
::Datadog::Tracing::Correlation::Identifier.new(trace_id: span.trace_id).trace_id.to_s
end

it "should log message with datadog correlation" do
Datadog::Tracing.trace("frobulate.apply",service: "frobulate") do |span|
expect(buffer).to receive(:call).with("Hello World",
severity: :info,
dd: {
trace_id: ::Datadog::Tracing::Correlation::Identifier.new(trace_id: span.trace_id).trace_id,
trace_id: correlation_trace_id(span),
span_id: span.id.to_s
}
)
Expand All @@ -45,7 +49,7 @@
expect(buffer).to receive(:call).with("Hello World",
severity: :info,
dd: {
trace_id: ::Datadog::Tracing::Correlation::Identifier.new(trace_id: span.trace_id).trace_id
trace_id: correlation_trace_id(span)
}
)

Expand Down

0 comments on commit 6990a6f

Please sign in to comment.