def flush(self, context): expired = (self.retention_time and timeutils.is_older_than( self.initial_timestamp, self.retention_time)) full = self.aggregated_samples >= self.size if full or expired: x = self.samples.values() self.samples = {} self.aggregated_samples = 0 self.initial_timestamp = None return x return []
def flush(self, context): expired = self.retention_time and \ timeutils.is_older_than(self.initial_timestamp, self.retention_time) full = self.aggregated_samples >= self.size if full or expired: x = self.samples.values() self.samples = {} self.aggregated_samples = 0 self.initial_timestamp = None return x return []
def flush(self, context): if not self.initial_timestamp: return [] expired = (self.retention_time and timeutils.is_older_than(self.initial_timestamp, self.retention_time)) full = self.aggregated_samples >= self.size if full or expired: x = self.samples.values() # gauge aggregates need to be averages for s in x: if s.type == sample.TYPE_GAUGE: key = self._get_unique_key(s) s.volume /= self.counts[key] self.samples.clear() self.counts.clear() self.aggregated_samples = 0 self.initial_timestamp = None return x return []