@Test public void testMetricReporting() throws Exception { String retentionPolicy = "one_hour"; MetricRegistryImpl metricRegistry = createMetricRegistry(retentionPolicy); try { String metricName = "TestCounter"; Counter counter = registerTestMetric(metricName, metricRegistry); counter.inc(42); stubFor(post(urlPathEqualTo("/write")) .willReturn(aResponse() .withStatus(200))); InfluxdbReporter reporter = (InfluxdbReporter) metricRegistry.getReporters().get(0); reporter.report(); verify(postRequestedFor(urlPathEqualTo("/write")) .withQueryParam("db", equalTo(TEST_INFLUXDB_DB)) .withQueryParam("rp", equalTo(retentionPolicy)) .withHeader("Content-Type", containing("text/plain")) .withRequestBody(containing("taskmanager_" + metricName + ",host=" + METRIC_HOSTNAME + ",tm_id=" + METRIC_TM_ID + " count=42i"))); } finally { metricRegistry.shutdown().get(); } }
@Override public void report() { BatchPoints report = buildReport(); if (report != null) { influxDB.write(report); } }
InfluxdbReporter extends AbstractReporter<MeasurementInfo> implements Scheduled { @Override public void report() { BatchPoints report = buildReport(); if (report != null) { influxDB.write(report); } } }
InfluxdbReporter extends AbstractReporter<MeasurementInfo> implements Scheduled { @Override public void report() { BatchPoints report = buildReport(); if (report != null) { influxDB.write(report); } } InfluxdbReporter(); }
InfluxdbReporter extends AbstractReporter<MeasurementInfo> implements Scheduled { @Override public void report() { BatchPoints report = buildReport(); if (report != null) { influxDB.write(report); } } InfluxdbReporter(); @Override void open(MetricConfig config); @Override void close(); @Override void report(); }
InfluxdbReporter extends AbstractReporter<MeasurementInfo> implements Scheduled { @Override public void report() { BatchPoints report = buildReport(); if (report != null) { influxDB.write(report); } } InfluxdbReporter(); @Override void open(MetricConfig config); @Override void close(); @Override void report();  }