private static StdRoute getGetMonitorRoute(restx.common.metrics.api.MetricRegistry metricRegistry) {
if (!(metricRegistry instanceof CodahaleMetricRegistry)){
throw new IllegalStateException("restx-monitor-admin expects that module restx-monitor-codahale is loaded");
}
CodahaleMetricRegistry codahaleMetricRegistry = (CodahaleMetricRegistry) metricRegistry;
final MetricRegistry metrics = codahaleMetricRegistry.getCodahaleMetricRegistry();
return new StdRoute("MonitorRoute", new StdRestxRequestMatcher("GET", "/@/monitor")) {
@Override
public void handle(RestxRequestMatch match, RestxRequest req, RestxResponse resp, RestxContext ctx) throws IOException {
resp.setStatus(HttpStatus.OK);