summaryrefslogtreecommitdiff
path: root/buildscripts/mongosymb.py
diff options
context:
space:
mode:
authorBilly Donahue <billy.donahue@mongodb.com>2020-02-20 16:23:33 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-02-22 06:18:42 +0000
commit9916fbb11fee1c251d0a0cd19acb9d766302e9c8 (patch)
tree46061d1ec28705f4953bc1c273cdfe4a82e474ab /buildscripts/mongosymb.py
parent71415a4a6da9efffb99941e4bae5a478c2ffecec (diff)
downloadmongo-9916fbb11fee1c251d0a0cd19acb9d766302e9c8.tar.gz
SERVER-46260 handle structured log lines in mongosymb.py
Diffstat (limited to 'buildscripts/mongosymb.py')
-rwxr-xr-xbuildscripts/mongosymb.py19
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