@Test // issue #6 public void testThatEmptyMetricsDoNotResultInBrokenBulkRequest() throws Exception { long connectionsBeforeReporting = getTotalHttpConnections(); elasticsearchReporter.report(); long connectionsAfterReporting = getTotalHttpConnections(); org.assertj.core.api.Assertions.assertThat(connectionsAfterReporting) .isEqualTo(connectionsBeforeReporting); }
private ElasticsearchReporter.Builder createElasticsearchReporterBuilder() { Map<String, Object> additionalFields = new HashMap<>(); additionalFields.put("host", "localhost"); return ElasticsearchReporter.forRegistry(registry) .hosts("localhost:" + getPortOfRunningNode()) .prefixedWith(prefix) .convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS) .filter(MetricFilter.ALL) .index(index) .additionalFields(additionalFields); }
private void reportAndRefresh() { elasticsearchReporter.report(); client().admin().indices().prepareRefresh(indexWithDate).execute().actionGet(); }