From 631ad5beb01c12f015d1026b126ab75ed7666a66 Mon Sep 17 00:00:00 2001 From: liyaqin1 <42289525+liyaqin1@users.noreply.github.com> Date: Tue, 4 Jun 2024 16:54:26 -0700 Subject: [PATCH] catch exception if the metric data is not json format --- deploy-board/deploy_board/webapp/util_views.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deploy-board/deploy_board/webapp/util_views.py b/deploy-board/deploy_board/webapp/util_views.py index f280fc76cc..9e3728c45e 100644 --- a/deploy-board/deploy_board/webapp/util_views.py +++ b/deploy-board/deploy_board/webapp/util_views.py @@ -47,7 +47,11 @@ def _get_latest_metrics(url): if not data_str: return 0 - data = json.loads(data_str) + try: + data = json.loads(data_str) + except Exception: + log.warning(f"Json decode error for metrics data {data_str}") + return 0 # Return the first datapoint in the datapoints list if data: try: