feat(diagnose): Update Consul client to fetch health check output and display diagnostics
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user