From 7c1fc8b07236a4c04e5b02249455a5a16f1da618 Mon Sep 17 00:00:00 2001 From: Matthew Li Date: Thu, 26 Sep 2024 16:53:15 -0400 Subject: [PATCH 1/7] adding implementation for TRACE_HTTP_CLIENT_ERROR_STATUSES --- internal-api/src/main/java/datadog/trace/api/Config.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal-api/src/main/java/datadog/trace/api/Config.java b/internal-api/src/main/java/datadog/trace/api/Config.java index 8134f046727..64cf1c016c1 100644 --- a/internal-api/src/main/java/datadog/trace/api/Config.java +++ b/internal-api/src/main/java/datadog/trace/api/Config.java @@ -783,7 +783,7 @@ private Config(final ConfigProvider configProvider, final InstrumenterConfig ins httpClientErrorStatuses = configProvider.getIntegerRange( - HTTP_CLIENT_ERROR_STATUSES, DEFAULT_HTTP_CLIENT_ERROR_STATUSES); + "trace." + HTTP_CLIENT_ERROR_STATUSES, DEFAULT_HTTP_CLIENT_ERROR_STATUSES, HTTP_CLIENT_ERROR_STATUSES); httpServerTagQueryString = configProvider.getBoolean( From 449436c15e11c96322aacd0a0a496663d4199234 Mon Sep 17 00:00:00 2001 From: Matthew Li Date: Fri, 27 Sep 2024 12:49:42 -0400 Subject: [PATCH 2/7] adding string for TRACE_HTTP_CLIENT_ERROR_STATUSES rebasing --- .../datadog/trace/api/config/TracerConfig.java | 1 + .../src/main/java/datadog/trace/api/Config.java | 2 +- .../groovy/datadog/trace/api/ConfigTest.groovy | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/dd-trace-api/src/main/java/datadog/trace/api/config/TracerConfig.java b/dd-trace-api/src/main/java/datadog/trace/api/config/TracerConfig.java index 694ebfb5019..1e4e4a0b409 100644 --- a/dd-trace-api/src/main/java/datadog/trace/api/config/TracerConfig.java +++ b/dd-trace-api/src/main/java/datadog/trace/api/config/TracerConfig.java @@ -69,6 +69,7 @@ public final class TracerConfig { @Deprecated public static final String HTTP_SERVER_ERROR_STATUSES = "http.server.error.statuses"; public static final String TRACE_HTTP_SERVER_ERROR_STATUSES = "trace.http.server.error.statuses"; public static final String HTTP_CLIENT_ERROR_STATUSES = "http.client.error.statuses"; + public static final String TRACE_HTTP_CLIENT_ERROR_STATUSES = "trace.http.client.error.statuses"; public static final String SPLIT_BY_TAGS = "trace.split-by-tags"; diff --git a/internal-api/src/main/java/datadog/trace/api/Config.java b/internal-api/src/main/java/datadog/trace/api/Config.java index 64cf1c016c1..5b060c3b17a 100644 --- a/internal-api/src/main/java/datadog/trace/api/Config.java +++ b/internal-api/src/main/java/datadog/trace/api/Config.java @@ -783,7 +783,7 @@ private Config(final ConfigProvider configProvider, final InstrumenterConfig ins httpClientErrorStatuses = configProvider.getIntegerRange( - "trace." + HTTP_CLIENT_ERROR_STATUSES, DEFAULT_HTTP_CLIENT_ERROR_STATUSES, HTTP_CLIENT_ERROR_STATUSES); + TRACE_HTTP_CLIENT_ERROR_STATUSES, DEFAULT_HTTP_CLIENT_ERROR_STATUSES, HTTP_CLIENT_ERROR_STATUSES); httpServerTagQueryString = configProvider.getBoolean( diff --git a/internal-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy b/internal-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy index 984ef7cf13f..f97c0e5567a 100644 --- a/internal-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy +++ b/internal-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy @@ -118,6 +118,7 @@ import static datadog.trace.api.config.TracerConfig.SPAN_TAGS import static datadog.trace.api.config.TracerConfig.SPLIT_BY_TAGS import static datadog.trace.api.config.TracerConfig.TRACE_AGENT_PORT import static datadog.trace.api.config.TracerConfig.TRACE_AGENT_URL +import static datadog.trace.api.config.TracerConfig.TRACE_HTTP_CLIENT_ERROR_STATUSES import static datadog.trace.api.config.TracerConfig.TRACE_PROPAGATION_EXTRACT_FIRST import static datadog.trace.api.config.TracerConfig.TRACE_RATE_LIMIT import static datadog.trace.api.config.TracerConfig.TRACE_REPORT_HOSTNAME @@ -965,6 +966,19 @@ class ConfigTest extends DDSpecification { integrationNames = new TreeSet<>(names) } + def "verify precedence of aliases"() { + setup: + def prop = new Properties() + prop.setProperty(HTTP_CLIENT_ERROR_STATUSES, "111") + prop.setProperty(TRACE_HTTP_CLIENT_ERROR_STATUSES, "123") + + when: + Config config = Config.get(prop) + + then: + config.httpClientErrorStatuses == toBitSet((123..123)) + } + def "test getFloatSettingFromEnvironment(#name)"() { setup: environmentVariables.set("DD_ENV_ZERO_TEST", "0.0") From 97e0d5b42b0c5e7a4d14afa9e5be7b0120f95933 Mon Sep 17 00:00:00 2001 From: Matthew Li Date: Mon, 30 Sep 2024 11:21:20 -0400 Subject: [PATCH 3/7] spotless cleanup --- internal-api/src/main/java/datadog/trace/api/Config.java | 4 +++- .../src/test/groovy/datadog/trace/api/ConfigTest.groovy | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/internal-api/src/main/java/datadog/trace/api/Config.java b/internal-api/src/main/java/datadog/trace/api/Config.java index 5b060c3b17a..361ee7fa66c 100644 --- a/internal-api/src/main/java/datadog/trace/api/Config.java +++ b/internal-api/src/main/java/datadog/trace/api/Config.java @@ -783,7 +783,9 @@ private Config(final ConfigProvider configProvider, final InstrumenterConfig ins httpClientErrorStatuses = configProvider.getIntegerRange( - TRACE_HTTP_CLIENT_ERROR_STATUSES, DEFAULT_HTTP_CLIENT_ERROR_STATUSES, HTTP_CLIENT_ERROR_STATUSES); + TRACE_HTTP_CLIENT_ERROR_STATUSES, + DEFAULT_HTTP_CLIENT_ERROR_STATUSES, + HTTP_CLIENT_ERROR_STATUSES); httpServerTagQueryString = configProvider.getBoolean( diff --git a/internal-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy b/internal-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy index f97c0e5567a..c3c820246bf 100644 --- a/internal-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy +++ b/internal-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy @@ -971,7 +971,7 @@ class ConfigTest extends DDSpecification { def prop = new Properties() prop.setProperty(HTTP_CLIENT_ERROR_STATUSES, "111") prop.setProperty(TRACE_HTTP_CLIENT_ERROR_STATUSES, "123") - + when: Config config = Config.get(prop) From aacbefa27c20ca50d7ee472f8298bed651fed507 Mon Sep 17 00:00:00 2001 From: Matthew Li Date: Mon, 30 Sep 2024 14:47:31 -0400 Subject: [PATCH 4/7] fixing unit test --- .../test/groovy/datadog/trace/api/ConfigCollectorTest.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal-api/src/test/groovy/datadog/trace/api/ConfigCollectorTest.groovy b/internal-api/src/test/groovy/datadog/trace/api/ConfigCollectorTest.groovy index 5c502c3c3b0..12a52136eb0 100644 --- a/internal-api/src/test/groovy/datadog/trace/api/ConfigCollectorTest.groovy +++ b/internal-api/src/test/groovy/datadog/trace/api/ConfigCollectorTest.groovy @@ -59,7 +59,7 @@ class ConfigCollectorTest extends DDSpecification { // ConfigProvider.getMergedMapWithOptionalMappings TracerConfig.HEADER_TAGS | "e:five" // ConfigProvider.getIntegerRange - TracerConfig.HTTP_CLIENT_ERROR_STATUSES | "400-402" + TracerConfig.TRACE_HTTP_CLIENT_ERROR_STATUSES | "400-402" } def "should collect merged data from multiple sources"() { @@ -95,7 +95,7 @@ class ConfigCollectorTest extends DDSpecification { GeneralConfig.TELEMETRY_HEARTBEAT_INTERVAL | new Float(DEFAULT_TELEMETRY_HEARTBEAT_INTERVAL).toString() CiVisibilityConfig.CIVISIBILITY_GRADLE_SOURCE_SETS | "main,test" IastConfig.IAST_WEAK_HASH_ALGORITHMS | DEFAULT_IAST_WEAK_HASH_ALGORITHMS.join(",") - TracerConfig.HTTP_CLIENT_ERROR_STATUSES | "400-500" + TracerConfig.TRACE_HTTP_CLIENT_ERROR_STATUSES | "400-500" } def "default null config settings are also collected"() { From 690ee3a0cea057df90f567c210b7db3ae1b5d1e1 Mon Sep 17 00:00:00 2001 From: Matthew Li Date: Wed, 2 Oct 2024 11:23:51 -0400 Subject: [PATCH 5/7] removing temp alias test --- .../test/groovy/datadog/trace/api/ConfigTest.groovy | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/internal-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy b/internal-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy index c3c820246bf..d8f36580460 100644 --- a/internal-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy +++ b/internal-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy @@ -966,19 +966,6 @@ class ConfigTest extends DDSpecification { integrationNames = new TreeSet<>(names) } - def "verify precedence of aliases"() { - setup: - def prop = new Properties() - prop.setProperty(HTTP_CLIENT_ERROR_STATUSES, "111") - prop.setProperty(TRACE_HTTP_CLIENT_ERROR_STATUSES, "123") - - when: - Config config = Config.get(prop) - - then: - config.httpClientErrorStatuses == toBitSet((123..123)) - } - def "test getFloatSettingFromEnvironment(#name)"() { setup: environmentVariables.set("DD_ENV_ZERO_TEST", "0.0") From 1b4367c9c2b25602186f872c5c5c61c5d10219f3 Mon Sep 17 00:00:00 2001 From: Matthew Li Date: Wed, 2 Oct 2024 13:44:34 -0400 Subject: [PATCH 6/7] removing unused import --- internal-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/internal-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy b/internal-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy index d8f36580460..984ef7cf13f 100644 --- a/internal-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy +++ b/internal-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy @@ -118,7 +118,6 @@ import static datadog.trace.api.config.TracerConfig.SPAN_TAGS import static datadog.trace.api.config.TracerConfig.SPLIT_BY_TAGS import static datadog.trace.api.config.TracerConfig.TRACE_AGENT_PORT import static datadog.trace.api.config.TracerConfig.TRACE_AGENT_URL -import static datadog.trace.api.config.TracerConfig.TRACE_HTTP_CLIENT_ERROR_STATUSES import static datadog.trace.api.config.TracerConfig.TRACE_PROPAGATION_EXTRACT_FIRST import static datadog.trace.api.config.TracerConfig.TRACE_RATE_LIMIT import static datadog.trace.api.config.TracerConfig.TRACE_REPORT_HOSTNAME From bd832537154f474998770ff842e08dd3d160c723 Mon Sep 17 00:00:00 2001 From: Matthew Li Date: Mon, 7 Oct 2024 10:39:17 -0400 Subject: [PATCH 7/7] fixing merge conflicts --- .../src/main/java/datadog/trace/api/config/TracerConfig.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dd-trace-api/src/main/java/datadog/trace/api/config/TracerConfig.java b/dd-trace-api/src/main/java/datadog/trace/api/config/TracerConfig.java index 1e4e4a0b409..5bad7569ab4 100644 --- a/dd-trace-api/src/main/java/datadog/trace/api/config/TracerConfig.java +++ b/dd-trace-api/src/main/java/datadog/trace/api/config/TracerConfig.java @@ -68,7 +68,8 @@ public final class TracerConfig { // Use TRACE_HTTP_SERVER_ERROR_STATUSES instead @Deprecated public static final String HTTP_SERVER_ERROR_STATUSES = "http.server.error.statuses"; public static final String TRACE_HTTP_SERVER_ERROR_STATUSES = "trace.http.server.error.statuses"; - public static final String HTTP_CLIENT_ERROR_STATUSES = "http.client.error.statuses"; + // Use TRACE_HTTP_CLIENT_ERROR_STATUSES instead + @Deprecated public static final String HTTP_CLIENT_ERROR_STATUSES = "http.client.error.statuses"; public static final String TRACE_HTTP_CLIENT_ERROR_STATUSES = "trace.http.client.error.statuses"; public static final String SPLIT_BY_TAGS = "trace.split-by-tags";