Search in sources :

Example 6 with MetricTagValue

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

the class MetricsQueryHelper method parseTagValues.

private List<MetricTagValue> parseTagValues(List<String> tags) {
    List<MetricTagValue> result = Lists.newArrayList();
    for (String tag : tags) {
        // split by ':' and add the tagValue to result list
        String[] tagSplit = tag.split(":", 2);
        if (tagSplit.length == 2) {
            String value = tagSplit[1].equals(ANY_TAG_VALUE) ? null : tagSplit[1];
            result.add(new MetricTagValue(tagSplit[0], value));
        }
    }
    return result;
}
Also used : MetricTagValue(co.cask.cdap.proto.MetricTagValue)

Example 7 with MetricTagValue

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

the class MetricsQueryHelper method parseTagValuesAsMap.

private Map<String, String> parseTagValuesAsMap(List<String> tags) {
    List<MetricTagValue> tagValues = parseTagValues(tags);
    Map<String, String> result = Maps.newHashMap();
    for (MetricTagValue tagValue : tagValues) {
        result.put(tagValue.getName(), tagValue.getValue());
    }
    return result;
}
Also used : MetricTagValue(co.cask.cdap.proto.MetricTagValue)

Aggregations

MetricTagValue (co.cask.cdap.proto.MetricTagValue)7 TagValue (co.cask.cdap.api.metrics.TagValue)1 FakeApp (co.cask.cdap.client.app.FakeApp)1 MetricQueryResult (co.cask.cdap.proto.MetricQueryResult)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 HttpResponse (co.cask.common.http.HttpResponse)1 ImmutableList (com.google.common.collect.ImmutableList)1 TypeToken (com.google.common.reflect.TypeToken)1 URL (java.net.URL)1 List (java.util.List)1 Test (org.junit.Test)1