diff options
author | Billy Donahue <billy.donahue@mongodb.com> | 2020-02-20 16:23:33 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-02-22 06:18:42 +0000 |
commit | 9916fbb11fee1c251d0a0cd19acb9d766302e9c8 (patch) | |
tree | 46061d1ec28705f4953bc1c273cdfe4a82e474ab /buildscripts/mongosymb.py | |
parent | 71415a4a6da9efffb99941e4bae5a478c2ffecec (diff) | |
download | mongo-9916fbb11fee1c251d0a0cd19acb9d766302e9c8.tar.gz |
SERVER-46260 handle structured log lines in mongosymb.py
Diffstat (limited to 'buildscripts/mongosymb.py')
-rwxr-xr-x | buildscripts/mongosymb.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/buildscripts/mongosymb.py b/buildscripts/mongosymb.py index 1cb9c8ede64..44cfd56008d 100755 --- a/buildscripts/mongosymb.py +++ b/buildscripts/mongosymb.py @@ -211,6 +211,25 @@ def main(): trace_doc = trace_doc[trace_doc.find('{'):] trace_doc = json.JSONDecoder().raw_decode(trace_doc)[0] + # Search the trace_doc for an object having "backtrace" and "processInfo" keys. + def bt_search(obj): + try: + if "backtrace" in obj and "processInfo" in obj: + return obj + for _, val in obj.items(): + res = bt_search(val) + if res: + return res + except (TypeError, AttributeError): + pass + return None + + trace_doc = bt_search(trace_doc) + + if not trace_doc: + print("could not find json backtrace object in input", file=sys.stderr) + exit(1) + output_fn = None if options.output_format == 'json': output_fn = json.dump |