Skip to content

Commit 04f1bfd

Browse files
committed
updating DD_TAGS to belong under breaking change flag
1 parent c69a320 commit 04f1bfd

2 files changed

Lines changed: 34 additions & 1 deletion

File tree

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,11 @@ private Config(final ConfigProvider configProvider, final InstrumenterConfig ins
775775

776776
{
777777
final Map<String, String> tags = new HashMap<>(configProvider.getMergedMap(GLOBAL_TAGS));
778-
tags.putAll(configProvider.getMergedTagsMap(TRACE_TAGS, TAGS));
778+
if (experimentalFeaturesEnabled.contains("DD_TAGS")) {
779+
tags.putAll(configProvider.getMergedTagsMap(TRACE_TAGS, TAGS));
780+
} else {
781+
tags.putAll(configProvider.getMergedMap(TRACE_TAGS, TAGS));
782+
}
779783
if (serviceNameSetByUser) { // prioritize service name set by DD_SERVICE over DD_TAGS config
780784
tags.remove("service");
781785
}

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1889,6 +1889,35 @@ class ConfigTest extends DDSpecification {
18891889
[serviceProperty, serviceName] << [[SERVICE, SERVICE_NAME], [DEFAULT_SERVICE_NAME, "my-service"]].combinations()
18901890
}
18911891

1892+
def "verify behavior of features under DD_TRACE_EXPERIMENTAL_FEATURES_ENABLED"() {
1893+
setup:
1894+
environmentVariables.set("DD_TRACE_EXPERIMENTAL_FEATURES_ENABLED", "DD_TAGS")
1895+
environmentVariables.set("DD_TAGS", "env:test,aKey:aVal bKey:bVal cKey:")
1896+
1897+
when:
1898+
def config = new Config()
1899+
1900+
then:
1901+
config.experimentalFeaturesEnabled == ["DD_TAGS"].toSet()
1902+
1903+
//verify expected behavior enabled under feature flag
1904+
config.globalTags == [env: "test", aKey: "aVal bKey:bVal cKey:"]
1905+
}
1906+
1907+
def "verify behavior of 'breaking change' configs when not under DD_TRACE_EXPERIMENTAL_FEATURES_ENABLED"() {
1908+
setup:
1909+
environmentVariables.set("DD_TAGS", "env:test,aKey:aVal bKey:bVal cKey:")
1910+
1911+
when:
1912+
def config = new Config()
1913+
1914+
then:
1915+
config.experimentalFeaturesEnabled == [].toSet()
1916+
1917+
//verify expected behavior when not enabled under feature flag
1918+
config.globalTags == [env:"test", aKey:"aVal", bKey:"bVal"]
1919+
}
1920+
18921921
def "detect if agent is configured using default values"() {
18931922
setup:
18941923
if (host != null) {

0 commit comments

Comments
 (0)