X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Ftools%2Fpresentation%2Fconvert_xml_json.py;h=73469cd0257d5f251688e7d0248fabd94ddc1af0;hb=f14292d2b8f946263ee9160830908050c002c2fc;hp=61c6e84a98d1b2904fcbec4fdad17c7c9a9d73b2;hpb=36048e330c53b0325fb120da0f7661ad2dd44611;p=csit.git diff --git a/resources/tools/presentation/convert_xml_json.py b/resources/tools/presentation/convert_xml_json.py index 61c6e84a98..73469cd025 100644 --- a/resources/tools/presentation/convert_xml_json.py +++ b/resources/tools/presentation/convert_xml_json.py @@ -28,6 +28,7 @@ import gzip from os.path import join from shutil import rmtree from copy import deepcopy +from json import loads from pal_utils import get_files @@ -194,37 +195,42 @@ def _export_test_from_xml_to_json(tid, in_data, out, template, metadata): ) # Process show runtime: - in_sh_run = deepcopy(in_data.get(u"show-run", None)) - if in_sh_run: - # Transform to openMetrics format - for key, val in in_sh_run.items(): - log_item = { - u"source_type": u"node", - u"source_id": key, - u"msg_type": u"metric", - u"log_level": u"INFO", - u"timestamp": in_data.get(u"starttime", u""), - u"msg": u"show_runtime", - u"data": list() - } - for item in val.get(u"runtime", list()): - for metric, m_data in item.items(): - if metric == u"name": - continue - for idx, m_item in enumerate(m_data): - log_item[u"data"].append( - { - u"name": metric, - u"value": m_item, - u"labels": { - u"host": val.get(u"host", u""), - u"socket": val.get(u"socket", u""), - u"graph_node": item.get(u"name", u""), - u"thread_id": str(idx) + if in_data.get(u"telemetry-show-run", None): + for item in in_data[u"telemetry-show-run"].values(): + data.add_to_list(u"log", item.get(u"runtime", dict())) + else: + in_sh_run = deepcopy(in_data.get(u"show-run", None)) + if in_sh_run: + # Transform to openMetrics format + for key, val in in_sh_run.items(): + log_item = { + u"source_type": u"node", + u"source_id": key, + u"msg_type": u"metric", + u"log_level": u"INFO", + u"timestamp": in_data.get(u"starttime", u""), + u"msg": u"show_runtime", + u"data": list() + } + runtime = loads(val.get(u"runtime", list())) + for item in runtime: + for metric, m_data in item.items(): + if metric == u"name": + continue + for idx, m_item in enumerate(m_data): + log_item[u"data"].append( + { + u"name": metric, + u"value": m_item, + u"labels": { + u"host": val.get(u"host", u""), + u"socket": val.get(u"socket", u""), + u"graph_node": item.get(u"name", u""), + u"thread_id": str(idx) + } } - } - ) - data.add_to_list(u"log", log_item) + ) + data.add_to_list(u"log", log_item) # Process results: results = dict()