Skip to content

Commit 098e6bd

Browse files
committed
fix: trace id mismatch
Some 128-bit w3c trace IDs in the wild contain a zero-padded 64-bit portion. This commit sets the default high part of the trace ID to 0, ensuring the check passes correctly. Resolves #83
1 parent c9a6a4c commit 098e6bd

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

kong/plugins/ddtrace/datadog_propagation.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ local function extract_datadog(get_header, max_header_size)
5656
end
5757

5858
-- other headers are expected but aren't provided in all cases
59-
local trace_id = { high = nil, low = trace_id_low }
59+
local trace_id = { high = 0, low = trace_id_low }
6060
local parent_id = parse_uint64(get_header("x-datadog-parent-id"), 10)
6161
local sampling_priority = tonumber(get_header("x-datadog-sampling-priority"))
6262
local origin = get_header("x-datadog-origin")

spec/01-unit-tests/03_propagation_spec.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ describe("trace propagation", function()
7676

7777
local span = multi_propagator:extract_or_create_span(request, default_span_opts)
7878

79-
local expected_trace_id = { high = nil, low = 12345678901234567890ULL }
79+
local expected_trace_id = { high = 0, low = 12345678901234567890ULL }
8080
local expected_parent_id = 9876543210987654321ULL
8181
assert.same(expected_trace_id, span.trace_id)
8282
assert.same(expected_parent_id, span.parent_id)

spec/01-unit-tests/06_datadog_propagation_spec.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describe("trace propagation", function()
4444
assert.is_nil(err)
4545
assert.is_not_nil(extracted)
4646

47-
local expected_trace_id = { high = nil, low = 12345678901234567890ULL }
47+
local expected_trace_id = { high = 0, low = 12345678901234567890ULL }
4848
assert.same(expected_trace_id, extracted.trace_id)
4949
assert.equal(9876543210987654321ULL, extracted.parent_id)
5050
assert.equal(1, extracted.sampling_priority)

0 commit comments

Comments
 (0)