Skip to content

Commit 33fe83e

Browse files
committed
Update test trace writer so injected baggage metadata can be asserted as tags
1 parent 85d573f commit 33fe83e

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/base/HttpServerTest.groovy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -819,8 +819,7 @@ abstract class HttpServerTest<SERVER> extends WithHttpServer<SERVER> {
819819
if (isDataStreamsEnabled()) {
820820
StatsGroup first = TEST_DATA_STREAMS_WRITER.groups.find { it.parentHash == 0 }
821821
verifyAll(first) {
822-
edgeTags.containsAll(DSM_EDGE_TAGS)
823-
edgeTags.size() == DSM_EDGE_TAGS.size()
822+
tags == DSM_EDGE_TAGS
824823
}
825824
}
826825
}

dd-trace-core/src/main/java/datadog/trace/common/writer/ListWriter.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,14 @@ public void write(List<DDSpan> trace) {
3838
for (DDSpan span : trace) {
3939
// This is needed to properly do all delayed processing to make this writer even
4040
// remotely realistic so the test actually test something
41-
span.processTagsAndBaggage(MetadataConsumer.NO_OP);
41+
span.processTagsAndBaggage(metadata -> {
42+
// surface injected baggage metadata as span tags so they can be asserted
43+
metadata.getBaggage().forEach((k, v) -> {
44+
if (!k.startsWith("_dd.") && span.getTag(k) == null) {
45+
span.setTag(k, v);
46+
}
47+
});
48+
});
4249
}
4350

4451
add(trace);

0 commit comments

Comments
 (0)