예제 #1
0
    def process(self, metric):
        if not pika:
            return

        try:
            self.channel.basic_publish(exchange=self.topic_exchange,
                                       routing_key=metric.getPathPrefix(),
                                       body=jsonify(metric))

        except Exception:  # Rough connection re-try logic.
            self.log.info(
                "Failed publishing to rabbitMQ. Attempting reconnect")
            self._bind()
            sleep(3)
예제 #2
0
    def process(self, metric):
        if not pika:
            return

        try:
            self.channel.basic_publish(
                exchange=self.topic_exchange,
                routing_key=metric.getPathPrefix(),
                body=jsonify(metric))

        except Exception:  # Rough connection re-try logic.
            self.log.info(
                "Failed publishing to rabbitMQ. Attempting reconnect")
            self._bind()
예제 #3
0
    def process(self, metric):
        if self.config.get('output_cloudify_format', False):
            metric = jsonify(metric)

        with open(self.config['log_path'], 'a') as f:
            cPickle.dump(metric, f)