From e79d8bc2e0b05aada2b4113261fa7a94433f2bfc Mon Sep 17 00:00:00 2001 From: Tom Judge <157825077+tj-cisco@users.noreply.github.com> Date: Sun, 16 Nov 2025 18:40:21 -0500 Subject: [PATCH 1/2] Client span status update. The Semantic conventions for HTTP client spans have change, the error status for 4xx errors has changed from MUST to SHOULD. Do not set span status, for common 'normal' 4xx status codes (404 and 401). --- reqwest-tracing/src/reqwest_otel_span_builder.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/reqwest-tracing/src/reqwest_otel_span_builder.rs b/reqwest-tracing/src/reqwest_otel_span_builder.rs index f034b08..c7e86a0 100644 --- a/reqwest-tracing/src/reqwest_otel_span_builder.rs +++ b/reqwest-tracing/src/reqwest_otel_span_builder.rs @@ -188,9 +188,14 @@ fn get_span_status(request_status: RequestStatusCode) -> Option<&'static str> { // another error (e.g., network error receiving the response body; or 3xx codes with max redirects exceeded), // in which case status MUST be set to Error. 100..=399 => None, - // For HTTP status codes in the 4xx range span status MUST be left unset in case of SpanKind.SERVER and MUST be - // set to Error in case of SpanKind.CLIENT. - 400..=499 => Some("ERROR"), + // For HTTP status codes in the 4xx range span status MUST be left unset in case of SpanKind.SERVER and SHOULD be + // set to Error in case of SpanKind.CLIENT. Do not set the span status for 401 and 404, the status of these spans + // should be interpreted by the parent application span and set on that span. + 400 => Some("ERROR"), + 401 => None, + 402..=403 => Some("ERROR"), + 404 => None, + 405..=499 => Some("ERROR"), // For HTTP status codes in the 5xx range, as well as any other code the client failed to interpret, span // status MUST be set to Error. _ => Some("ERROR"), From e5f29109bd35f2d95dd696a21c2e5369eecb304e Mon Sep 17 00:00:00 2001 From: Tom Judge <157825077+tj-cisco@users.noreply.github.com> Date: Sun, 16 Nov 2025 18:44:37 -0500 Subject: [PATCH 2/2] Fix trailing space --- reqwest-tracing/src/reqwest_otel_span_builder.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reqwest-tracing/src/reqwest_otel_span_builder.rs b/reqwest-tracing/src/reqwest_otel_span_builder.rs index c7e86a0..6d30eff 100644 --- a/reqwest-tracing/src/reqwest_otel_span_builder.rs +++ b/reqwest-tracing/src/reqwest_otel_span_builder.rs @@ -189,7 +189,7 @@ fn get_span_status(request_status: RequestStatusCode) -> Option<&'static str> { // in which case status MUST be set to Error. 100..=399 => None, // For HTTP status codes in the 4xx range span status MUST be left unset in case of SpanKind.SERVER and SHOULD be - // set to Error in case of SpanKind.CLIENT. Do not set the span status for 401 and 404, the status of these spans + // set to Error in case of SpanKind.CLIENT. Do not set the span status for 401 and 404, the status of these spans // should be interpreted by the parent application span and set on that span. 400 => Some("ERROR"), 401 => None,