Skip to content
Snippets Groups Projects
Commit d02f5e9d authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

more robust instrumentation_as_json

1) If input data contains heavy Unicode, export() will not fail.
2) Exported string will be reliably a str, UTF-8 encoded
parent 0a3d5568
No related branches found
No related tags found
No related merge requests found
......@@ -25,5 +25,7 @@ def asval(cc):
return f
def export(insmgr):
"""Constructs a JSON string based on data from given insmgr"""
return json.dumps(asval(insmgr))
\ No newline at end of file
"""Constructs a JSON string based on data from given insmgr.
@type insmgr: satella.instrumentation.CounterCollection
@return: UTF-8 encoded JSON"""
return json.dumps(asval(insmgr), ensure_ascii=False).encode('utf8')
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment