Skip to content

Commit 1ce9e46

Browse files
bm1549claude
andcommitted
fix: correct _dd.p.ksr ordering in OT x-datadog-tags expectations
The PTagsCodec headerValue method outputs tags in order: dm, tid, ksr. The test datadogTags list had ksr before tid, causing a comparison failure. Reorder to match the actual output: dm, tid, ksr. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b006773 commit 1ce9e46

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

dd-trace-ot/src/ot31CompatibilityTest/groovy/OT31ApiTest.groovy

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ class OT31ApiTest extends DDSpecification {
101101
def effectiveSamplingMechanism = contextPriority == UNSET ? AGENT_RATE : samplingMechanism
102102
def expectedTracestate = "dd=s:${propagatedPriority};p:${DDSpanId.toHexStringPadded(spanId)}" +
103103
(propagatedPriority > 0 ? ";t.dm:-" + effectiveSamplingMechanism : "") +
104-
(contextPriority == UNSET ? ";t.ksr:1" : "") +
105-
";t.tid:${traceId.toHexStringPadded(32).substring(0, 16)}"
104+
";t.tid:${traceId.toHexStringPadded(32).substring(0, 16)}" +
105+
(contextPriority == UNSET ? ";t.ksr:1" : "")
106106
def expectedTextMap = [
107107
"x-datadog-trace-id" : context.toTraceId(),
108108
"x-datadog-parent-id" : context.toSpanId(),
@@ -114,12 +114,12 @@ class OT31ApiTest extends DDSpecification {
114114
if (propagatedPriority > 0) {
115115
datadogTags << "_dd.p.dm=-$effectiveSamplingMechanism"
116116
}
117-
if (contextPriority == UNSET) {
118-
datadogTags << "_dd.p.ksr=1"
119-
}
120117
if (traceId.toHighOrderLong() != 0) {
121118
datadogTags << "_dd.p.tid=" + LongStringUtils.toHexStringPadded(traceId.toHighOrderLong(), 16)
122119
}
120+
if (contextPriority == UNSET) {
121+
datadogTags << "_dd.p.ksr=1"
122+
}
123123
if (!datadogTags.empty) {
124124
expectedTextMap.put("x-datadog-tags", datadogTags.join(','))
125125
}

dd-trace-ot/src/ot33CompatibilityTest/groovy/OT33ApiTest.groovy

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ class OT33ApiTest extends DDSpecification {
9090
def effectiveSamplingMechanism = contextPriority == UNSET ? AGENT_RATE : samplingMechanism
9191
def expectedTracestate = "dd=s:${propagatedPriority};p:${DDSpanId.toHexStringPadded(spanId)}" +
9292
(propagatedPriority > 0 ? ";t.dm:-" + effectiveSamplingMechanism : "") +
93-
(contextPriority == UNSET ? ";t.ksr:1" : "") +
94-
";t.tid:${traceId.toHexStringPadded(32).substring(0, 16)}"
93+
";t.tid:${traceId.toHexStringPadded(32).substring(0, 16)}" +
94+
(contextPriority == UNSET ? ";t.ksr:1" : "")
9595
def expectedTextMap = [
9696
"x-datadog-trace-id" : context.toTraceId(),
9797
"x-datadog-parent-id" : context.toSpanId(),
@@ -103,12 +103,12 @@ class OT33ApiTest extends DDSpecification {
103103
if (propagatedPriority > 0) {
104104
datadogTags << "_dd.p.dm=-$effectiveSamplingMechanism"
105105
}
106-
if (contextPriority == UNSET) {
107-
datadogTags << "_dd.p.ksr=1"
108-
}
109106
if (traceId.toHighOrderLong() != 0) {
110107
datadogTags << "_dd.p.tid=" + LongStringUtils.toHexStringPadded(traceId.toHighOrderLong(), 16)
111108
}
109+
if (contextPriority == UNSET) {
110+
datadogTags << "_dd.p.ksr=1"
111+
}
112112
if (!datadogTags.empty) {
113113
expectedTextMap.put("x-datadog-tags", datadogTags.join(','))
114114
}

0 commit comments

Comments
 (0)