fix(reboot): prefer windows99 runtime metrics
All checks were successful
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 1m11s
CD Pipeline / build-and-deploy (push) Successful in 5m22s
CD Pipeline / post-deploy-checks (push) Successful in 2m14s
All checks were successful
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 1m11s
CD Pipeline / build-and-deploy (push) Successful in 5m22s
CD Pipeline / post-deploy-checks (push) Successful in 2m14s
This commit is contained in:
@@ -46,6 +46,9 @@ _PROMETHEUS_RUNTIME_QUERIES = {
|
||||
"last_run_timestamp": "awoooi_reboot_auto_recovery_slo_last_run_timestamp",
|
||||
"windows99_vmware_readback_present": "awoooi_windows99_vmware_readback_present",
|
||||
"windows99_vmware_verify_ready": "awoooi_windows99_vmware_verify_ready",
|
||||
"windows99_vmware_autostart_config_ready": (
|
||||
"awoooi_windows99_vmware_autostart_config_ready"
|
||||
),
|
||||
"windows99_windows_update_ready": (
|
||||
"awoooi_windows99_vmware_windows_update_no_auto_reboot_ready"
|
||||
),
|
||||
@@ -401,12 +404,19 @@ def _load_reboot_slo_prometheus_metric_readback(
|
||||
)
|
||||
== 1
|
||||
)
|
||||
windows99_update_ready = (
|
||||
_prometheus_first_int(
|
||||
scalar_results.get("windows99_windows_update_ready") or [],
|
||||
default=0,
|
||||
)
|
||||
== 1
|
||||
windows99_config_metric = _prometheus_first_int(
|
||||
scalar_results.get("windows99_vmware_autostart_config_ready") or [],
|
||||
default=-1,
|
||||
)
|
||||
windows99_config_ready: bool | None = (
|
||||
None if windows99_config_metric < 0 else windows99_config_metric == 1
|
||||
)
|
||||
windows99_update_metric = _prometheus_first_int(
|
||||
scalar_results.get("windows99_windows_update_ready") or [],
|
||||
default=-1,
|
||||
)
|
||||
windows99_update_ready: bool | None = (
|
||||
None if windows99_update_metric < 0 else windows99_update_metric == 1
|
||||
)
|
||||
windows99_missing_vmx_aliases = _prometheus_label_values(
|
||||
missing_vmx_results,
|
||||
@@ -440,6 +450,7 @@ def _load_reboot_slo_prometheus_metric_readback(
|
||||
"last_run_timestamp": last_run_timestamp,
|
||||
"windows99_vmware_readback_present": windows99_readback_present,
|
||||
"windows99_vmware_verify_ready": windows99_verify_ready,
|
||||
"windows99_vmware_autostart_config_ready": windows99_config_ready,
|
||||
"windows99_windows_update_no_auto_reboot_ready": windows99_update_ready,
|
||||
"windows99_missing_vmx_aliases": windows99_missing_vmx_aliases,
|
||||
"windows99_powered_off_aliases": windows99_powered_off_aliases,
|
||||
@@ -714,9 +725,15 @@ def _apply_prometheus_windows99_vmware_readback(
|
||||
blocker for blocker in active_blockers if blocker.startswith("windows99_")
|
||||
]
|
||||
verify_ready = metric_readback.get("windows99_vmware_verify_ready") is True
|
||||
update_ready = (
|
||||
metric_readback.get("windows99_windows_update_no_auto_reboot_ready") is True
|
||||
metric_config_ready = metric_readback.get(
|
||||
"windows99_vmware_autostart_config_ready"
|
||||
)
|
||||
metric_has_config_ready = isinstance(metric_config_ready, bool)
|
||||
metric_update_ready = metric_readback.get(
|
||||
"windows99_windows_update_no_auto_reboot_ready"
|
||||
)
|
||||
metric_has_update_ready = isinstance(metric_update_ready, bool)
|
||||
update_ready = metric_update_ready is True
|
||||
windows99 = _dict(payload.setdefault("windows99_vmware_autostart", {}))
|
||||
source_service_blockers = _strings(windows99.get("service_blockers"))
|
||||
source_policy_blockers = _strings(windows99.get("policy_blockers"))
|
||||
@@ -724,13 +741,26 @@ def _apply_prometheus_windows99_vmware_readback(
|
||||
source_config_blocked = bool(source_service_blockers) or (
|
||||
bool(source_task) and source_task.get("ok") is not True
|
||||
)
|
||||
if source_config_blocked:
|
||||
if metric_has_config_ready:
|
||||
if metric_config_ready is not True:
|
||||
windows99_blockers.append("windows99_vmware_autostart_config_not_ready")
|
||||
elif source_config_blocked:
|
||||
windows99_blockers.append("windows99_vmware_autostart_config_not_ready")
|
||||
if source_policy_blockers:
|
||||
if metric_has_update_ready:
|
||||
if metric_update_ready is not True:
|
||||
windows99_blockers.append(
|
||||
"windows99_update_no_auto_reboot_policy_not_ready"
|
||||
)
|
||||
elif source_policy_blockers:
|
||||
windows99_blockers.append("windows99_update_no_auto_reboot_policy_not_ready")
|
||||
update_ready = False
|
||||
windows99_blockers = _unique_strings(windows99_blockers)
|
||||
config_ready = not missing_vmx_aliases and not source_config_blocked
|
||||
metric_or_source_config_ready = (
|
||||
metric_config_ready is True
|
||||
if metric_has_config_ready
|
||||
else not source_config_blocked
|
||||
)
|
||||
config_ready = not missing_vmx_aliases and metric_or_source_config_ready
|
||||
windows99.update(
|
||||
{
|
||||
"readback_present": True,
|
||||
|
||||
Reference in New Issue
Block a user