use of org.collectd.api.ValueList in project jcollectd by collectd.
the class ValueListTest method dummyValueList.
private ValueList dummyValueList() {
ValueList vl = new ValueList();
vl.setHost(HOST);
vl.setInterval(interval);
vl.setTime(now);
vl.setPlugin(PLUGIN);
vl.setPluginInstance(ValueListTest.class.getName());
for (int i = 0; i < values.length; i++) {
vl.addValue(new Double(values[i]));
}
return vl;
}
use of org.collectd.api.ValueList in project metrics by dropwizard.
the class CollectdReporterTest method sanitizesMetricName.
@Test
public void sanitizesMetricName() throws Exception {
Counter counter = registry.counter("dash-illegal.slash/illegal");
counter.inc();
reporter.report();
ValueList values = receiver.next();
assertThat(values.getPlugin()).isEqualTo("dash_illegal.slash_illegal");
}
use of org.collectd.api.ValueList in project metrics by dropwizard.
the class CollectdReporterTest method reportsBooleanGauges.
@Test
public void reportsBooleanGauges() throws Exception {
reporter.report(map("gauge", (Gauge) () -> true), map(), map(), map(), map());
ValueList data = receiver.next();
assertThat(data.getValues()).containsExactly(1d);
reporter.report(map("gauge", (Gauge) () -> false), map(), map(), map(), map());
data = receiver.next();
assertThat(data.getValues()).containsExactly(0d);
}
use of org.collectd.api.ValueList in project metrics by dropwizard.
the class Receiver method before.
@Override
protected void before() throws Throwable {
receiver = new UdpReceiver(new Dispatcher() {
@Override
public void dispatch(ValueList values) {
queue.offer(new ValueList(values));
}
@Override
public void dispatch(Notification notification) {
throw new UnsupportedOperationException();
}
});
receiver.setPort(port);
new Thread(() -> {
try {
receiver.listen();
} catch (Exception e) {
e.printStackTrace();
}
}).start();
}
use of org.collectd.api.ValueList in project jcollectd by collectd.
the class ValueListTest method testWriter.
public void testWriter() throws IOException {
ValueList vl = dummyValueList();
PacketWriter pw = new PacketWriter();
pw.write(vl);
UdpReceiver receiver = new UdpReceiver();
TestPacketDispatcher dispatcher = new TestPacketDispatcher();
receiver.setDispatcher(dispatcher);
receiver.parse(pw.getBytes());
}
Aggregations