use of net.opentsdb.core.TSSubQuery in project opentsdb by OpenTSDB.
the class TestQueryRpc method parseQueryMTypeWTag.
@Test
public void parseQueryMTypeWTag() throws Exception {
HttpQuery query = NettyMocks.getQuery(tsdb, "/api/query?start=1h-ago&m=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"));
}
use of net.opentsdb.core.TSSubQuery in project opentsdb by OpenTSDB.
the class TestQueryRpc method parseQueryTSUIDTypeWRateAndDS.
@Test
public void parseQueryTSUIDTypeWRateAndDS() throws Exception {
HttpQuery query = NettyMocks.getQuery(tsdb, "/api/query?start=1h-ago&tsuid=sum:1m-sum:rate: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());
assertTrue(sub.getRate());
}
use of net.opentsdb.core.TSSubQuery in project opentsdb by OpenTSDB.
the class TestQueryRpc method parseQueryTSUIDTypeMulti.
@Test
public void parseQueryTSUIDTypeMulti() throws Exception {
HttpQuery query = NettyMocks.getQuery(tsdb, "/api/query?start=1h-ago&tsuid=sum:010101,020202");
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(2, sub.getTsuids().size());
assertEquals("010101", sub.getTsuids().get(0));
assertEquals("020202", sub.getTsuids().get(1));
}
use of net.opentsdb.core.TSSubQuery in project opentsdb by OpenTSDB.
the class TestQueryRpc method parseQueryMTypeWGroupByWildcardImplicit.
@Test
public void parseQueryMTypeWGroupByWildcardImplicit() throws Exception {
HttpQuery query = NettyMocks.getQuery(tsdb, "/api/query?start=1h-ago&m=sum:sys.cpu.0{host=*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 parseQueryMTypeWExplicitAndRate.
@Test
public void parseQueryMTypeWExplicitAndRate() throws Exception {
HttpQuery query = NettyMocks.getQuery(tsdb, "/api/query?start=1h-ago&m=sum:explicit_tags:rate: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());
}
Aggregations