diff --git a/spring-web/src/main/java/org/springframework/web/filter/ServerHttpObservationFilter.java b/spring-web/src/main/java/org/springframework/web/filter/ServerHttpObservationFilter.java index 58b99aa129..c6852aecd3 100644 --- a/spring-web/src/main/java/org/springframework/web/filter/ServerHttpObservationFilter.java +++ b/spring-web/src/main/java/org/springframework/web/filter/ServerHttpObservationFilter.java @@ -27,7 +27,6 @@ import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; -import org.springframework.http.HttpStatus; import org.springframework.http.observation.DefaultServerRequestObservationConvention; import org.springframework.http.observation.ServerHttpObservationDocumentation; import org.springframework.http.observation.ServerRequestObservationContext; @@ -117,7 +116,6 @@ public class ServerHttpObservationFilter extends OncePerRequestFilter { if (!request.isAsyncStarted()) { Throwable error = fetchException(request); if (error != null) { - response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value()); observation.error(error); } observation.stop(); diff --git a/spring-web/src/test/java/org/springframework/web/filter/ServerHttpObservationFilterTests.java b/spring-web/src/test/java/org/springframework/web/filter/ServerHttpObservationFilterTests.java index a574faeac4..649f1a07af 100644 --- a/spring-web/src/test/java/org/springframework/web/filter/ServerHttpObservationFilterTests.java +++ b/spring-web/src/test/java/org/springframework/web/filter/ServerHttpObservationFilterTests.java @@ -70,7 +70,7 @@ class ServerHttpObservationFilterTests { ServerRequestObservationContext context = (ServerRequestObservationContext) this.request .getAttribute(ServerHttpObservationFilter.CURRENT_OBSERVATION_CONTEXT_ATTRIBUTE); assertThat(context.getError()).isEqualTo(customError); - assertThatHttpObservation().hasLowCardinalityKeyValue("outcome", "SERVER_ERROR"); + assertThatHttpObservation().hasLowCardinalityKeyValue("exception", "IllegalArgumentException"); } @Test