fix(ext/otel): don't mark server spans as error for 4xx responses#32722
Merged
bartlomieju merged 1 commit intomainfrom Mar 15, 2026
Merged
fix(ext/otel): don't mark server spans as error for 4xx responses#32722bartlomieju merged 1 commit intomainfrom
bartlomieju merged 1 commit intomainfrom
Conversation
Per OTel HTTP semantic conventions, server spans should only have ERROR status for 5xx responses. 4xx responses are client errors and should not be marked as errors on the server side. Client spans correctly continue to treat all >= 400 responses as errors. Split `updateSpanFromResponse` into `updateSpanFromClientResponse` (errors on >= 400) and `updateSpanFromServerResponse` (errors on >= 500). Fixes #29615 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
kajukitli
approved these changes
Mar 15, 2026
Contributor
kajukitli
left a comment
There was a problem hiding this comment.
Reviewed the changes with full repo context. No issues found.
crowlKats
approved these changes
Mar 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
updateSpanFromResponsetreated all >= 400 responses as errors regardless of span kind, causing 404s to show as faults/errors in tracing backends (AWS X-Ray, Grafana Tempo, etc.).updateSpanFromClientResponse(errors on >= 400) andupdateSpanFromServerResponse(errors on >= 500) with a sharedsetResponseAttributeshelper.Fixes #29615
Test plan
http_server_statusspec test covering 200, 404, and 500 responses with both client and server spanserror.type,status.code: 0(UNSET)error.type: "500",status.code: 2(ERROR)error.type: "404",status.code: 2(ERROR) — unchangedotel_basic::fetchtest passes (client-side behavior unchanged)🤖 Generated with Claude Code