Search in sources :

Example 56 with ReportPoint

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

the class GraphiteDecoderTest method testNumberLookingTagValue2.

@Test
public void testNumberLookingTagValue2() {
    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 57 with ReportPoint

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

the class HistogramDecoderTest method testMultipleBuckets.

@Test
public void testMultipleBuckets() {
    HistogramDecoder decoder = new HistogramDecoder();
    List<ReportPoint> out = new ArrayList<>();
    decoder.decodeReportPoints("!M 1471988653 #1 3.1416 #1 2.7183 TestMetric", out, "customer");
    assertThat(out).isNotEmpty();
    ReportPoint p = out.get(0);
    assertThat(p.getValue()).isNotNull();
    assertThat(p.getValue().getClass()).isEqualTo(Histogram.class);
    Histogram h = (Histogram) p.getValue();
    assertThat(h.getDuration()).isEqualTo(DateUtils.MILLIS_PER_MINUTE);
    assertThat(h.getBins()).isNotNull();
    assertThat(h.getBins()).isNotEmpty();
    assertThat(h.getBins()).containsExactly(3.1416D, 2.7183D);
    assertThat(h.getCounts()).isNotNull();
    assertThat(h.getCounts()).isNotEmpty();
    assertThat(h.getCounts()).containsExactly(1, 1);
}
Also used : Histogram(wavefront.report.Histogram) ArrayList(java.util.ArrayList) ReportPoint(wavefront.report.ReportPoint) Test(org.junit.Test)

Example 58 with ReportPoint

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

the class HistogramDecoderTest method testBasicMessage.

@Test
public void testBasicMessage() {
    HistogramDecoder decoder = new HistogramDecoder();
    List<ReportPoint> out = new ArrayList<>();
    decoder.decodeReportPoints("!M 1471988653 #3 123.237 TestMetric source=Test key=value", out, "customer");
    assertThat(out).isNotEmpty();
    ReportPoint p = out.get(0);
    assertThat(p.getMetric()).isEqualTo("TestMetric");
    // Should be converted to Millis and pinned to the beginning of the corresponding minute
    assertThat(p.getTimestamp()).isEqualTo(1471988640000L);
    assertThat(p.getValue()).isNotNull();
    assertThat(p.getValue().getClass()).isEqualTo(Histogram.class);
    assertThat(p.getHost()).isEqualTo("Test");
    assertThat(p.getTable()).isEqualTo("customer");
    assertThat(p.getAnnotations()).isNotNull();
    assertThat(p.getAnnotations()).containsEntry("key", "value");
    Histogram h = (Histogram) p.getValue();
    assertThat(h.getDuration()).isEqualTo(DateUtils.MILLIS_PER_MINUTE);
    assertThat(h.getBins()).isNotNull();
    assertThat(h.getBins()).isNotEmpty();
    assertThat(h.getBins()).containsExactly(123.237D);
    assertThat(h.getCounts()).isNotNull();
    assertThat(h.getCounts()).isNotEmpty();
    assertThat(h.getCounts()).containsExactly(3);
}
Also used : Histogram(wavefront.report.Histogram) ArrayList(java.util.ArrayList) ReportPoint(wavefront.report.ReportPoint) Test(org.junit.Test)

Example 59 with ReportPoint

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

the class HistogramDecoderTest method testTagKey.

@Test
public void testTagKey() {
    HistogramDecoder decoder = new HistogramDecoder();
    List<ReportPoint> out = new ArrayList<>();
    decoder.decodeReportPoints("!M 1471988653 #3 123.237 TestMetric source=Test tag=value", out, "customer");
    assertThat(out).isNotEmpty();
    ReportPoint p = out.get(0);
    assertThat(p.getAnnotations()).isNotNull();
    assertThat(p.getAnnotations()).containsEntry("_tag", "value");
}
Also used : ArrayList(java.util.ArrayList) ReportPoint(wavefront.report.ReportPoint) Test(org.junit.Test)

Example 60 with ReportPoint

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

the class HistogramDecoderTest method testMissingTimestamp.

@Test
public void testMissingTimestamp() {
    // Note - missingTimestamp to port 40,000 is no longer invalid - see MONIT-6430 for more details
    HistogramDecoder decoder = new HistogramDecoder();
    List<ReportPoint> out = new ArrayList<>();
    decoder.decodeReportPoints("!M #3 123.237 TestMetric source=Test tag=value", out, "customer");
    assertThat(out).isNotEmpty();
    long expectedTimestamp = Clock.now();
    ReportPoint p = out.get(0);
    assertThat(p.getMetric()).isEqualTo("TestMetric");
    assertThat(p.getValue()).isNotNull();
    assertThat(p.getValue().getClass()).isEqualTo(Histogram.class);
    // Should be converted to Millis and pinned to the beginning of the corresponding minute
    long duration = ((Histogram) p.getValue()).getDuration();
    expectedTimestamp = (expectedTimestamp / duration) * duration;
    assertThat(p.getTimestamp()).isEqualTo(expectedTimestamp);
    assertThat(p.getHost()).isEqualTo("Test");
    assertThat(p.getTable()).isEqualTo("customer");
    assertThat(p.getAnnotations()).isNotNull();
    assertThat(p.getAnnotations()).containsEntry("_tag", "value");
    Histogram h = (Histogram) p.getValue();
    assertThat(h.getDuration()).isEqualTo(DateUtils.MILLIS_PER_MINUTE);
    assertThat(h.getBins()).isNotNull();
    assertThat(h.getBins()).isNotEmpty();
    assertThat(h.getBins()).containsExactly(123.237D);
    assertThat(h.getCounts()).isNotNull();
    assertThat(h.getCounts()).isNotEmpty();
    assertThat(h.getCounts()).containsExactly(3);
}
Also used : Histogram(wavefront.report.Histogram) ArrayList(java.util.ArrayList) 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