Search in sources :

Example 21 with ReportPoint

use of wavefront.report.ReportPoint in project java by wavefrontHQ.

the class GraphiteDecoderTest method testNumberLookingTagValue.

@Test
public void testNumberLookingTagValue() {
    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 version=\"1.0.0-030051.d0e485f\"", 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("1.0.0-030051.d0e485f", point.getAnnotations().get("version"));
    assertEquals(4.0, point.getValue());
}
Also used : ReportPoint(wavefront.report.ReportPoint) Test(org.junit.Test)

Example 22 with ReportPoint

use of wavefront.report.ReportPoint in project java by wavefrontHQ.

the class GraphiteDecoderTest method testIpV4Host.

@Test
public void testIpV4Host() throws Exception {
    GraphiteDecoder decoder = new GraphiteDecoder("localhost", emptyCustomSourceTags);
    List<ReportPoint> out = new ArrayList<>();
    decoder.decodeReportPoints("tsdb.vehicle.charge.battery_level 93 host=10.0.0.1", out);
    ReportPoint point = out.get(0);
    assertEquals("tsdb", point.getTable());
    assertEquals("vehicle.charge.battery_level", point.getMetric());
    assertEquals(93.0, point.getValue());
    assertEquals("10.0.0.1", point.getHost());
}
Also used : ArrayList(java.util.ArrayList) ReportPoint(wavefront.report.ReportPoint) Test(org.junit.Test)

Example 23 with ReportPoint

use of wavefront.report.ReportPoint in project java by wavefrontHQ.

the class GraphiteDecoderTest method testSourcePriority.

@Test
public void testSourcePriority() throws Exception {
    List<String> customSourceTags = new ArrayList<String>();
    customSourceTags.add("fqdn");
    GraphiteDecoder decoder = new GraphiteDecoder(customSourceTags);
    List<ReportPoint> out = Lists.newArrayList();
    decoder.decodeReportPoints("test 1 source=test host=bar fqdn=foo", out, "customer");
    ReportPoint point = out.get(0);
    assertEquals("customer", point.getTable());
    assertEquals("test", point.getMetric());
    assertEquals("test", point.getHost());
    assertEquals("bar", point.getAnnotations().get("_host"));
    assertEquals("foo", point.getAnnotations().get("fqdn"));
    assertEquals(1.0, point.getValue());
}
Also used : ArrayList(java.util.ArrayList) ReportPoint(wavefront.report.ReportPoint) Test(org.junit.Test)

Example 24 with ReportPoint

use of wavefront.report.ReportPoint in project java by wavefrontHQ.

the class GraphiteDecoderTest method testMetricWithAnnotationQuoted.

@Test
public void testMetricWithAnnotationQuoted() throws Exception {
    GraphiteDecoder decoder = new GraphiteDecoder(emptyCustomSourceTags);
    List<ReportPoint> out = Lists.newArrayList();
    decoder.decodeReportPoints("1vehicle.charge.battery_level 93 1234567890.246 host=12345 blah=\"test hello\" " + "\"hello world\"=test", out, "customer");
    ReportPoint point = out.get(0);
    assertEquals("customer", point.getTable());
    assertEquals("1vehicle.charge.battery_level", point.getMetric());
    assertEquals("12345", point.getHost());
    assertEquals(93.0, point.getValue());
    assertEquals(1234567890246L, point.getTimestamp().longValue());
    assertEquals("test hello", point.getAnnotations().get("blah"));
    assertEquals("test", point.getAnnotations().get("hello world"));
}
Also used : ReportPoint(wavefront.report.ReportPoint) Test(org.junit.Test)

Example 25 with ReportPoint

use of wavefront.report.ReportPoint in project java by wavefrontHQ.

the class GraphiteDecoderTest method testQuotes.

@Test
public void testQuotes() {
    GraphiteDecoder decoder = new GraphiteDecoder(emptyCustomSourceTags);
    List<ReportPoint> out = Lists.newArrayList();
    decoder.decodeReportPoints("\"1vehicle.charge.'battery_level\" 93 1234567890.246 " + "host=12345 blah=\"test'\\\"hello\" \"hello world\"=test", out, "customer");
    ReportPoint point = out.get(0);
    assertEquals("customer", point.getTable());
    assertEquals("1vehicle.charge.'battery_level", point.getMetric());
    assertEquals("12345", point.getHost());
    assertEquals(93.0, point.getValue());
    assertEquals(1234567890246L, point.getTimestamp().longValue());
    assertEquals("test'\"hello", point.getAnnotations().get("blah"));
    assertEquals("test", point.getAnnotations().get("hello world"));
}
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