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 https://github.com/micrometer-metrics/micrometer/issues/1190
See gh-16014
pull/16246/head
Johnny Lim 6 years ago committed by Brian Clozel
parent 50d0b4df46
commit a6ccdbe19f

@ -130,6 +130,10 @@ public class WebMvcMetricsFilter extends OncePerRequestFilter {
record(timingContext, response, request, ex.getCause());
throw ex;
}
catch (ServletException | IOException | RuntimeException ex) {
record(timingContext, response, request, ex);
throw ex;
}
}
private TimingContext startAndAttachTimingContext(HttpServletRequest request) {

Loading…
Cancel
Save