Search in sources :

Example 6 with RollupQuery

use of net.opentsdb.rollup.RollupQuery in project opentsdb by OpenTSDB.

the class TestDownsampler method testDownsampler_rollupDev.

@Test(expected = UnsupportedOperationException.class)
public void testDownsampler_rollupDev() {
    final RollupInterval interval = RollupInterval.builder().setTable("tsdb-rollup-1h").setPreAggregationTable("tsdb-agg-rollup-1h").setInterval("1h").setRowSpan("1d").build();
    final RollupQuery rollup_query = new RollupQuery(interval, Aggregators.DEV, 3600000, Aggregators.SUM);
    specification = new DownsamplingSpecification("10s-dev");
    downsampler = new Downsampler(source, specification, 0, 0, rollup_query);
    while (downsampler.hasNext()) {
        // <-- throws here
        downsampler.next();
    }
}
Also used : RollupQuery(net.opentsdb.rollup.RollupQuery) RollupInterval(net.opentsdb.rollup.RollupInterval) Test(org.junit.Test)

Example 7 with RollupQuery

use of net.opentsdb.rollup.RollupQuery in project opentsdb by OpenTSDB.

the class TestFillingDownsampler method testDownsampler_rollupDev.

@Test(expected = UnsupportedOperationException.class)
public void testDownsampler_rollupDev() {
    final RollupInterval interval = RollupInterval.builder().setTable("tsdb-rollup-1h").setPreAggregationTable("tsdb-agg-rollup-1h").setInterval("1h").setRowSpan("1d").build();
    final RollupQuery rollup_query = new RollupQuery(interval, Aggregators.DEV, 3600000, Aggregators.SUM);
    final long baseTime = 1000L;
    final SeekableView source = SeekableViewsForTest.fromArray(new DataPoint[] { MutableDataPoint.ofDoubleValue(baseTime + 25L * 0L, 12.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 1L, 11.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 2L, 10.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 3L, 9.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 4L, 8.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 5L, 7.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 6L, 6.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 7L, 5.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 8L, 4.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 9L, 3.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 10L, 2.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 11L, 1.) });
    specification = new DownsamplingSpecification("100ms-dev-nan");
    final Downsampler downsampler = new FillingDownsampler(source, baseTime, baseTime + 12L * 25L, specification, 0, 0, rollup_query);
    while (downsampler.hasNext()) {
        // <-- throws here
        downsampler.next();
    }
}
Also used : MockSeekableView(net.opentsdb.core.SeekableViewsForTest.MockSeekableView) RollupQuery(net.opentsdb.rollup.RollupQuery) RollupInterval(net.opentsdb.rollup.RollupInterval) Test(org.junit.Test)

Example 8 with RollupQuery

use of net.opentsdb.rollup.RollupQuery in project opentsdb by OpenTSDB.

the class TestFillingDownsampler method testDownsampler_rollupCountMissing.

@Test
public void testDownsampler_rollupCountMissing() {
    final RollupInterval interval = RollupInterval.builder().setTable("tsdb-rollup-1h").setPreAggregationTable("tsdb-agg-rollup-1h").setInterval("1h").setRowSpan("1d").build();
    final RollupQuery rollup_query = new RollupQuery(interval, Aggregators.SUM, 3600000, Aggregators.SUM);
    final long baseTime = 500L;
    final SeekableView source = SeekableViewsForTest.fromArray(new DataPoint[] { MutableDataPoint.ofDoubleValue(baseTime + 25L * 4L, 1.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 5L, 1.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 7L, 1.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 12L, 1.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 15L, 1.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 24L, 1.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 25L, 1.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 26L, 1.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 27L, 1.) });
    specification = new DownsamplingSpecification("100ms-count-nan");
    final Downsampler downsampler = new FillingDownsampler(source, baseTime, baseTime + 36 * 25L, specification, 0, 0, rollup_query);
    long timestamp = baseTime;
    step(downsampler, timestamp, Double.NaN);
    step(downsampler, timestamp += 100, 3.);
    step(downsampler, timestamp += 100, Double.NaN);
    step(downsampler, timestamp += 100, 2.);
    step(downsampler, timestamp += 100, Double.NaN);
    step(downsampler, timestamp += 100, Double.NaN);
    step(downsampler, timestamp += 100, 4.);
    step(downsampler, timestamp += 100, Double.NaN);
    step(downsampler, timestamp += 100, Double.NaN);
    assertFalse(downsampler.hasNext());
}
Also used : MockSeekableView(net.opentsdb.core.SeekableViewsForTest.MockSeekableView) RollupQuery(net.opentsdb.rollup.RollupQuery) RollupInterval(net.opentsdb.rollup.RollupInterval) Test(org.junit.Test)

Example 9 with RollupQuery

use of net.opentsdb.rollup.RollupQuery in project opentsdb by OpenTSDB.

the class TestFillingDownsampler method testDownsampler_rollupCount.

@Test
public void testDownsampler_rollupCount() {
    final RollupInterval interval = RollupInterval.builder().setTable("tsdb-rollup-1h").setPreAggregationTable("tsdb-agg-rollup-1h").setInterval("1h").setRowSpan("1d").build();
    // This query, in combination with the configuration/interval above, is asking for rolled up COUNTs (i.e. already
    // downsampled).  These COUNTs should then be SUMmed over some interval we'll define later in a DownsamplingSpecification
    final RollupQuery rollup_query = new RollupQuery(interval, Aggregators.COUNT, 3600000, Aggregators.SUM);
    final long baseTime = 1000L;
    // These points represent rolled up COUNTs that would be stored in the rollup table (e.g. tsdb-rollup-1h) and as
    // such we don't expect these to be COUNTed again on retrieval.  These points are at 25ms intervals
    final SeekableView source = SeekableViewsForTest.fromArray(new DataPoint[] { MutableDataPoint.ofDoubleValue(baseTime + 25L * 0L, 12.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 1L, 11.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 2L, 10.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 3L, 9.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 4L, 8.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 5L, 7.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 6L, 6.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 7L, 5.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 8L, 4.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 9L, 3.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 10L, 2.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 11L, 1.) });
    // The rolled up points above are at 25ms intervals but we want to downsample these further so that we only get
    // points at 100ms intervals
    specification = new DownsamplingSpecification("100ms-count-nan");
    final Downsampler downsampler = new FillingDownsampler(source, baseTime, baseTime + 12L * 25L, specification, 0, 0, rollup_query);
    long timestamp = baseTime;
    // Expect the SUM of points 1 to 4
    step(downsampler, timestamp, 42);
    // Expect the SUM of points 5 to 8
    step(downsampler, timestamp += 100, 26);
    // Expect the SUM of points 9 to 12
    step(downsampler, timestamp += 100, 10);
    assertFalse(downsampler.hasNext());
}
Also used : MockSeekableView(net.opentsdb.core.SeekableViewsForTest.MockSeekableView) RollupQuery(net.opentsdb.rollup.RollupQuery) RollupInterval(net.opentsdb.rollup.RollupInterval) Test(org.junit.Test)

Example 10 with RollupQuery

use of net.opentsdb.rollup.RollupQuery in project opentsdb by OpenTSDB.

the class TestFillingDownsampler method testDownsampler_rollupAvgMissing.

@Test
public void testDownsampler_rollupAvgMissing() {
    final RollupInterval interval = RollupInterval.builder().setTable("tsdb-rollup-1h").setPreAggregationTable("tsdb-agg-rollup-1h").setInterval("1h").setRowSpan("1d").build();
    final RollupQuery rollup_query = new RollupQuery(interval, Aggregators.SUM, 3600000, Aggregators.SUM);
    final long baseTime = 500L;
    final SeekableView source = SeekableViewsForTest.fromArray(new DataPoint[] { MutableDataPoint.ofDoubleValue(baseTime + 25L * 4L, 1.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 5L, 1.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 7L, 1.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 12L, 1.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 15L, 1.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 24L, 1.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 25L, 1.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 26L, 1.), MutableDataPoint.ofDoubleValue(baseTime + 25L * 27L, 1.) });
    specification = new DownsamplingSpecification("100ms-avg-nan");
    final Downsampler downsampler = new FillingDownsampler(source, baseTime, baseTime + 36 * 25L, specification, 0, 0, rollup_query);
    long timestamp = baseTime;
    step(downsampler, timestamp, Double.NaN);
    step(downsampler, timestamp += 100, 1.);
    step(downsampler, timestamp += 100, Double.NaN);
    step(downsampler, timestamp += 100, 1);
    step(downsampler, timestamp += 100, Double.NaN);
    step(downsampler, timestamp += 100, Double.NaN);
    step(downsampler, timestamp += 100, 1.);
    step(downsampler, timestamp += 100, Double.NaN);
    step(downsampler, timestamp += 100, Double.NaN);
    assertFalse(downsampler.hasNext());
}
Also used : MockSeekableView(net.opentsdb.core.SeekableViewsForTest.MockSeekableView) RollupQuery(net.opentsdb.rollup.RollupQuery) RollupInterval(net.opentsdb.rollup.RollupInterval) Test(org.junit.Test)

Aggregations

RollupQuery (net.opentsdb.rollup.RollupQuery)15 RollupInterval (net.opentsdb.rollup.RollupInterval)14 Test (org.junit.Test)13 MockSeekableView (net.opentsdb.core.SeekableViewsForTest.MockSeekableView)7 NoSuchRollupForIntervalException (net.opentsdb.rollup.NoSuchRollupForIntervalException)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1