diff options
author | Alec Hothan <ahothan@cisco.com> | 2017-09-19 19:10:29 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-09-19 19:10:29 +0000 |
commit | 230d84f20f70ebcbafa1f8f3d32461649c8c49b1 (patch) | |
tree | 3073883ca7a8a771daeebbfef7f89dcc9f6f2753 /nfvbench/nfvbench.py | |
parent | f0210f984f570ae4734d4d06c62363b820e885d6 (diff) | |
parent | 5bfd65ce5753b27c32afb9f84cf5b268f060cb03 (diff) |
Merge "NFVBENCH-25 Send run results to fluentd"
Diffstat (limited to 'nfvbench/nfvbench.py')
-rw-r--r-- | nfvbench/nfvbench.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/nfvbench/nfvbench.py b/nfvbench/nfvbench.py index 67b953f..920838a 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): @@ -453,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 +543,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({ |