Search in sources :

Example 11 with ValueList

use of org.collectd.api.ValueList in project metrics by dropwizard.

the class CollectdReporterTest method reportsCounters.

@Test
public void reportsCounters() throws Exception {
    Counter counter = mock(Counter.class);
    when(counter.getCount()).thenReturn(42L);
    reporter.report(map(), map("api.rest.requests.count", counter), map(), map(), map());
    ValueList data = receiver.next();
    assertThat(data.getValues()).containsExactly(42d);
}
Also used : Counter(com.codahale.metrics.Counter) ValueList(org.collectd.api.ValueList) Test(org.junit.Test)

Example 12 with ValueList

use of org.collectd.api.ValueList in project metrics by dropwizard.

the class CollectdReporterTest method reportsGauges.

private <T extends Number> void reportsGauges(T value) throws Exception {
    reporter.report(map("gauge", (Gauge) () -> value), map(), map(), map(), map());
    ValueList data = receiver.next();
    assertThat(data.getValues()).containsExactly(value.doubleValue());
}
Also used : ValueList(org.collectd.api.ValueList) Gauge(com.codahale.metrics.Gauge)

Aggregations

ValueList (org.collectd.api.ValueList)12 Test (org.junit.Test)3 Counter (com.codahale.metrics.Counter)2 Gauge (com.codahale.metrics.Gauge)2 IOException (java.io.IOException)1 DataSource (org.collectd.api.DataSource)1 Notification (org.collectd.api.Notification)1 Dispatcher (org.collectd.protocol.Dispatcher)1 UdpReceiver (org.collectd.protocol.UdpReceiver)1