From 3a04f1de1fa95af6bdcc3a90cda33275a6858267 Mon Sep 17 00:00:00 2001 From: liyaqin1 <42289525+liyaqin1@users.noreply.github.com> Date: Fri, 26 Jan 2024 15:16:29 -0800 Subject: [PATCH] send service health status including healthy, unhealthy, none and redeploy (#1427) * send service health status including healthy, unhealthy, none and redeploy * bump the version * fix a bug * fix a typo * fix typo * don't send none to statsboard * fix a typo --- deploy-agent/deployd/__init__.py | 2 +- deploy-agent/deployd/common/utils.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/deploy-agent/deployd/__init__.py b/deploy-agent/deployd/__init__.py index 10b336e34b..0f0ac668bb 100644 --- a/deploy-agent/deployd/__init__.py +++ b/deploy-agent/deployd/__init__.py @@ -27,4 +27,4 @@ # 2: puppet applied successfully with changes PUPPET_SUCCESS_EXIT_CODES = [0, 2] -__version__ = '1.2.56' \ No newline at end of file +__version__ = '1.2.57' \ No newline at end of file diff --git a/deploy-agent/deployd/common/utils.py b/deploy-agent/deployd/common/utils.py index 016bc4689b..04787f4593 100644 --- a/deploy-agent/deployd/common/utils.py +++ b/deploy-agent/deployd/common/utils.py @@ -251,11 +251,20 @@ def get_container_health_info(commit, service, redeploy): labels = parts[2].split(',') ret = redeploy_check(labels, service, redeploy) if ret > 0: + send_statsboard_metric(name='deployd.service_health_status', value=1, + tags={"status": "redeploy", "service": service, "commit": commit}) return "redeploy-" + str(ret) result.append(f"{name}:{status}") except: continue - return ";".join(result) if result else None + returnValue = ";".join(result) if result else None + if returnValue and "unhealthy" in returnValue: + send_statsboard_metric(name='deployd.service_health_status', value=1, + tags={"status": "unhealthy", "service": service, "commit": commit}) + elif returnValue and "unhealthy" not in returnValue: + send_statsboard_metric(name='deployd.service_health_status', value=1, + tags={"status": "healthy", "service": service, "commit": commit}) + return returnValue else: return None except: