feat(diagnose): Update Consul client to fetch health check output and display diagnostics

This commit is contained in:
2026-02-08 07:44:22 -08:00
parent 3c4c1c4d80
commit 7c0c146d0c
5 changed files with 112 additions and 2 deletions

View File

@@ -25,13 +25,19 @@ def get_cluster_services(consul_url):
address = item["Node"]["Address"]
port = item["Service"]["Port"]
# Determine overall status from checks
# Determine overall status from checks and extract output
checks = item.get("Checks", [])
status = "passing"
check_output = ""
for check in checks:
if check["Status"] != "passing":
status = check["Status"]
check_output = check.get("Output", "")
break
else:
# Even if passing, store the output of the first check if it's the only one
if not check_output:
check_output = check.get("Output", "")
services.append({
"node": node_name,
@@ -39,7 +45,8 @@ def get_cluster_services(consul_url):
"port": port,
"role": role,
"status": status,
"service_id": item["Service"]["ID"]
"service_id": item["Service"]["ID"],
"check_output": check_output
})
except Exception as e:
# For now, we just don't add the service if it fails to fetch