You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our application supports cancellation of ongoing HTTP requests. When a request is cancelled we return HTTP status 499 which we have defined in our application for this purpose because no other status code seemed appropriate.
We noticed that our tracing spans for cancelled requests are marked as errors and after some investigation I have found that validateHTTPStatusCode() actually checks that the status code is one of the well-known defined status codes. However, my understanding of HTTP status codes is that they are meant to be extensible. Yet there is no way for me to add my custom status code to the validRangesPerCategory map.
HTTP status codes are extensible. HTTP applications are not required to understand the meaning of all registered status codes, though such understanding is obviously desirable. However, applications MUST understand the class of any status code, as indicated by the first digit, and treat any unrecognized response as being equivalent to the x00 status code of that class, with the exception that an unrecognized response MUST NOT be cached. For example, if an unrecognized status code of 431 is received by the client, it can safely assume that there was something wrong with its request and treat the response as if it had received a 400 status code. In such cases, user agents SHOULD present to the user the entity returned with the response, since that entity is likely to include human-readable information which will explain the unusual status.
I would first like to understand if strict validation of well-known status codes is actually necessary. I think it would be enough to check that the code is simply within the 1XX to 5XX range.
Environment
OS: Ubuntu 20.04
Architecture: x86
Go Version: 1.20.3
opentelemetry-go version: v0.14.0
Steps To Reproduce
Use otelhttp.NewHandler() middleware to instrument an HTTP endpoint
Return a custom HTTP status from the endpoint. Eg. 499
Observe the span has the error attribute set to true
Expected behavior
I expected that the tracing middleware shouldn't care about the specific HTTP status, only the category. And a 4XX, even if it's not a well-known HTTP status, should not set error=true on the span.
The text was updated successfully, but these errors were encountered:
Description
Our application supports cancellation of ongoing HTTP requests. When a request is cancelled we return HTTP status 499 which we have defined in our application for this purpose because no other status code seemed appropriate.
We noticed that our tracing spans for cancelled requests are marked as errors and after some investigation I have found that validateHTTPStatusCode() actually checks that the status code is one of the well-known defined status codes. However, my understanding of HTTP status codes is that they are meant to be extensible. Yet there is no way for me to add my custom status code to the validRangesPerCategory map.
From RFC2616:
I would first like to understand if strict validation of well-known status codes is actually necessary. I think it would be enough to check that the code is simply within the 1XX to 5XX range.
Environment
Steps To Reproduce
otelhttp.NewHandler()
middleware to instrument an HTTP endpointtrue
Expected behavior
I expected that the tracing middleware shouldn't care about the specific HTTP status, only the category. And a 4XX, even if it's not a well-known HTTP status, should not set error=true on the span.
The text was updated successfully, but these errors were encountered: