dropwizard/metrics — pull request #652 by noslowerdna (2014-09-08 15:24:14+00:00)
Title: Intercept HttpServletResponseWrapper#setStatus(int, String) to fix response status tracking

We are using version 2.2.0 of the metrics library and noticed that the WebappMetricsFilter (renamed in v3 to AbstractInstrumentedFilter) was recording a high number of 'responseCodes.other' responses for our services, and 0 for most other response types, include 'responseCodes.ok'. After a little debugging, found that this was due to HttpServletResponseWrapper#setStatus(int, String) being called to set the response status, and this method not getting intercepted in the WebappMetricFilter's StatusExposingServletResponse. In metrics-web 2.2.0 the StatusExposingServletResponse's httpStatus variable is not initialized (that was changed in v3 to default to 200), so the response status appears to the filter to be 0, associating it to the 'other' meter.