def store(self, metric, datapoint): timestamp, value = datapoint if timestamp not in self[metric]: # Not a duplicate, hence process if cache is not full if self.is_full: log.msg("MetricCache is full: self.size=%d" % self.size) events.cacheFull() else: self.size += 1 self[metric][timestamp] = value else: # Updating a duplicate does not increase the cache size self[metric][timestamp] = value
def store(self, metric, datapoint): self.setdefault(metric, {}) timestamp, value = datapoint if metric not in EXISTING_METRICS: NEED_TO_CREATE_METRICS.add(metric) if timestamp not in self[metric]: # Not a duplicate, hence process if cache is not full if self.is_full: log.msg("MetricCache is full: self.size=%d" % self.size) events.cacheFull() else: self.size += 1 self[metric][timestamp] = value else: # Updating a duplicate does not increase the cache size self[metric][timestamp] = value
def queueFullCallback(self, result): events.cacheFull() log.clients('%s send queue is full (%d datapoints)' % (self, result))