@Test public void testMetricsRegistryForRequestToDatabase() { var requestContext = createRequest(URI_METRICS_DATABASE); handler.getMetricsRegistry(requestContext, DATABASE); verify(handler.metrics, times(1)).registry(eq(requestContext.getDBName())); }
MetricRegistry getMetricsRegistry(MongoRequest request, METRICS_GATHERING_LEVEL metricsLevel) { switch (metricsLevel) { case ROOT: return metrics.registry(); case DATABASE: return metrics.registry(request.getDBName()); case COLLECTION: return metrics.registry(request.getDBName(), request.getCollectionName()); default: return null; } }
MetricsHandler extends PipelinedHandler { MetricRegistry getMetricsRegistry(MongoRequest request, METRICS_GATHERING_LEVEL metricsLevel) { switch (metricsLevel) { case ROOT: return metrics.registry(); case DATABASE: return metrics.registry(request.getDBName()); case COLLECTION: return metrics.registry(request.getDBName(), request.getCollectionName()); default: return null; } } }
MetricsHandler extends PipelinedHandler { MetricRegistry getMetricsRegistry(MongoRequest request, METRICS_GATHERING_LEVEL metricsLevel) { switch (metricsLevel) { case ROOT: return metrics.registry(); case DATABASE: return metrics.registry(request.getDBName()); case COLLECTION: return metrics.registry(request.getDBName(), request.getCollectionName()); default: return null; } } MetricsHandler();  MetricsHandler(PipelinedHandler next); }
MetricsHandler extends PipelinedHandler { MetricRegistry getMetricsRegistry(MongoRequest request, METRICS_GATHERING_LEVEL metricsLevel) { switch (metricsLevel) { case ROOT: return metrics.registry(); case DATABASE: return metrics.registry(request.getDBName()); case COLLECTION: return metrics.registry(request.getDBName(), request.getCollectionName()); default: return null; } } MetricsHandler();  MetricsHandler(PipelinedHandler next); @Override void handleRequest(HttpServerExchange exchange); }
MetricsHandler extends PipelinedHandler { MetricRegistry getMetricsRegistry(MongoRequest request, METRICS_GATHERING_LEVEL metricsLevel) { switch (metricsLevel) { case ROOT: return metrics.registry(); case DATABASE: return metrics.registry(request.getDBName()); case COLLECTION: return metrics.registry(request.getDBName(), request.getCollectionName()); default: return null; } } MetricsHandler();  MetricsHandler(PipelinedHandler next); @Override void handleRequest(HttpServerExchange exchange);  }