From: Alec Hothan Date: Tue, 19 Sep 2017 19:10:29 +0000 (+0000) Subject: Merge "NFVBENCH-25 Send run results to fluentd" X-Git-Tag: 1.0.9~2 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=230d84f20f70ebcbafa1f8f3d32461649c8c49b1;hp=-c;p=nfvbench.git Merge "NFVBENCH-25 Send run results to fluentd" --- 230d84f20f70ebcbafa1f8f3d32461649c8c49b1 diff --combined nfvbench/nfvbench.py index 67b953f,cee54f0..920838a --- a/nfvbench/nfvbench.py +++ b/nfvbench/nfvbench.py @@@ -127,9 -127,13 +127,13 @@@ class NFVBench(object) 'error_message': message } - def print_summary(self, result): - """Print summary of the result""" - summary = NFVBenchSummarizer(result) + 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 + summary = NFVBenchSummarizer(result, sender) LOG.info(str(summary)) def save(self, result): @@@ -291,6 -295,9 +295,6 @@@ def parse_opts_from_cli() action='store', help='Traffic generator profile to use') - parser.add_argument('-i', '--image', dest='image_name', - action='store', - help='VM image name to use') parser.add_argument('-0', '--no-traffic', dest='no_traffic', default=None, @@@ -453,7 -460,7 +457,7 @@@ def main() if opts.summary: with open(opts.summary) as json_data: - print NFVBenchSummarizer(json.load(json_data)) + print NFVBenchSummarizer(json.load(json_data), None) sys.exit(0) # show default config in text/yaml format @@@ -539,7 -546,7 +543,7 @@@ if 'result' in result and result['status']: nfvbench.save(result['result']) - nfvbench.print_summary(result['result']) + nfvbench.prepare_summary(result['result']) except Exception as exc: run_summary_required = True LOG.error({