Skip to content

Commit 2206ee2

Browse files
committed
Include 5xx responses in default HTTP client error statuses
Default client error range was 4xx only, so downstream HTTP spans did not mark 5xx responses as errors. Align defaults with server-side semantics by treating 500-599 as errors unless overridden. Fixes #10245 Made-with: Cursor
1 parent 7eef6a0 commit 2206ee2

8 files changed

Lines changed: 12 additions & 13 deletions

File tree

dd-java-agent/agent-bootstrap/src/test/groovy/datadog/trace/bootstrap/instrumentation/decorator/HttpClientDecoratorTest.groovy

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,8 @@ class HttpClientDecoratorTest extends ClientDecoratorTest {
200200
399 | [status: 399] | false
201201
400 | [status: 400] | true
202202
499 | [status: 499] | true
203-
500 | [status: 500] | false
204-
500 | [status: 500] | false
205-
500 | [status: 500] | false
203+
500 | [status: 500] | true
204+
599 | [status: 599] | true
206205
600 | [status: 600] | false
207206
null | [status: null] | false
208207
null | null | false

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ abstract class HttpClientTest extends VersionedNamingTestBase {
369369
trace(size(2)) {
370370
sortSpansByStart()
371371
basicSpan(it, "parent")
372-
clientSpan(it, span(0), method, false, false, uri, 500, false) // not an error.
372+
clientSpan(it, span(0), method, false, false, uri, 500, true)
373373
}
374374
server.distributedRequestTrace(it, trace(0).last())
375375
}

dd-java-agent/instrumentation/spring/spring-webflux/spring-webflux-5.0/src/bootTest/groovy/SpringWebfluxTest.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,8 @@ class SpringWebfluxTest extends InstrumentationSpecification {
416416
sortSpansByStart()
417417
def traceParent
418418
trace(2) {
419-
clientSpan(it, null, "http.request", "spring-webflux-client", "GET", URI.create(url), 500)
420-
traceParent = clientSpan(it, span(0), "netty.client.request", "netty-client", "GET", URI.create(url), 500)
419+
clientSpan(it, null, "http.request", "spring-webflux-client", "GET", URI.create(url), 500, true)
420+
traceParent = clientSpan(it, span(0), "netty.client.request", "netty-client", "GET", URI.create(url), 500, true)
421421
}
422422
trace(2) {
423423
span {

dd-java-agent/instrumentation/spring/spring-webflux/spring-webflux-6.0/src/bootTest/groovy/SpringWebfluxTest.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,8 @@ class SpringWebfluxHttp11Test extends InstrumentationSpecification {
414414
sortSpansByStart()
415415
def traceParent
416416
trace(2) {
417-
clientSpan(it, null, "http.request", "spring-webflux-client", "GET", URI.create(url), 500)
418-
traceParent = clientSpan(it, span(0), "netty.client.request", "netty-client", "GET", URI.create(url), 500)
417+
clientSpan(it, null, "http.request", "spring-webflux-client", "GET", URI.create(url), 500, true)
418+
traceParent = clientSpan(it, span(0), "netty.client.request", "netty-client", "GET", URI.create(url), 500, true)
419419
}
420420
trace(2) {
421421
span {

dd-trace-api/src/main/java/datadog/trace/api/ConfigDefaults.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public final class ConfigDefaults {
2525
DEFAULT_HTTP_SERVER_ERROR_STATUSES = new BitSet();
2626
DEFAULT_HTTP_SERVER_ERROR_STATUSES.set(500, 600);
2727
DEFAULT_HTTP_CLIENT_ERROR_STATUSES = new BitSet();
28-
DEFAULT_HTTP_CLIENT_ERROR_STATUSES.set(400, 500);
28+
DEFAULT_HTTP_CLIENT_ERROR_STATUSES.set(400, 600);
2929
DEFAULT_GRPC_SERVER_ERROR_STATUSES = new BitSet();
3030
DEFAULT_GRPC_SERVER_ERROR_STATUSES.set(2, 17);
3131
DEFAULT_GRPC_CLIENT_ERROR_STATUSES = new BitSet();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class ConfigCollectorTest extends DDSpecification {
117117
GeneralConfig.TELEMETRY_HEARTBEAT_INTERVAL | new Float(DEFAULT_TELEMETRY_HEARTBEAT_INTERVAL).toString()
118118
CiVisibilityConfig.CIVISIBILITY_GRADLE_SOURCE_SETS | "main,test"
119119
IastConfig.IAST_WEAK_HASH_ALGORITHMS | DEFAULT_IAST_WEAK_HASH_ALGORITHMS.join(",")
120-
TracerConfig.TRACE_HTTP_CLIENT_ERROR_STATUSES | "400-500"
120+
TracerConfig.TRACE_HTTP_CLIENT_ERROR_STATUSES | "400-600"
121121
}
122122

123123
def "default null config settings are also collected"() {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,7 @@ class ConfigTest extends DDSpecification {
11221122
config.requestHeaderTags == [:]
11231123
config.baggageMapping == [:]
11241124
config.httpServerErrorStatuses == toBitSet((500..599))
1125-
config.httpClientErrorStatuses == toBitSet((400..499))
1125+
config.httpClientErrorStatuses == toBitSet((400..599))
11261126
config.httpClientSplitByDomain == false
11271127
config.dbClientSplitByInstance == false
11281128
config.dbClientSplitByInstanceTypeSuffix == false

metadata/supported-configurations.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,7 +1613,7 @@
16131613
{
16141614
"version": "A",
16151615
"type": "string",
1616-
"default": "400-499",
1616+
"default": "400-600",
16171617
"aliases": []
16181618
}
16191619
],
@@ -6261,7 +6261,7 @@
62616261
{
62626262
"version": "A",
62636263
"type": "string",
6264-
"default": "400-499",
6264+
"default": "400-600",
62656265
"aliases": ["DD_HTTP_CLIENT_ERROR_STATUSES"]
62666266
}
62676267
],

0 commit comments

Comments
 (0)