Search in sources :

Example 51 with ReportPoint

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) {
    }
}
Also used : ReportPoint(wavefront.report.ReportPoint) Test(org.junit.Test)

Example 52 with ReportPoint

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());
}
Also used : ReportPoint(wavefront.report.ReportPoint) Test(org.junit.Test)

Example 53 with ReportPoint

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"));
}
Also used : ArrayList(java.util.ArrayList) ReportPoint(wavefront.report.ReportPoint) Test(org.junit.Test)

Example 54 with ReportPoint

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());
}
Also used : ArrayList(java.util.ArrayList) ReportPoint(wavefront.report.ReportPoint) Test(org.junit.Test)

Example 55 with ReportPoint

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());
}
Also used : ReportPoint(wavefront.report.ReportPoint) Test(org.junit.Test)

Aggregations

ReportPoint (wavefront.report.ReportPoint)71 Test (org.junit.Test)50 ArrayList (java.util.ArrayList)24 Histogram (wavefront.report.Histogram)10 PointHandler (com.wavefront.agent.PointHandler)4 List (java.util.List)4 JsonNode (com.fasterxml.jackson.databind.JsonNode)3 IOException (java.io.IOException)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 AgentDigest (com.tdunning.math.stats.AgentDigest)2 InetSocketAddress (java.net.InetSocketAddress)2 HashMap (java.util.HashMap)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 Throwables (com.google.common.base.Throwables)1 ImmutableList (com.google.common.collect.ImmutableList)1 Lists (com.google.common.collect.Lists)1 ObjectQueue (com.squareup.tape.ObjectQueue)1 Validation (com.wavefront.agent.Validation)1 Utils (com.wavefront.agent.histogram.Utils)1 Granularity.fromMillis (com.wavefront.agent.histogram.Utils.Granularity.fromMillis)1