aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/presentation/convert_xml_json.py
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2021-06-25 13:56:43 +0200
committerTibor Frank <tifrank@cisco.com>2021-06-28 10:22:43 +0000
commit7b4dc49521908774f9eb2f5d287078cce06d8e49 (patch)
tree13c80339eb55bab95fa307ce56e1a9c7c8821105 /resources/tools/presentation/convert_xml_json.py
parentc969f0ba092c4cd9b9115f414cd32442675a006f (diff)
PAL: Process sh-run from telemetry
Change-Id: Ia1a3427609b284d0036dfe3b2ffbb17a9b4f8a65 Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/tools/presentation/convert_xml_json.py')
-rw-r--r--resources/tools/presentation/convert_xml_json.py66
1 files changed, 35 insertions, 31 deletions
diff --git a/resources/tools/presentation/convert_xml_json.py b/resources/tools/presentation/convert_xml_json.py
index f1994df6b8..73469cd025 100644
--- a/resources/tools/presentation/convert_xml_json.py
+++ b/resources/tools/presentation/convert_xml_json.py
@@ -195,38 +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()
- }
- 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)
+ 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()