docs(conductor): Synchronize tech-stack and commit monitor script updates
This commit is contained in:
@@ -38,7 +38,7 @@ def format_node_table(nodes, use_color=True):
|
||||
"""
|
||||
Formats the node list as a table.
|
||||
"""
|
||||
headers = ["Node", "Role", "Consul Status", "LiteFS Role", "Uptime", "Lag", "DBs", "LiteFS Info"]
|
||||
headers = ["Node", "Role", "Consul Status", "LiteFS Role", "Cand", "Uptime", "Lag", "DBs", "LiteFS Info"]
|
||||
table_data = []
|
||||
|
||||
for node in nodes:
|
||||
@@ -64,6 +64,11 @@ def format_node_table(nodes, use_color=True):
|
||||
litefs_primary = node["litefs_primary"]
|
||||
litefs_role = "primary" if litefs_primary else "replica"
|
||||
|
||||
# Candidate status
|
||||
candidate = "✓" if node.get("candidate") else "✗"
|
||||
candidate_color = GREEN if node.get("candidate") else RESET
|
||||
colored_candidate = colorize(candidate, candidate_color, use_color)
|
||||
|
||||
# Highlight discrepancy if consul and litefs disagree
|
||||
litefs_role_color = RESET
|
||||
if (role == "primary" and not litefs_primary) or (role == "replica" and litefs_primary):
|
||||
@@ -74,21 +79,33 @@ def format_node_table(nodes, use_color=True):
|
||||
|
||||
colored_litefs_role = colorize(litefs_role, litefs_role_color, use_color)
|
||||
|
||||
# Database details (name, txid, checksum)
|
||||
db_infos = []
|
||||
dbs = node.get("dbs", {})
|
||||
for db_name, db_data in dbs.items():
|
||||
txid = db_data.get("txid", "0")
|
||||
chk = db_data.get("checksum", "0")
|
||||
# Only show first 8 chars of checksum for space
|
||||
db_infos.append(f"{db_name} (tx:{int(txid, 16)}, chk:{chk[:8]})")
|
||||
|
||||
db_str = "\n".join(db_infos) if db_infos else "None"
|
||||
|
||||
# Error info
|
||||
info = ""
|
||||
if node.get("litefs_error"):
|
||||
info = colorize("LiteFS API Error", RED, use_color)
|
||||
else:
|
||||
info = node.get("advertise_url", "")
|
||||
info = node.get("address", "")
|
||||
|
||||
table_data.append([
|
||||
colorize(node["node"], BOLD, use_color),
|
||||
colored_role,
|
||||
colored_status,
|
||||
colored_litefs_role,
|
||||
colored_candidate,
|
||||
node.get("uptime", "N/A"),
|
||||
node.get("replication_lag", "N/A"),
|
||||
", ".join(node.get("active_dbs", [])),
|
||||
db_str,
|
||||
info
|
||||
])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user