File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -62,8 +62,17 @@ func Middleware(componentName string) echo.MiddlewareFunc {
6262 if status := c .Response ().Status ; status >= 0 && status <= 65535 {
6363 ext .HTTPStatusCode .Set (sp , uint16 (status ))
6464 } else {
65- // Either use a default value or log the issue
66- ext .HTTPStatusCode .Set (sp , 0 ) // Using 0 to indicate invalid status
65+ // Set a valid status code in the trace
66+ ext .HTTPStatusCode .Set (sp , uint16 (http .StatusInternalServerError ))
67+
68+ // Update the actual response status if it hasn't been sent yet
69+ if ! c .Response ().Committed {
70+ c .Response ().Status = http .StatusInternalServerError
71+ }
72+
73+ // Add error tag to span
74+ sp .SetTag ("error.type" , "invalid_status_code" )
75+ sp .SetTag ("error.message" , "Invalid HTTP status detected" )
6776 }
6877
6978 return nil
You can’t perform that action at this time.
0 commit comments