private void sendAggregatedData()

in metrics-core/src/main/java/software/amazon/swage/metrics/record/cloudwatch/CloudWatchRecorder.java [460:481]


    private void sendAggregatedData() {

        // Grab all the current aggregated attributes, resetting
        // the aggregator to empty in the process
        List<MetricDatum> metricData = aggregator.flush();
        if(metricData.isEmpty()) {
            return;
        }

        // Send the attributes in batches to adhere to CloudWatch limitation on the
        // number of MetricDatum objects per request, see:
        // http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/cloudwatch_limits.html
        int begin = 0;
        while(begin < metricData.size()) {
            int end = begin + BATCH_SIZE;

            sendData(metricData.subList(begin, Math.min(end, metricData.size())));

            begin = end;
        }

    }