Пример #1
0
  /**
   * 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;
  }
Пример #2
0
 public void increment() {
   if (isGlobalMetricsEnabled) {
     metric.increment();
   }
 }
Пример #3
0
 @Override
 public String toString() {
   return metric.toString();
 }
Пример #4
0
 public void update(long value) {
   if (isGlobalMetricsEnabled) {
     metric.change(value);
   }
 }