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
This commit is contained in:
Johnny Lim 2019-02-22 10:09:39 +09:00 committed by Brian Clozel
parent 50d0b4df46
commit a6ccdbe19f

View File

@ -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) {