

def flush(self):
    timestamp = time()
    expiry_timestamp = (timestamp - self.expiry_seconds)
    metrics = []
    for (context, metric) in self.metrics.items():
        if (metric.last_sample_time < expiry_timestamp):
            log.debug(("%s hasn't been submitted in %ss. Expiring." % (context, self.expiry_seconds)))
            del self.metrics[context]
        else:
            metrics += metric.flush(timestamp, self.interval)
    if (self.num_discarded_old_points > 0):
        log.warn(('%s points were discarded as a result of having an old timestamp' % self.num_discarded_old_points))
        self.num_discarded_old_points = 0
    log.debug(('received %s payloads since last flush' % self.count))
    self.total_count += self.count
    self.count = 0
    return metrics

dataset/ETHPy150Open serverdensity/sd-agent/aggregator.py MetricsAggregator.flush/original