def prepare_summary(self, result):
"""Prepares summary of the result to print and send it to logger (eg: fluentd)"""
- sender = FluentLogHandler("resultnfvbench",
- fluentd_ip=self.config.fluentd.ip,
- fluentd_port=self.config.fluentd.port) \
- if self.config.fluentd.logging_tag else None
+ global fluent_logger
+ sender = None
+ if self.config.fluentd.result_tag:
+ sender = FluentLogHandler(self.config.fluentd.result_tag,
+ fluentd_ip=self.config.fluentd.ip,
+ fluentd_port=self.config.fluentd.port)
+ sender.runlogdate = fluent_logger.runlogdate
summary = NFVBenchSummarizer(result, sender)
LOG.info(str(summary))
if opts.summary:
with open(opts.summary) as json_data:
- print NFVBenchSummarizer(json.load(json_data), None)
+ result = json.load(json_data)
+ if opts.user_label:
+ result['config']['user_label'] = opts.user_label
+ if config.fluentd.result_tag:
+ sender = FluentLogHandler(config.fluentd.result_tag,
+ fluentd_ip=config.fluentd.ip,
+ fluentd_port=config.fluentd.port)
+ sender.runlogdate = fluent_logger.runlogdate
+ print NFVBenchSummarizer(result, sender)
+ else:
+ print NFVBenchSummarizer(result, None)
sys.exit(0)
# show default config in text/yaml format