use of net.opentsdb.core.IncomingDataPoint in project opentsdb by OpenTSDB.
the class TestTSUIDQuery method getLastPointTSUIDMetricNSUINotResolved.
// While these NSUI shouldn't happen, it's possible if someone deletes a metric
// or tag but not the actual data.
@Test
public void getLastPointTSUIDMetricNSUINotResolved() throws Exception {
Whitebox.setInternalState(config, "enable_tsuid_incrementing", false);
Whitebox.setInternalState(config, "enable_realtime_ts", false);
storage.flushStorage();
storage.addColumn(MockBase.stringToBytes("00000350E22700000001000001"), QUAL, VAL);
final byte[] tsuid = new byte[] { 0, 0, 3, 0, 0, 1, 0, 0, 1 };
PowerMockito.mockStatic(DateTime.class);
PowerMockito.when(DateTime.currentTimeMillis()).thenReturn(1356998400000L);
query = new TSUIDQuery(tsdb, tsuid);
final IncomingDataPoint dp = query.getLastPoint(false, 0).join();
assertEquals(1356998400000L, dp.getTimestamp());
assertNull(dp.getMetric());
assertNull(dp.getTags());
assertEquals("42", dp.getValue());
assertEquals(UniqueId.uidToString(tsuid), dp.getTSUID());
}
use of net.opentsdb.core.IncomingDataPoint in project opentsdb by OpenTSDB.
the class TestTSUIDQuery method getLastPointTSUIDTagvNSUINotResolved.
@Test
public void getLastPointTSUIDTagvNSUINotResolved() throws Exception {
Whitebox.setInternalState(config, "enable_tsuid_incrementing", false);
Whitebox.setInternalState(config, "enable_realtime_ts", false);
storage.flushStorage();
storage.addColumn(MockBase.stringToBytes("00000150E22700000001000003"), QUAL, VAL);
final byte[] tsuid = new byte[] { 0, 0, 1, 0, 0, 1, 0, 0, 3 };
PowerMockito.mockStatic(DateTime.class);
PowerMockito.when(DateTime.currentTimeMillis()).thenReturn(1356998400000L);
query = new TSUIDQuery(tsdb, tsuid);
final IncomingDataPoint dp = query.getLastPoint(false, 0).join();
assertEquals(1356998400000L, dp.getTimestamp());
assertNull(dp.getMetric());
assertNull(dp.getTags());
assertEquals("42", dp.getValue());
assertEquals(UniqueId.uidToString(tsuid), dp.getTSUID());
}
use of net.opentsdb.core.IncomingDataPoint in project opentsdb by OpenTSDB.
the class TestTSUIDQuery method getLastPointMetricOneBackscanInRange.
@Test
public void getLastPointMetricOneBackscanInRange() throws Exception {
Whitebox.setInternalState(config, "enable_tsuid_incrementing", false);
Whitebox.setInternalState(config, "enable_realtime_ts", false);
storage.flushStorage();
tsdb.addPoint(METRIC_STRING, 1356998400L, 42, tags);
PowerMockito.mockStatic(DateTime.class);
PowerMockito.when(DateTime.currentTimeMillis()).thenReturn(1357002000000L);
query = new TSUIDQuery(tsdb, METRIC_STRING, tags);
final IncomingDataPoint dp = query.getLastPoint(false, 1).join();
assertEquals(1356998400000L, dp.getTimestamp());
assertNull(dp.getMetric());
assertNull(dp.getTags());
assertEquals("42", dp.getValue());
assertEquals(UniqueId.uidToString(TSUID), dp.getTSUID());
}
use of net.opentsdb.core.IncomingDataPoint in project opentsdb by OpenTSDB.
the class TestTSUIDQuery method getLastPointTSUIDManyBackscanInRange.
@Test
public void getLastPointTSUIDManyBackscanInRange() throws Exception {
Whitebox.setInternalState(config, "enable_tsuid_incrementing", false);
Whitebox.setInternalState(config, "enable_realtime_ts", false);
storage.flushStorage();
tsdb.addPoint(METRIC_STRING, 1356998400L, 42, tags);
PowerMockito.mockStatic(DateTime.class);
PowerMockito.when(DateTime.currentTimeMillis()).thenReturn(1360681200000L);
query = new TSUIDQuery(tsdb, TSUID);
final IncomingDataPoint dp = query.getLastPoint(false, 1024).join();
assertEquals(1356998400000L, dp.getTimestamp());
assertNull(dp.getMetric());
assertNull(dp.getTags());
assertEquals("42", dp.getValue());
assertEquals(UniqueId.uidToString(TSUID), dp.getTSUID());
}
use of net.opentsdb.core.IncomingDataPoint in project opentsdb by OpenTSDB.
the class TestTSUIDQuery method getLastPointTSUIDTagkNSUINotResolved.
@Test
public void getLastPointTSUIDTagkNSUINotResolved() throws Exception {
Whitebox.setInternalState(config, "enable_tsuid_incrementing", false);
Whitebox.setInternalState(config, "enable_realtime_ts", false);
storage.flushStorage();
storage.addColumn(MockBase.stringToBytes("00000150E22700000003000001"), QUAL, VAL);
final byte[] tsuid = new byte[] { 0, 0, 1, 0, 0, 3, 0, 0, 1 };
PowerMockito.mockStatic(DateTime.class);
PowerMockito.when(DateTime.currentTimeMillis()).thenReturn(1356998400000L);
query = new TSUIDQuery(tsdb, tsuid);
final IncomingDataPoint dp = query.getLastPoint(false, 0).join();
assertEquals(1356998400000L, dp.getTimestamp());
assertNull(dp.getMetric());
assertNull(dp.getTags());
assertEquals("42", dp.getValue());
assertEquals(UniqueId.uidToString(tsuid), dp.getTSUID());
}
Aggregations