Skip to content

DefaultServerRequestObservationConvention throws when response status is zero #33725

@fisco-unimatic

Description

@fisco-unimatic

DefaultServerRequestObservationConvention#outcome tests whether the response is null, and if so, returns HTTP_OUTCOME_UNKNOWN.
Otherwise, it gets the HttpOutcome for the HttpStatusCode for the HttpServletResponse#getStatus.
Somehow, HttpServletResponse#getStatus is coming through as zero in my application (I don't know what implementation of HttpServletResponse this is - I can't see the code of the platform I'm running on - the implementations I can find default to 200), which causes HttpStatusCode#valueOf to throw an

IllegalArgumentException: Status code '0' should be a three-digit positive integer

I propose that DefaultServerRequestObservationConvention#outcome should catch this exception and return HTTP_OUTCOME_UNKNOWN. I can make a pull request if you want.

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)theme: observabilityAn issue related to observability and tracingtype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions