Ejemplo n.º 1
0
  private List<MeasurementDataNumericHighLowComposite> createComposites(
      Iterable<AggregateNumericMetric> metrics, long beginTime, long endTime, int numberOfBuckets) {

    Buckets buckets = new Buckets(beginTime, endTime, numberOfBuckets);
    for (AggregateNumericMetric metric : metrics) {
      if (invalidMetricsManager.isInvalidMetric(metric)) {
        log.warn(
            "The "
                + metric.getBucket()
                + " metric "
                + metric
                + " is invalid. It will be excluded from "
                + "the results sent to the client and we will attempt to recompute the metric.");
        invalidMetricsManager.submit(metric);
      } else {
        buckets.insert(metric.getTimestamp(), metric.getAvg(), metric.getMin(), metric.getMax());
      }
    }

    List<MeasurementDataNumericHighLowComposite> data =
        new ArrayList<MeasurementDataNumericHighLowComposite>();
    for (int i = 0; i < buckets.getNumDataPoints(); ++i) {
      Buckets.Bucket bucket = buckets.get(i);
      data.add(
          new MeasurementDataNumericHighLowComposite(
              bucket.getStartTime(), bucket.getAvg(), bucket.getMax(), bucket.getMin()));
    }
    return data;
  }
Ejemplo n.º 2
0
 public void shutdown() {
   numericQueueConsumer.shutdown();
   try {
     numericQueueConsumer.join(); // Lets wait for it to finish before we continue..
   } catch (InterruptedException e) {
     log.warn("Potential data loss while waiting for the queue to empty, ", e);
   }
   aggregationManager.shutdown();
   invalidMetricsManager.shutdown();
 }
Ejemplo n.º 3
0
 public void shutdown() {
   aggregationManager.shutdown();
   invalidMetricsManager.shutdown();
 }