use of net.opentsdb.core.TSQuery 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());
}
use of net.opentsdb.core.TSQuery in project opentsdb by OpenTSDB.
the class TestQueryRpc method parseQueryMTypeWExplicitAndDSAndRate.
@Test
public void parseQueryMTypeWExplicitAndDSAndRate() throws Exception {
HttpQuery query = NettyMocks.getQuery(tsdb, "/api/query?start=1h-ago&m=sum:explicit_tags:1m-sum: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());
assertEquals("1m-sum", sub.getDownsample());
}
use of net.opentsdb.core.TSQuery in project opentsdb by OpenTSDB.
the class TestQueryRpc method parseQueryMTypeWGroupByRegex.
@Test
public void parseQueryMTypeWGroupByRegex() throws Exception {
HttpQuery query = NettyMocks.getQuery(tsdb, "/api/query?start=1h-ago&m=sum:sys.cpu.0{host=" + TagVRegexFilter.FILTER_NAME + "(something(foo|bar))}");
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 TagVRegexFilter);
}
Aggregations