use of net.opentsdb.meta.Annotation in project opentsdb by OpenTSDB.
the class TestHttpJsonSerializer method formatQueryAsyncV1wStatsSummary.
@Test
public void formatQueryAsyncV1wStatsSummary() throws Exception {
setupFormatQuery();
final HttpQuery query = NettyMocks.getQuery(tsdb, "");
final HttpJsonSerializer serdes = new HttpJsonSerializer(query);
final TSQuery data_query = getTestQuery(true, true);
validateTestQuery(data_query);
final List<DataPoints[]> results = new ArrayList<DataPoints[]>(1);
results.add(new DataPoints[] { new MockDataPoints().getMock() });
final ChannelBuffer cb = serdes.formatQueryAsyncV1(data_query, results, Collections.<Annotation>emptyList()).joinUninterruptibly();
assertNotNull(cb);
final String json = cb.toString(Charset.forName("UTF-8"));
assertTrue(json.contains("\"metric\":\"system.cpu.user\","));
assertTrue(json.contains("\"1356998700\":1,"));
assertTrue(json.contains("\"1357058700\":201"));
// assert stats
assertTrue(json.contains("\"stats\":{"));
assertTrue(json.contains("\"emittedDPs\":401"));
System.out.println(json);
// assert stats summary
assertTrue(json.contains("{\"statsSummary\":{"));
assertTrue(json.contains("\"serializationTime\":"));
assertTrue(json.contains("\"processingPreWriteTime\":"));
assertTrue(json.contains("\"queryIdx_00\":"));
}
use of net.opentsdb.meta.Annotation in project opentsdb by OpenTSDB.
the class TestHttpJsonSerializer method formatQueryAsyncV1woStatsWoSummary.
@Test
public void formatQueryAsyncV1woStatsWoSummary() throws Exception {
setupFormatQuery();
final HttpQuery query = NettyMocks.getQuery(tsdb, "");
final HttpJsonSerializer serdes = new HttpJsonSerializer(query);
final TSQuery data_query = getTestQuery(false, false);
validateTestQuery(data_query);
final List<DataPoints[]> results = new ArrayList<DataPoints[]>(1);
results.add(new DataPoints[] { new MockDataPoints().getMock() });
final ChannelBuffer cb = serdes.formatQueryAsyncV1(data_query, results, Collections.<Annotation>emptyList()).joinUninterruptibly();
assertNotNull(cb);
final String json = cb.toString(Charset.forName("UTF-8"));
assertTrue(json.contains("\"metric\":\"system.cpu.user\","));
assertTrue(json.contains("\"1356998700\":1,"));
assertTrue(json.contains("\"1357058700\":201"));
// assert stats
assertFalse(json.contains("\"stats\":{"));
// assert stats summary
assertFalse(json.contains("{\"statsSummary\":{"));
}
use of net.opentsdb.meta.Annotation in project opentsdb by OpenTSDB.
the class TestHttpJsonSerializer method formatQueryAsyncV1wStatsWoSummary.
@Test
public void formatQueryAsyncV1wStatsWoSummary() throws Exception {
setupFormatQuery();
final HttpQuery query = NettyMocks.getQuery(tsdb, "");
final HttpJsonSerializer serdes = new HttpJsonSerializer(query);
final TSQuery data_query = getTestQuery(true, false);
validateTestQuery(data_query);
final List<DataPoints[]> results = new ArrayList<DataPoints[]>(1);
results.add(new DataPoints[] { new MockDataPoints().getMock() });
final ChannelBuffer cb = serdes.formatQueryAsyncV1(data_query, results, Collections.<Annotation>emptyList()).joinUninterruptibly();
assertNotNull(cb);
final String json = cb.toString(Charset.forName("UTF-8"));
assertTrue(json.contains("\"metric\":\"system.cpu.user\","));
assertTrue(json.contains("\"stats\":{"));
assertTrue(json.contains("\"1356998700\":1,"));
assertTrue(json.contains("\"1357058700\":201"));
// assert stats
assertTrue(json.contains("\"stats\":{"));
assertTrue(json.contains("\"emittedDPs\":401"));
// assert stats summary
assertFalse(json.contains("{\"statsSummary\":{"));
}
Aggregations