Skip to content

Commit a6ccdbe

Browse files
izeyebclozel
authored andcommitted
Handle missing exceptions in WebMvcMetricsFilter
Prior to this commit, exceptions nested in `NestedServletExceptions` would not be recorded by the `WebMvcMetricsFilter`. This commit ensures that exceptions happening downstream (e.g. happening while writing the response body itself) are properly recorded. See micrometer-metrics/micrometer#1190 See gh-16014
1 parent 50d0b4d commit a6ccdbe

File tree

1 file changed

+4
-0
lines changed
  • spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet

1 file changed

+4
-0
lines changed

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilter.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ private void filterAndRecordMetrics(HttpServletRequest request,
130130
record(timingContext, response, request, ex.getCause());
131131
throw ex;
132132
}
133+
catch (ServletException | IOException | RuntimeException ex) {
134+
record(timingContext, response, request, ex);
135+
throw ex;
136+
}
133137
}
134138

135139
private TimingContext startAndAttachTimingContext(HttpServletRequest request) {

0 commit comments

Comments
 (0)