Search in sources :

Example 6 with Metric

use of alluxio.metrics.Metric in project alluxio by Alluxio.

the class SingleTagValueAggregator method updateValues.

@Override
public Map<String, Long> updateValues(Set<Metric> set) {
    Map<String, Long> updated = new HashMap<>();
    for (Metric metric : set) {
        Map<String, String> tags = metric.getTags();
        if (tags.containsKey(mTagName)) {
            String ufsName = Metric.getMetricNameWithTags(mAggregationName, mTagName, tags.get(mTagName));
            long value = updated.getOrDefault(ufsName, 0L);
            updated.put(ufsName, (long) (value + metric.getValue()));
        }
    }
    synchronized (this) {
        mAggregates = updated;
    }
    return Collections.unmodifiableMap(mAggregates);
}
Also used : HashMap(java.util.HashMap) Metric(alluxio.metrics.Metric)

Aggregations

Metric (alluxio.metrics.Metric)6 Test (org.junit.Test)4 AlluxioURI (alluxio.AlluxioURI)3 Counter (com.codahale.metrics.Counter)3 SingleTagValueAggregator (alluxio.metrics.aggregator.SingleTagValueAggregator)1 Gauge (com.codahale.metrics.Gauge)1 HashMap (java.util.HashMap)1