fix(governance): scope adr100 automation metrics
All checks were successful
Code Review / ai-code-review (push) Successful in 10s
CD Pipeline / tests (push) Successful in 1m16s
CD Pipeline / build-and-deploy (push) Successful in 3m31s
CD Pipeline / post-deploy-checks (push) Successful in 1m28s

This commit is contained in:
Your Name
2026-05-14 19:13:32 +08:00
parent b677cb11de
commit b92c9e285f

View File

@@ -146,6 +146,7 @@ def _escape_label(value: str) -> str:
_AUTOMATION_OPERATION_SQL = """ _AUTOMATION_OPERATION_SQL = """
WITH automation_scope AS (
SELECT SELECT
CASE CASE
WHEN status <> 'success' THEN status WHEN status <> 'success' THEN status
@@ -154,9 +155,26 @@ _AUTOMATION_OPERATION_SQL = """
THEN 'human_required' THEN 'human_required'
ELSE 'auto_executed' ELSE 'auto_executed'
END AS outcome, END AS outcome,
operation_type
FROM automation_operation_log
WHERE operation_type IN (
'playbook_executed',
'remediation_executed',
'remediation_verified',
'remediation_rolled_back',
'self_correction_attempted'
)
UNION ALL
SELECT
CASE WHEN success THEN 'auto_executed' ELSE 'failed' END AS outcome,
'auto_repair_executed' AS operation_type
FROM auto_repair_executions
)
SELECT
outcome,
operation_type, operation_type,
count(*) AS count count(*) AS count
FROM automation_operation_log FROM automation_scope
GROUP BY outcome, operation_type GROUP BY outcome, operation_type
ORDER BY outcome, operation_type ORDER BY outcome, operation_type
""" """