X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;ds=inline;f=nfvbench%2Fnfvbench.py;h=cee54f09e846e881eb5cbffb398d0d181084ad07;hb=5bfd65ce5753b27c32afb9f84cf5b268f060cb03;hp=37645aadb04f6ecd7bad150be69b4d97e0fe804b;hpb=4e74e931fb22017abffbe0c4dbed668d5be14e54;p=nfvbench.git diff --git a/nfvbench/nfvbench.py b/nfvbench/nfvbench.py index 37645aa..cee54f0 100644 --- a/nfvbench/nfvbench.py +++ b/nfvbench/nfvbench.py @@ -127,9 +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): @@ -456,7 +460,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 @@ -542,7 +546,7 @@ def main(): 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({