Search in sources :

Example 1 with TimeSeries

use of alluxio.metrics.TimeSeries in project alluxio by Alluxio.

the class TimeSeriesStoreTest method recordMultipleTimeSeries.

@Test
public void recordMultipleTimeSeries() {
    TimeSeriesStore store = new TimeSeriesStore();
    String metric1 = "test_metric_1";
    String metric2 = "test_metric_2";
    double value1 = 10;
    double value2 = 20;
    store.record(metric1, value1);
    store.record(metric2, value2);
    TimeSeries ts1 = null;
    TimeSeries ts2 = null;
    for (TimeSeries ts : store.getTimeSeries()) {
        if (ts.getName().equals(metric1)) {
            ts1 = ts;
        } else if (ts.getName().equals(metric2)) {
            ts2 = ts;
        } else {
            Assert.fail("Invalid Timeseries " + ts.getName());
        }
    }
    assertNotNull(ts1);
    assertNotNull(ts2);
    assertEquals(value1, ts1.getDataPoints().element().getValue(), 0);
    assertEquals(value2, ts2.getDataPoints().element().getValue(), 0);
}
Also used : TimeSeries(alluxio.metrics.TimeSeries) Test(org.junit.Test)

Aggregations

TimeSeries (alluxio.metrics.TimeSeries)1 Test (org.junit.Test)1