Interface TimerRegistry


  • public interface TimerRegistry
    An extension point for measuring the execution of actions. E.g. use with DropWizard metrics to create a timer histogram for each action named WhateverController/whateverAction:
     MetricRegistry metricRegistry = new MetricRegistry()
     TimerRegistry counterRegistry = action -> {
          String name = ApiServlet.class.getSimpleName() + "/" + action.getMethodName();
          Timer histogram = metricRegistry.timer(name);
          return histogram::update;
     };
     apiServlet.setTimerRegistry(counterRegistry);