feat: expose ZT reconciliation drift metrics in job output

This commit is contained in:
2026-06-02 04:32:55 +00:00
parent 66df4b6ab5
commit f002f4e495
2 changed files with 15 additions and 0 deletions
@@ -44,6 +44,10 @@ def run_reconciliation() -> dict:
results = { results = {
"expired_activations": 0, "expired_activations": 0,
"networks_processed": 0, "networks_processed": 0,
"authorized": 0,
"deauthorized": 0,
"deleted_memberships": 0,
"delete_errors": 0,
"errors": 0, "errors": 0,
} }
@@ -56,6 +60,10 @@ def run_reconciliation() -> dict:
try: try:
summary = zerotier_reconciliation_service.reconcile_all() summary = zerotier_reconciliation_service.reconcile_all()
results["networks_processed"] = summary.get("networks_processed", 0) results["networks_processed"] = summary.get("networks_processed", 0)
results["authorized"] = summary.get("authorized", 0)
results["deauthorized"] = summary.get("deauthorized", 0)
results["deleted_memberships"] = summary.get("deleted_memberships", 0)
results["delete_errors"] = summary.get("delete_errors", 0)
results["errors"] = summary.get("errors", 0) results["errors"] = summary.get("errors", 0)
except Exception as exc: except Exception as exc:
logger.error(f"[ZT Reconcile] Error during network reconciliation: {exc}") logger.error(f"[ZT Reconcile] Error during network reconciliation: {exc}")
@@ -65,6 +73,9 @@ def run_reconciliation() -> dict:
f"[ZT Reconcile] Complete at {datetime.now(timezone.utc).isoformat()}: " f"[ZT Reconcile] Complete at {datetime.now(timezone.utc).isoformat()}: "
f"expired={results['expired_activations']} " f"expired={results['expired_activations']} "
f"networks={results['networks_processed']} " f"networks={results['networks_processed']} "
f"authorized={results['authorized']} "
f"deauthorized={results['deauthorized']} "
f"purged={results['deleted_memberships']} "
f"errors={results['errors']}" f"errors={results['errors']}"
) )
+4
View File
@@ -106,6 +106,10 @@ def run_zerotier_reconciliation():
print("Job Results:") print("Job Results:")
print(f" Expired activations: {result['expired_activations']}") print(f" Expired activations: {result['expired_activations']}")
print(f" Networks processed: {result['networks_processed']}") print(f" Networks processed: {result['networks_processed']}")
print(f" Authorized: {result['authorized']}")
print(f" Deauthorized: {result['deauthorized']}")
print(f" Purged memberships: {result['deleted_memberships']}")
print(f" Purge errors: {result['delete_errors']}")
print(f" Errors: {result['errors']}") print(f" Errors: {result['errors']}")
print() print()