Skip to content

Commit

Permalink
send service health status including healthy, unhealthy, none and red…
Browse files Browse the repository at this point in the history
…eploy
  • Loading branch information
liyaqin1 committed Jan 24, 2024
1 parent 8163211 commit 55d0053
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion deploy-agent/deployd/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,28 @@ 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
ret = ";".join(result) if result else None
if "unhealthy" in ret:
send_statsboard_metric(name='deployd.service_health_status', value=1,
tags={"status": "unhealthy", "service": service, "commit": commit})
else:
send_statsboard_metric(name='deployd.service_health_status', value=1,
tags={"status": "healthy", "service": service, "commit": commit})
return ret
else:
send_statsboard_metric(name='deployd.service_health_status', value=1,
tags={"status": "None", "service": service, "commit": commit})
return None
except:
log.error(f"Failed to get container health info with commit {commit}")
send_statsboard_metric(name='deployd.service_health_status', value=1,
tags={"status": "None", "service": service, "commit": commit})
return None


Expand Down

0 comments on commit 55d0053

Please sign in to comment.