This commit is contained in:
Phillip Webb
2021-09-21 11:16:46 -07:00
parent 0a4d58f221
commit cfeafee826
2 changed files with 36 additions and 17 deletions

View File

@@ -106,11 +106,15 @@ public class WebMvcMetricsFilter extends OncePerRequestFilter {
}
catch (Exception ex) {
response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
record(timingContext, request, response, (ex instanceof NestedServletException) ? ex.getCause() : ex);
record(timingContext, request, response, unwrapNestedServletException(ex));
throw ex;
}
}
private Throwable unwrapNestedServletException(Throwable ex) {
return (ex instanceof NestedServletException) ? ex.getCause() : ex;
}
private TimingContext startAndAttachTimingContext(HttpServletRequest request) {
Timer.Sample timerSample = Timer.start(this.registry);
TimingContext timingContext = new TimingContext(timerSample);