fix(reboot): reconcile runtime-cleared maintenance blockers
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 55s
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / build-and-deploy (push) Has been cancelled
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 55s
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / build-and-deploy (push) Has been cancelled
This commit is contained in:
@@ -413,6 +413,8 @@ def _annotate_prometheus_metric_readback(
|
||||
)
|
||||
payload["runtime_metric_source_control_reconciled_blockers"] = []
|
||||
payload["runtime_metric_source_control_reconciled_blocker_count"] = 0
|
||||
payload["runtime_metric_runtime_readback_reconciled_blockers"] = []
|
||||
payload["runtime_metric_runtime_readback_reconciled_blocker_count"] = 0
|
||||
|
||||
readback = _dict(payload.setdefault("readback", {}))
|
||||
readback["runtime_metric_readback_present"] = present
|
||||
@@ -425,6 +427,8 @@ def _annotate_prometheus_metric_readback(
|
||||
]
|
||||
readback["runtime_metric_source_control_reconciled_blockers"] = []
|
||||
readback["runtime_metric_source_control_reconciled_blocker_count"] = 0
|
||||
readback["runtime_metric_runtime_readback_reconciled_blockers"] = []
|
||||
readback["runtime_metric_runtime_readback_reconciled_blocker_count"] = 0
|
||||
|
||||
rollups = _dict(payload.setdefault("rollups", {}))
|
||||
rollups["runtime_metric_readback_present"] = present
|
||||
@@ -435,6 +439,7 @@ def _annotate_prometheus_metric_readback(
|
||||
"runtime_metric_last_run_timestamp"
|
||||
]
|
||||
rollups["runtime_metric_source_control_reconciled_blocker_count"] = 0
|
||||
rollups["runtime_metric_runtime_readback_reconciled_blocker_count"] = 0
|
||||
_apply_prometheus_windows99_vmware_readback(payload, metric_readback)
|
||||
|
||||
|
||||
@@ -563,6 +568,55 @@ def _reconcile_prometheus_metric_active_blockers_with_source_controls(
|
||||
return _unique_strings(reconciled)
|
||||
|
||||
|
||||
def _reconcile_prometheus_metric_active_blockers_with_runtime_readbacks(
|
||||
payload: dict[str, Any],
|
||||
active_blockers: list[str],
|
||||
) -> list[str]:
|
||||
public_maintenance = _dict(payload.get("public_maintenance_fallback"))
|
||||
public_maintenance_ready = (
|
||||
public_maintenance.get("runtime_readback_present") is True
|
||||
and public_maintenance.get("ready") is True
|
||||
and _int(public_maintenance.get("raw_5xx_without_fallback_count")) == 0
|
||||
and _int(
|
||||
public_maintenance.get("route_unreachable_without_external_fallback_count")
|
||||
)
|
||||
== 0
|
||||
)
|
||||
runtime_ready_blockers = (
|
||||
_PUBLIC_MAINTENANCE_BLOCKERS if public_maintenance_ready else set()
|
||||
)
|
||||
if not runtime_ready_blockers:
|
||||
return _unique_strings(active_blockers)
|
||||
|
||||
reconciled: list[str] = []
|
||||
removed: list[str] = []
|
||||
for blocker in active_blockers:
|
||||
if blocker in runtime_ready_blockers:
|
||||
removed.append(blocker)
|
||||
continue
|
||||
reconciled.append(blocker)
|
||||
|
||||
removed = _unique_strings(removed)
|
||||
if removed:
|
||||
payload["runtime_metric_runtime_readback_reconciled_blockers"] = removed
|
||||
payload["runtime_metric_runtime_readback_reconciled_blocker_count"] = len(
|
||||
removed
|
||||
)
|
||||
|
||||
readback = _dict(payload.setdefault("readback", {}))
|
||||
readback["runtime_metric_runtime_readback_reconciled_blockers"] = removed
|
||||
readback["runtime_metric_runtime_readback_reconciled_blocker_count"] = len(
|
||||
removed
|
||||
)
|
||||
|
||||
rollups = _dict(payload.setdefault("rollups", {}))
|
||||
rollups["runtime_metric_runtime_readback_reconciled_blocker_count"] = len(
|
||||
removed
|
||||
)
|
||||
|
||||
return _unique_strings(reconciled)
|
||||
|
||||
|
||||
def _apply_prometheus_metric_active_blockers(
|
||||
payload: dict[str, Any],
|
||||
metric_readback: dict[str, Any],
|
||||
@@ -576,6 +630,10 @@ def _apply_prometheus_metric_active_blockers(
|
||||
payload,
|
||||
active_blockers,
|
||||
)
|
||||
active_blockers = _reconcile_prometheus_metric_active_blockers_with_runtime_readbacks(
|
||||
payload,
|
||||
active_blockers,
|
||||
)
|
||||
|
||||
can_claim_slo = metric_readback.get("ready") is True and not active_blockers
|
||||
primary_blocker = str(
|
||||
|
||||
Reference in New Issue
Block a user