class GraphiteMetricFactory(Factory):

    def __init__(self):
        flusher = ConsumeFlush()
        self._metric_collection = MetricCollection(flusher)

    def processMetric(self, metric, datapoint):
        log.msg('Receive metric {} {}:{}'.format(metric, datapoint[0], datapoint[1]), level=logging.DEBUG)
        self._metric_collection.collect(metric, datapoint)

    def flushMetric(self):
        try:
            log.msg('Sending {} metrics'.format(self._metric_collection.count()), level=logging.DEBUG)
            self._metric_collection.flush()
        except Exception, e:
            log.err(e)
class GraphiteMetricFactory(Factory):
    def __init__(self):
        flusher = ConsumeFlush()
        self._metric_collection = MetricCollection(flusher)

    def processMetric(self, metric, datapoint):
        log.msg('Receive metric {} {}:{}'.format(metric, datapoint[0],
                                                 datapoint[1]),
                level=logging.DEBUG)
        self._metric_collection.collect(metric, datapoint)

    def flushMetric(self):
        try:
            log.msg('Sending {} metrics'.format(
                self._metric_collection.count()),
                    level=logging.DEBUG)
            self._metric_collection.flush()
        except Exception, e:
            log.err(e)
 def __init__(self):
     flusher = ConsumeFlush()
     self._metric_collection = MetricCollection(flusher)
 def __init__(self):
     flusher = ConsumeFlush()
     self._metric_collection = MetricCollection(flusher)