Search in sources :

Example 1 with DataPoint

use of com.srotya.sidewinder.core.storage.DataPoint in project sidewinder by srotya.

the class GorillaDecompressor method readPair.

/**
 * Returns the next pair in the time series, if available.
 *
 * @return Pair if there's next value, null if series is done.
 */
public DataPoint readPair() {
    next();
    if (endOfStream) {
        return null;
    }
    DataPoint pair = new DataPoint(storedTimestamp, storedVal);
    return pair;
}
Also used : DataPoint(com.srotya.sidewinder.core.storage.DataPoint)

Example 2 with DataPoint

use of com.srotya.sidewinder.core.storage.DataPoint in project sidewinder by srotya.

the class GorillaWriter method write.

@Override
public void write(List<DataPoint> dp) throws IOException {
    for (DataPoint d : dp) {
        write(d);
        counter++;
    }
}
Also used : DataPoint(com.srotya.sidewinder.core.storage.DataPoint)

Example 3 with DataPoint

use of com.srotya.sidewinder.core.storage.DataPoint in project sidewinder by srotya.

the class MiscUtils method buildDataPoint.

public static DataPoint buildDataPoint(long timestamp, double value) {
    DataPoint dp = new DataPoint();
    dp.setTimestamp(timestamp);
    dp.setValue(value);
    return dp;
}
Also used : DataPoint(com.srotya.sidewinder.core.storage.DataPoint)

Example 4 with DataPoint

use of com.srotya.sidewinder.core.storage.DataPoint in project sidewinder by srotya.

the class MiscUtils method pointToDataPoint.

public static DataPoint pointToDataPoint(Point point) {
    DataPoint dp = new DataPoint();
    pointToDataPoint(dp, point);
    return dp;
}
Also used : DataPoint(com.srotya.sidewinder.core.storage.DataPoint)

Example 5 with DataPoint

use of com.srotya.sidewinder.core.storage.DataPoint in project sidewinder by srotya.

the class TestChainFunction method testTwoFunctions.

@Test
public void testTwoFunctions() throws Exception {
    Series series = new Series("cpu", "test", Arrays.asList(new Tag("t", "1"), new Tag("t", "2")));
    List<DataPoint> dps = new ArrayList<>();
    long baseTs = 1486617103629L;
    for (int i = 0; i < 4; i++) {
        dps.add(new DataPoint(baseTs + 30_000 * i, 1));
    }
    series.setDataPoints(dps);
    series.setFp(false);
    List<Series> seriesList = Arrays.asList(series);
    ChainFunction cf = new ChainFunction();
    ReducingWindowedAggregator rwa = new WindowedMean();
    rwa.init(new Object[] { 70, "smean" });
    ReducingWindowedAggregator rwa2 = new WindowedMean();
    rwa2.init(new Object[] { 200, "smean" });
    cf.init(new Function[] { rwa, rwa2 });
    List<Series> apply = cf.apply(seriesList);
    List<DataPoint> result = apply.get(0).getDataPoints();
    assertEquals(1, result.size());
    assertEquals(1, result.get(0).getLongValue());
}
Also used : Series(com.srotya.sidewinder.core.storage.Series) ReducingWindowedAggregator(com.srotya.sidewinder.core.functions.windowed.ReducingWindowedAggregator) DataPoint(com.srotya.sidewinder.core.storage.DataPoint) ChainFunction(com.srotya.sidewinder.core.functions.multiseries.ChainFunction) ArrayList(java.util.ArrayList) Tag(com.srotya.sidewinder.core.filters.Tag) DataPoint(com.srotya.sidewinder.core.storage.DataPoint) Test(org.junit.Test)

Aggregations

DataPoint (com.srotya.sidewinder.core.storage.DataPoint)67 Test (org.junit.Test)52 Series (com.srotya.sidewinder.core.storage.Series)40 ArrayList (java.util.ArrayList)39 IOException (java.io.IOException)16 Reader (com.srotya.sidewinder.core.storage.compression.Reader)13 TimeSeries (com.srotya.sidewinder.core.storage.TimeSeries)12 ByteBuffer (java.nio.ByteBuffer)11 ReducingWindowedAggregator (com.srotya.sidewinder.core.functions.windowed.ReducingWindowedAggregator)10 HashMap (java.util.HashMap)10 LinkedHashMap (java.util.LinkedHashMap)10 RejectException (com.srotya.sidewinder.core.storage.RejectException)9 File (java.io.File)9 Point (com.srotya.sidewinder.core.rpc.Point)8 ItemNotFoundException (com.srotya.sidewinder.core.storage.ItemNotFoundException)8 List (java.util.List)8 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)6 Tag (com.srotya.sidewinder.core.filters.Tag)5 Writer (com.srotya.sidewinder.core.storage.compression.Writer)5 ByzantineWriter (com.srotya.sidewinder.core.storage.compression.byzantine.ByzantineWriter)4