Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions reqwest-tracing/src/reqwest_otel_span_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
Loading