Open
Description
When debugging traces in Jaeger, HTTP 4xx status codes (e.g., 401 Unauthorized) aren’t tagged as errors in the root span, even when child spans indicate errors. This makes it hard to filter failing traces using tags={"error":"true"}
.
Steps to Reproduce
- Send a request to an Echo endpoint (e.g.,
/v1/auth/login
) that returns a 401 status code. - Query Jaeger:
curl 'http://localhost:16686/api/traces?service=jaeger-nl-demo&tags={"http.method":"POST"}'
→ Returns the trace withhttp.status_code=401
.curl 'http://localhost:16686/api/traces?service=jaeger-nl-demo&tags={"error":"true"}'
→ Returns nothing because the root span lackserror=true
.
- Check the trace:
- Root span (
/v1/auth/login
):http.status_code=401
, noerror=true
. - Child span (
validateCredentials
):error=true
.
- Root span (
Expected Behavior
Optionally allow 4xx status codes to set otel.status_code=ERROR
and error=true
in the root span, so traces with application-level failures (e.g., 401) can be filtered as errors in Jaeger.
Actual Behavior
Only 5xx codes set error=true
in the root span, leaving 4xx traces unfilterable as errors.
Proposed Solution
PR #6973 adds a ClientErrorsAsSpanErrors
config option to otelecho
middleware, enabling 4xx codes to be treated as errors when set to true
. Feedback welcome!
Metadata
Metadata
Assignees
Labels
No labels