/** * Computes totals for each of the {@link MetricType}s. * * @return aggregates for each global metric type. * @throws StorageException if there was a problem fetching tasks from storage. */ public List<GlobalMetric> computeConsumptionTotals() throws StorageException { List<GlobalMetric> counts = FluentIterable.from(Arrays.asList(MetricType.values())) .transform(TO_GLOBAL_METRIC) .toList(); for (ITaskConfig task : getTasks(Query.unscoped().active())) { for (GlobalMetric count : counts) { count.accumulate(task); } } return counts; }
public void increment() { if (isGlobalMetricsEnabled) { metric.increment(); } }
@Override public String toString() { return metric.toString(); }
public void update(long value) { if (isGlobalMetricsEnabled) { metric.change(value); } }