use of wavefront.report.ReportPoint in project java by wavefrontHQ.
the class GraphiteDecoderTest method testMONIT2576.
@Test
public void testMONIT2576() {
GraphiteDecoder decoder = new GraphiteDecoder(emptyCustomSourceTags);
List<ReportPoint> out = Lists.newArrayList();
decoder.decodeReportPoints("vm.guest.virtualDisk.mediumSeeks.latest 4.00 1439250320 " + "host=iadprdhyp02.iad.corp.com guest=47173170-2069-4bcc-9bd4-041055b554ec " + "instance=ide0_0", out, "customer");
ReportPoint point = out.get(0);
assertEquals("customer", point.getTable());
assertEquals("vm.guest.virtualDisk.mediumSeeks.latest", point.getMetric());
assertEquals("iadprdhyp02.iad.corp.com", point.getHost());
assertEquals("47173170-2069-4bcc-9bd4-041055b554ec", point.getAnnotations().get("guest"));
assertEquals("ide0_0", point.getAnnotations().get("instance"));
assertEquals(4.0, point.getValue());
out = new ArrayList<>();
try {
decoder.decodeReportPoints("test.metric 1 host=test test=\"", out, "customer");
fail("should throw");
} catch (Exception ignored) {
}
}
use of wavefront.report.ReportPoint in project java by wavefrontHQ.
the class GraphiteDecoderTest method testDecodeWithNoCustomerWithNoTags.
@Test
public void testDecodeWithNoCustomerWithNoTags() throws Exception {
GraphiteDecoder decoder = new GraphiteDecoder(emptyCustomSourceTags);
List<ReportPoint> out = Lists.newArrayList();
decoder.decodeReportPoints("vehicle.charge.battery_level 93", out, "customer");
ReportPoint point = out.get(0);
assertEquals("customer", point.getTable());
assertEquals("vehicle.charge.battery_level", point.getMetric());
assertEquals(93.0, point.getValue());
}
use of wavefront.report.ReportPoint in project java by wavefrontHQ.
the class GraphiteDecoderTest method testDoubleFormat.
@Test
public void testDoubleFormat() throws Exception {
GraphiteDecoder decoder = new GraphiteDecoder("localhost", emptyCustomSourceTags);
List<ReportPoint> out = new ArrayList<>();
decoder.decodeReportPoints("tsdb.vehicle.charge.battery_level 93.123e3 host=vehicle_2554", out);
ReportPoint point = out.get(0);
assertEquals("tsdb", point.getTable());
assertEquals("vehicle.charge.battery_level", point.getMetric());
assertEquals(93123.0, point.getValue());
assertEquals("vehicle_2554", point.getHost());
out = new ArrayList<>();
decoder.decodeReportPoints("tsdb.vehicle.charge.battery_level -93.123e3 host=vehicle_2554", out);
point = out.get(0);
assertEquals("tsdb", point.getTable());
assertEquals("vehicle.charge.battery_level", point.getMetric());
assertEquals(-93123.0, point.getValue());
assertEquals("vehicle_2554", point.getHost());
out = new ArrayList<>();
decoder.decodeReportPoints("tsdb.vehicle.charge.battery_level -93.123e3", out);
point = out.get(0);
assertEquals("tsdb", point.getTable());
assertEquals("vehicle.charge.battery_level", point.getMetric());
assertEquals(-93123.0, point.getValue());
assertEquals("localhost", point.getHost());
assertNotNull(point.getAnnotations());
assertTrue(point.getAnnotations().isEmpty());
out = new ArrayList<>();
decoder.decodeReportPoints("tsdb.vehicle.charge.battery_level 93.123e-3 host=vehicle_2554", out);
point = out.get(0);
assertEquals("tsdb", point.getTable());
assertEquals("vehicle.charge.battery_level", point.getMetric());
assertEquals(0.093123, point.getValue());
assertEquals("vehicle_2554", point.getHost());
out = new ArrayList<>();
decoder.decodeReportPoints("tsdb.vehicle.charge.battery_level -93.123e-3 host=vehicle_2554", out);
point = out.get(0);
assertEquals("tsdb", point.getTable());
assertEquals("vehicle.charge.battery_level", point.getMetric());
assertEquals(-0.093123, point.getValue());
assertEquals("vehicle_2554", point.getHost());
List<ReportPoint> points = Lists.newArrayList();
decoder.decodeReportPoints("test.devnag.10 100 host=ip1", points, "tsdb");
point = points.get(0);
assertEquals("tsdb", point.getTable());
assertEquals("test.devnag.10", point.getMetric());
assertEquals(100.0, point.getValue());
assertEquals("ip1", point.getHost());
points.clear();
decoder.decodeReportPoints("test.devnag.10 100 host=ip1 a=500", points, "tsdb");
point = points.get(0);
assertEquals("tsdb", point.getTable());
assertEquals("test.devnag.10", point.getMetric());
assertEquals(100.0, point.getValue());
assertEquals("ip1", point.getHost());
assertEquals(1, point.getAnnotations().size());
assertEquals("500", point.getAnnotations().get("a"));
points.clear();
decoder.decodeReportPoints("test.devnag.10 100 host=ip1 b=500", points, "tsdb");
point = points.get(0);
assertEquals("tsdb", point.getTable());
assertEquals("test.devnag.10", point.getMetric());
assertEquals(100.0, point.getValue());
assertEquals("ip1", point.getHost());
assertEquals(1, point.getAnnotations().size());
assertEquals("500", point.getAnnotations().get("b"));
points.clear();
decoder.decodeReportPoints("test.devnag.10 100 host=ip1 A=500", points, "tsdb");
point = points.get(0);
assertEquals("tsdb", point.getTable());
assertEquals("test.devnag.10", point.getMetric());
assertEquals(100.0, point.getValue());
assertEquals("ip1", point.getHost());
assertEquals(1, point.getAnnotations().size());
assertEquals("500", point.getAnnotations().get("A"));
}
use of wavefront.report.ReportPoint in project java by wavefrontHQ.
the class GraphiteDecoderTest method testFormatWithTimestamp.
@Test
public void testFormatWithTimestamp() throws Exception {
GraphiteDecoder decoder = new GraphiteDecoder("localhost", emptyCustomSourceTags);
List<ReportPoint> out = new ArrayList<>();
decoder.decodeReportPoints("tsdb.vehicle.charge.battery_level 93 1234567890.246 host=vehicle_2554", out);
ReportPoint point = out.get(0);
assertEquals("tsdb", point.getTable());
assertEquals(1234567890246L, point.getTimestamp().longValue());
assertEquals("vehicle.charge.battery_level", point.getMetric());
assertEquals(93.0, point.getValue());
assertEquals("vehicle_2554", point.getHost());
}
use of wavefront.report.ReportPoint in project java by wavefrontHQ.
the class GraphiteDecoderTest method testTagRewrite.
@Test
public void testTagRewrite() throws Exception {
GraphiteDecoder decoder = new GraphiteDecoder(emptyCustomSourceTags);
List<ReportPoint> out = Lists.newArrayList();
decoder.decodeReportPoints("test 1 source=test tag=bar", out, "customer");
ReportPoint point = out.get(0);
assertEquals("customer", point.getTable());
assertEquals("test", point.getMetric());
assertEquals("test", point.getHost());
assertEquals("bar", point.getAnnotations().get("_tag"));
assertEquals(1.0, point.getValue());
}
Aggregations