Spring Boot Version: 3.1.6

Given a webflux application with metrics enabled, when a request is done to a non existing endpoint, the status tag is 200, instead of 404 (not found)

I have attached a sample application.
webflux-metrics.zip

To reproduce the issue

  • Start the application
  • Make a request to a non existing endpoint, for example to http://localhost:8080/non-existing
  • Check the metrics to the prometheus endpoint http://localhost:8080/actuator/prometheus
http_server_requests_seconds_count{error="ResponseStatusException",exception="ResponseStatusException",method="GET",outcome="SUCCESS",status="200",uri="/**",} 1.0
http_server_requests_seconds_sum{error="ResponseStatusException",exception="ResponseStatusException",method="GET",outcome="SUCCESS",status="200",uri="/**",} 0.005408

Notice the tag status="200"

Notice that with SpringBoot 3.1.5, it works correctly, having the status=404

Comment From: bclozel

This is due to a regression introduced by #31417.

Comment From: JordiMartinezVicent

@bclozel there would be some kind of workaround until the 6.0.15 is released?

Comment From: bclozel

@JordiMartinezVicent there is no workaround yet as I haven't found a proper fix for this issue and #31706 which is related.

Comment From: bclozel

@JordiMartinezVicent the problem is fixed now and should be available soon in 6.1.2-SNAPSHOT and 6.0.15-SNAPSHOT.

I haven't found a simple workaround before the release. I think the only alternatives are:

  • subclassing ServerHttpObservationFilter and applying the changes I made, and declaring it as a bean in your Spring Application
  • using Spring Framework SNAPSHOTs

Release dates are already scheduled and we have quite a few fixes for regressions and issues lined up.