Commit a6ccdbe1 authored by Johnny Lim's avatar Johnny Lim Committed by Brian Clozel

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
parent 50d0b4df
...@@ -130,6 +130,10 @@ public class WebMvcMetricsFilter extends OncePerRequestFilter { ...@@ -130,6 +130,10 @@ public class WebMvcMetricsFilter extends OncePerRequestFilter {
record(timingContext, response, request, ex.getCause()); record(timingContext, response, request, ex.getCause());
throw ex; throw ex;
} }
catch (ServletException | IOException | RuntimeException ex) {
record(timingContext, response, request, ex);
throw ex;
}
} }
private TimingContext startAndAttachTimingContext(HttpServletRequest request) { private TimingContext startAndAttachTimingContext(HttpServletRequest request) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment