use of net.opentsdb.core.TSQuery in project opentsdb by OpenTSDB.
the class TestQueryRpc method parseQueryMTypeWEmptyFilterBrackets.
@Test
public void parseQueryMTypeWEmptyFilterBrackets() throws Exception {
HttpQuery query = NettyMocks.getQuery(tsdb, "/api/query?start=1h-ago&m=sum:sys.cpu.0{}{}");
TSQuery tsq = (TSQuery) parseQuery.invoke(rpc, tsdb, query, expressions);
TSSubQuery sub = tsq.getQueries().get(0);
sub.validateAndSetQuery();
assertEquals(0, sub.getFilters().size());
}
use of net.opentsdb.core.TSQuery in project opentsdb by OpenTSDB.
the class TestQueryRpc method parseQueryMTypeWGroupByAndWildcardFilterSameTagK.
@Test
public void parseQueryMTypeWGroupByAndWildcardFilterSameTagK() throws Exception {
HttpQuery query = NettyMocks.getQuery(tsdb, "/api/query?start=1h-ago&m=sum:sys.cpu.0{host=quirm|tsort}" + "{host=wildcard(*quirm)}");
TSQuery tsq = (TSQuery) parseQuery.invoke(rpc, tsdb, query, expressions);
TSSubQuery sub = tsq.getQueries().get(0);
sub.validateAndSetQuery();
assertTrue(sub.getFilters().get(0) instanceof TagVWildcardFilter);
assertTrue(sub.getFilters().get(1) instanceof TagVLiteralOrFilter);
}
use of net.opentsdb.core.TSQuery in project opentsdb by OpenTSDB.
the class TestQueryRpc method parseQueryMTypeWWildcardFilterImplicit.
@Test
public void parseQueryMTypeWWildcardFilterImplicit() 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.TSQuery in project opentsdb by OpenTSDB.
the class TestQueryRpc method parseQueryMTypeWRateAndDS.
@Test
public void parseQueryMTypeWRateAndDS() throws Exception {
HttpQuery query = NettyMocks.getQuery(tsdb, "/api/query?start=1h-ago&m=sum:1h-avg:rate:sys.cpu.0");
TSQuery tsq = (TSQuery) parseQuery.invoke(rpc, tsdb, query, expressions);
TSSubQuery sub = tsq.getQueries().get(0);
assertTrue(sub.getRate());
assertEquals("1h-avg", sub.getDownsample());
}
use of net.opentsdb.core.TSQuery in project opentsdb by OpenTSDB.
the class TestQueryRpc method parseQueryTSUIDTypeWRate.
@Test
public void parseQueryTSUIDTypeWRate() throws Exception {
HttpQuery query = NettyMocks.getQuery(tsdb, "/api/query?start=1h-ago&tsuid=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));
assertTrue(sub.getRate());
}
Aggregations