Search in sources :

Example 11 with MetricQueryResult

use of co.cask.cdap.proto.MetricQueryResult in project cdap by caskdata.

the class MetricsHandlerTestRun method verifyEmptyQueryResult.

private void verifyEmptyQueryResult(String url) throws Exception {
    MetricQueryResult queryResult = post(url, MetricQueryResult.class);
    Assert.assertEquals(0, queryResult.getSeries().length);
}
Also used : MetricQueryResult(co.cask.cdap.proto.MetricQueryResult)

Example 12 with MetricQueryResult

use of co.cask.cdap.proto.MetricQueryResult in project cdap by caskdata.

the class MetricsHandlerTestRun method verifyRangeQueryResult.

private void verifyRangeQueryResult(String url, long nonZeroPointsCount, long expectedSum) throws Exception {
    MetricQueryResult queryResult = post(url, MetricQueryResult.class);
    verifyTimeSeries(queryResult.getSeries()[0], nonZeroPointsCount, expectedSum);
}
Also used : MetricQueryResult(co.cask.cdap.proto.MetricQueryResult)

Example 13 with MetricQueryResult

use of co.cask.cdap.proto.MetricQueryResult in project cdap by caskdata.

the class MetricsQueryHelper method decorate.

private MetricQueryResult decorate(Collection<MetricTimeSeries> series, long startTs, long endTs, int resolution) {
    MetricQueryResult.TimeSeries[] serieses = new MetricQueryResult.TimeSeries[series.size()];
    int i = 0;
    for (MetricTimeSeries timeSeries : series) {
        MetricQueryResult.TimeValue[] timeValues = decorate(timeSeries.getTimeValues());
        serieses[i++] = new MetricQueryResult.TimeSeries(timeSeries.getMetricName(), tagNamesToHuman(timeSeries.getTagValues()), timeValues);
    }
    return new MetricQueryResult(startTs, endTs, serieses, resolution);
}
Also used : MetricTimeSeries(co.cask.cdap.api.metrics.MetricTimeSeries) MetricTimeSeries(co.cask.cdap.api.metrics.MetricTimeSeries) MetricQueryResult(co.cask.cdap.proto.MetricQueryResult) TimeValue(co.cask.cdap.api.dataset.lib.cube.TimeValue)

Aggregations

MetricQueryResult (co.cask.cdap.proto.MetricQueryResult)13 ImmutableMap (com.google.common.collect.ImmutableMap)2 Map (java.util.Map)2 Test (org.junit.Test)2 TimeValue (co.cask.cdap.api.dataset.lib.cube.TimeValue)1 MetricTimeSeries (co.cask.cdap.api.metrics.MetricTimeSeries)1 RowMaker (co.cask.cdap.cli.util.RowMaker)1 Table (co.cask.cdap.cli.util.table.Table)1 FakeApp (co.cask.cdap.client.app.FakeApp)1 UnauthenticatedException (co.cask.cdap.common.UnauthenticatedException)1 MetricQueryRequest (co.cask.cdap.proto.MetricQueryRequest)1 MetricTagValue (co.cask.cdap.proto.MetricTagValue)1 ApplicationId (co.cask.cdap.proto.id.ApplicationId)1 FlowletId (co.cask.cdap.proto.id.FlowletId)1 ProgramId (co.cask.cdap.proto.id.ProgramId)1 StreamId (co.cask.cdap.proto.id.StreamId)1 UnauthorizedException (co.cask.cdap.security.spi.authorization.UnauthorizedException)1 HttpResponse (co.cask.common.http.HttpResponse)1 ImmutableBiMap (com.google.common.collect.ImmutableBiMap)1 Gson (com.google.gson.Gson)1