@Test public void testmarkAllErrorsAndEndRequestMonitoring() { DropwizardRequestMetrics.Context context = requestMetrics.startSavedSearchRequest("find", "name", "version"); List<Error> errors = new ArrayList<>(); Error error1 = Error.get("rest-crud:SavedSearchError"); Error error2 = Error.get("mongo-crud:DatabaseError"); errors.add(error1); errors.add(error2); context.markAllErrorsAndEndRequestMonitoring(errors); Counter activeRequestCounter = metricsRegistry.counter("request.saved-search.name.find.version.active"); Timer completedRequestTimer = metricsRegistry.timer("request.saved-search.name.find.version"); Meter restExceptionMeter = metricsRegistry.meter("request.saved-search.name.find.version.errors.rest-crud_SavedSearchError"); Meter mongoExceptionMeter = metricsRegistry.meter("request.saved-search.name.find.version.errors.mongo-crud_DatabaseError"); Assert.assertEquals(0, activeRequestCounter.getCount()); Assert.assertEquals(1, completedRequestTimer.getCount()); Assert.assertEquals(1, restExceptionMeter.getCount()); Assert.assertEquals(1, mongoExceptionMeter.getCount()); }
@Override public Context startSavedSearchRequest(String searchName, String entity, String version) { return new DropwizardContext(metricNamer.savedSearch(entity, searchName, version)); }
DropwizardRequestMetrics implements RequestMetrics { @Override public Context startSavedSearchRequest(String searchName, String entity, String version) { return new DropwizardContext(metricNamer.savedSearch(entity, searchName, version)); } }
DropwizardRequestMetrics implements RequestMetrics { @Override public Context startSavedSearchRequest(String searchName, String entity, String version) { return new DropwizardContext(metricNamer.savedSearch(entity, searchName, version)); } DropwizardRequestMetrics(MetricRegistry metricRegistry);  DropwizardRequestMetrics(MetricRegistry metricRegistry, MetricNamer metricNamer); }
DropwizardRequestMetrics implements RequestMetrics { @Override public Context startSavedSearchRequest(String searchName, String entity, String version) { return new DropwizardContext(metricNamer.savedSearch(entity, searchName, version)); } DropwizardRequestMetrics(MetricRegistry metricRegistry);  DropwizardRequestMetrics(MetricRegistry metricRegistry, MetricNamer metricNamer); static DropwizardRequestMetrics withDefaultMBeans(MetricRegistry registry); @Override Context startCrudRequest(String operation, String entity, String version); @Override Context startStreamingCrudRequest(String operation, String entity, String version); @Override Context startLockRequest(String lockOperation, String domain); @Override Context startHealthRequest(); @Override Context startDiagnosticsRequest(); @Override Context startSavedSearchRequest(String searchName, String entity, String version); @Override Context startBulkRequest(); @Override Context startGenerateRequest(String entity, String version, String field); }
DropwizardRequestMetrics implements RequestMetrics { @Override public Context startSavedSearchRequest(String searchName, String entity, String version) { return new DropwizardContext(metricNamer.savedSearch(entity, searchName, version)); } DropwizardRequestMetrics(MetricRegistry metricRegistry);  DropwizardRequestMetrics(MetricRegistry metricRegistry, MetricNamer metricNamer); static DropwizardRequestMetrics withDefaultMBeans(MetricRegistry registry); @Override Context startCrudRequest(String operation, String entity, String version); @Override Context startStreamingCrudRequest(String operation, String entity, String version); @Override Context startLockRequest(String lockOperation, String domain); @Override Context startHealthRequest(); @Override Context startDiagnosticsRequest(); @Override Context startSavedSearchRequest(String searchName, String entity, String version); @Override Context startBulkRequest(); @Override Context startGenerateRequest(String entity, String version, String field);  }