use of net.opentsdb.core.TSSubQuery in project opentsdb by OpenTSDB.
the class TestQueryRpc method parseQueryTSUIDTypeWDS.
@Test
public void parseQueryTSUIDTypeWDS() throws Exception {
HttpQuery query = NettyMocks.getQuery(tsdb, "/api/query?start=1h-ago&tsuid=sum:1m-sum:010101");
TSQuery tsq = (TSQuery) parseQuery.invoke(rpc, tsdb, query, expressions);
assertNotNull(tsq);
assertEquals("1h-ago", tsq.getStart());
assertNotNull(tsq.getQueries());
TSSubQuery sub = tsq.getQueries().get(0);
assertNotNull(sub);
assertEquals("sum", sub.getAggregator());
assertEquals(1, sub.getTsuids().size());
assertEquals("010101", sub.getTsuids().get(0));
assertEquals("1m-sum", sub.getDownsample());
}
use of net.opentsdb.core.TSSubQuery in project opentsdb by OpenTSDB.
the class TestQueryRpc method parseQueryMTypeWRate.
@Test
public void parseQueryMTypeWRate() throws Exception {
HttpQuery query = NettyMocks.getQuery(tsdb, "/api/query?start=1h-ago&m=sum:rate:sys.cpu.0");
TSQuery tsq = (TSQuery) parseQuery.invoke(rpc, tsdb, query, expressions);
TSSubQuery sub = tsq.getQueries().get(0);
assertTrue(sub.getRate());
}
use of net.opentsdb.core.TSSubQuery in project opentsdb by OpenTSDB.
the class TestQueryRpc method parseQueryMTypeWWildcardFilterExplicit.
@Test
public void parseQueryMTypeWWildcardFilterExplicit() throws Exception {
HttpQuery query = NettyMocks.getQuery(tsdb, "/api/query?start=1h-ago&m=sum:sys.cpu.0{}{host=wildcard(*quirm)}");
TSQuery tsq = (TSQuery) parseQuery.invoke(rpc, tsdb, query, expressions);
TSSubQuery sub = tsq.getQueries().get(0);
sub.validateAndSetQuery();
assertEquals(1, sub.getFilters().size());
assertTrue(sub.getFilters().get(0) instanceof TagVWildcardFilter);
}
use of net.opentsdb.core.TSSubQuery in project opentsdb by OpenTSDB.
the class TestQueryRpc method parseQueryMTypeWExplicit.
@Test
public void parseQueryMTypeWExplicit() throws Exception {
HttpQuery query = NettyMocks.getQuery(tsdb, "/api/query?start=1h-ago&m=sum:explicit_tags:sys.cpu.0{host=web01}");
TSQuery tsq = (TSQuery) parseQuery.invoke(rpc, tsdb, query, expressions);
TSSubQuery sub = tsq.getQueries().get(0);
assertNotNull(sub.getTags());
assertEquals("literal_or(web01)", sub.getTags().get("host"));
assertTrue(sub.getExplicitTags());
}
use of net.opentsdb.core.TSSubQuery in project opentsdb by OpenTSDB.
the class TestQueryRpc method parseQueryMTypeWExplicitAndRateAndDS.
@Test
public void parseQueryMTypeWExplicitAndRateAndDS() throws Exception {
HttpQuery query = NettyMocks.getQuery(tsdb, "/api/query?start=1h-ago&m=sum:explicit_tags:rate:1m-sum:sys.cpu.0{host=web01}");
TSQuery tsq = (TSQuery) parseQuery.invoke(rpc, tsdb, query, expressions);
TSSubQuery sub = tsq.getQueries().get(0);
assertNotNull(sub.getTags());
assertEquals("literal_or(web01)", sub.getTags().get("host"));
assertTrue(sub.getRate());
assertTrue(sub.getExplicitTags());
assertEquals("1m-sum", sub.getDownsample());
}
Aggregations