Skip to content

Commit e5aa8fa

Browse files
cecile75Cecile Terpin
andauthored
Fix baggages mapping configuration when only keys are provided (#7972)
* fix BAGGAGE_MAPPING * spotless * add tests * fix test --------- Co-authored-by: Cecile Terpin <“[email protected]”>
1 parent 3cad274 commit e5aa8fa

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

internal-api/src/main/java/datadog/trace/api/Config.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ private Config(final ConfigProvider configProvider, final InstrumenterConfig ins
761761
requestHeaderTagsCommaAllowed =
762762
configProvider.getBoolean(REQUEST_HEADER_TAGS_COMMA_ALLOWED, true);
763763

764-
baggageMapping = configProvider.getMergedMap(BAGGAGE_MAPPING);
764+
baggageMapping = configProvider.getMergedMapWithOptionalMappings(null, true, BAGGAGE_MAPPING);
765765

766766
spanAttributeSchemaVersion = schemaVersionFromConfig();
767767

internal-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ class ConfigTest extends DDSpecification {
184184
prop.setProperty(SPAN_TAGS, "c:3")
185185
prop.setProperty(JMX_TAGS, "d:4")
186186
prop.setProperty(HEADER_TAGS, "e:five")
187-
prop.setProperty(BAGGAGE_MAPPING, "f:six")
187+
prop.setProperty(BAGGAGE_MAPPING, "f:six,g")
188188
prop.setProperty(HTTP_SERVER_ERROR_STATUSES, "123-456,457,124-125,122")
189189
prop.setProperty(HTTP_CLIENT_ERROR_STATUSES, "111")
190190
prop.setProperty(HTTP_CLIENT_HOST_SPLIT_BY_DOMAIN, "true")
@@ -273,7 +273,7 @@ class ConfigTest extends DDSpecification {
273273
config.mergedSpanTags == [b: "2", c: "3"]
274274
config.mergedJmxTags == [b: "2", d: "4", (RUNTIME_ID_TAG): config.getRuntimeId(), (SERVICE_TAG): config.serviceName]
275275
config.requestHeaderTags == [e: "five"]
276-
config.baggageMapping == [f: "six"]
276+
config.baggageMapping == [f: "six", g: "g"]
277277
config.httpServerErrorStatuses == toBitSet((122..457))
278278
config.httpClientErrorStatuses == toBitSet((111..111))
279279
config.httpClientSplitByDomain == true
@@ -365,7 +365,7 @@ class ConfigTest extends DDSpecification {
365365
System.setProperty(PREFIX + SPAN_TAGS, "c:3")
366366
System.setProperty(PREFIX + JMX_TAGS, "d:4")
367367
System.setProperty(PREFIX + HEADER_TAGS, "e:five")
368-
System.setProperty(PREFIX + BAGGAGE_MAPPING, "f:six")
368+
System.setProperty(PREFIX + BAGGAGE_MAPPING, "f:six,g")
369369
System.setProperty(PREFIX + HTTP_SERVER_ERROR_STATUSES, "123-456,457,124-125,122")
370370
System.setProperty(PREFIX + HTTP_CLIENT_ERROR_STATUSES, "111")
371371
System.setProperty(PREFIX + HTTP_CLIENT_HOST_SPLIT_BY_DOMAIN, "true")
@@ -453,7 +453,7 @@ class ConfigTest extends DDSpecification {
453453
config.mergedSpanTags == [b: "2", c: "3"]
454454
config.mergedJmxTags == [b: "2", d: "4", (RUNTIME_ID_TAG): config.getRuntimeId(), (SERVICE_TAG): config.serviceName]
455455
config.requestHeaderTags == [e: "five"]
456-
config.baggageMapping == [f: "six"]
456+
config.baggageMapping == [f: "six", g: "g"]
457457
config.httpServerErrorStatuses == toBitSet((122..457))
458458
config.httpClientErrorStatuses == toBitSet((111..111))
459459
config.httpClientSplitByDomain == true
@@ -706,7 +706,7 @@ class ConfigTest extends DDSpecification {
706706
properties.setProperty(SPAN_TAGS, "c:3")
707707
properties.setProperty(JMX_TAGS, "d:4")
708708
properties.setProperty(HEADER_TAGS, "e:five")
709-
properties.setProperty(BAGGAGE_MAPPING, "f:six")
709+
properties.setProperty(BAGGAGE_MAPPING, "f:six,g")
710710
properties.setProperty(HTTP_SERVER_ERROR_STATUSES, "123-456,457,124-125,122")
711711
properties.setProperty(HTTP_CLIENT_ERROR_STATUSES, "111")
712712
properties.setProperty(HTTP_CLIENT_HOST_SPLIT_BY_DOMAIN, "true")
@@ -739,7 +739,7 @@ class ConfigTest extends DDSpecification {
739739
config.mergedSpanTags == [b: "2", c: "3"]
740740
config.mergedJmxTags == [b: "2", d: "4", (RUNTIME_ID_TAG): config.getRuntimeId(), (SERVICE_TAG): config.serviceName]
741741
config.requestHeaderTags == [e: "five"]
742-
config.baggageMapping == [f: "six"]
742+
config.baggageMapping == [f: "six",g: "g"]
743743
config.httpServerErrorStatuses == toBitSet((122..457))
744744
config.httpClientErrorStatuses == toBitSet((111..111))
745745
config.httpClientSplitByDomain == true

0 commit comments

Comments
 (0)