|
@@ -24,9 +24,9 @@ import cn.com.qmth.examcloud.web.support.ApiInfo;
|
|
*/
|
|
*/
|
|
public class StatisticInterceptor implements HandlerInterceptor {
|
|
public class StatisticInterceptor implements HandlerInterceptor {
|
|
|
|
|
|
- private MetricRegistry metrics = new MetricRegistry();
|
|
|
|
|
|
+ private MetricRegistry metricRegistry = new MetricRegistry();
|
|
|
|
|
|
- ConsoleReporter reporter = ConsoleReporter.forRegistry(metrics).convertRatesTo(TimeUnit.SECONDS)
|
|
|
|
|
|
+ ConsoleReporter reporter = ConsoleReporter.forRegistry(metricRegistry).convertRatesTo(TimeUnit.SECONDS)
|
|
.convertDurationsTo(TimeUnit.MILLISECONDS).build();
|
|
.convertDurationsTo(TimeUnit.MILLISECONDS).build();
|
|
|
|
|
|
public StatisticInterceptor() {
|
|
public StatisticInterceptor() {
|
|
@@ -44,7 +44,7 @@ public class StatisticInterceptor implements HandlerInterceptor {
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
- Timer timer = metrics
|
|
|
|
|
|
+ Timer timer = metricRegistry
|
|
.timer(MetricRegistry.name(apiInfo.getMapping(), apiInfo.getDescription()));
|
|
.timer(MetricRegistry.name(apiInfo.getMapping(), apiInfo.getDescription()));
|
|
Context ctx = timer.time();
|
|
Context ctx = timer.time();
|
|
request.setAttribute(HttpServletRequestAttribute.$_METRICS_TIMER_CTX.name(), ctx);
|
|
request.setAttribute(HttpServletRequestAttribute.$_METRICS_TIMER_CTX.name(), ctx);
|