Search in sources :

Example 6 with Counter

use of io.dropwizard.metrics.Counter in project light-4j by networknt.

the class ConsoleReporterTest method reportsCounterValues.

@Test
public void reportsCounterValues() throws Exception {
    final Counter counter = mock(Counter.class);
    when(counter.getCount()).thenReturn(100L);
    reporter.report(this.map(), map("test.counter", counter), this.map(), this.map(), this.map());
    assertThat(consoleOutput()).isEqualTo(lines("3/17/13 6:04:36 PM =============================================================", "", "-- Counters --------------------------------------------------------------------", "test.counter", "             count = 100", "", ""));
}
Also used : Counter(io.dropwizard.metrics.Counter) Test(org.junit.Test)

Example 7 with Counter

use of io.dropwizard.metrics.Counter in project light-4j by networknt.

the class Slf4jReporterTest method reportsCounterValuesAtError.

@Test
public void reportsCounterValuesAtError() throws Exception {
    final Counter counter = mock(Counter.class);
    when(counter.getCount()).thenReturn(100L);
    when(logger.isErrorEnabled(marker)).thenReturn(true);
    errorReporter.report(this.map(), map("test.counter", counter), this.map(), this.map(), this.map());
    verify(logger).error(marker, "type={}, name={}, count={}", "COUNTER", "test.counter", 100L);
}
Also used : Counter(io.dropwizard.metrics.Counter) Test(org.junit.Test)

Example 8 with Counter

use of io.dropwizard.metrics.Counter in project light-4j by networknt.

the class Slf4jReporterTest method reportsCounterValues.

@Test
public void reportsCounterValues() throws Exception {
    final Counter counter = mock(Counter.class);
    when(counter.getCount()).thenReturn(100L);
    when(logger.isInfoEnabled(marker)).thenReturn(true);
    infoReporter.report(this.map(), map("test.counter", counter), this.map(), this.map(), this.map());
    verify(logger).info(marker, "type={}, name={}, count={}", "COUNTER", "prefix.test.counter", 100L);
}
Also used : Counter(io.dropwizard.metrics.Counter) Test(org.junit.Test)

Aggregations

Counter (io.dropwizard.metrics.Counter)8 Test (org.junit.Test)7 Meter (io.dropwizard.metrics.Meter)3 Timer (io.dropwizard.metrics.Timer)3 InstrumentedExecutorService (io.dropwizard.metrics.InstrumentedExecutorService)2 Gauge (io.dropwizard.metrics.Gauge)1 Histogram (io.dropwizard.metrics.Histogram)1 MetricName (io.dropwizard.metrics.MetricName)1 InfluxDbPoint (io.dropwizard.metrics.influxdb.data.InfluxDbPoint)1 ArrayList (java.util.ArrayList)1