Implementation plan / Session plan / Handover RC-1-S28-F13
Handover RC-1-S28-F13 Fix: every unit's alert rules are loaded into Grafana, and the audit, backbone, authorization and stuck-work alerts have rules¶
Card: RC-1-S28-F13. Issue: cema-care/his#219. Branch: session/RC-1-S28-F13. Owner session: RC-1-S10. Decision record: ADR-HIS-097.
Comes after RC-1-S28. The issue's first comment holds the gate's evidence. bin/grafana-apply loaded only grafana/alerting/rules.json (10 rules). The gateway rules (4) and the clock-drift rules (6) were never loaded. his.audit.alerts, his.backbone.alerts, his.authz.* and stuck work had no rule. This was readiness finding F-02, runbook entries A-01 to A-09 of the RC-1 runbooks.
Scope as read¶
The work is in platform/observability, the unit of RC-1-S10. It covers two things:
- load the Prometheus rule files that the gateways (RC-1-S12) and the time service (RC-1-S20) wrote in their own folders;
- write rules for the alerts that the audit service, the event backbone, the policy decision service and the workflow service only count or log. That is A-06, A-07, A-08 and the authorization part of IF-ESS-003.
Those units' code and rule files are not changed. A-09 (identity feed silent, service-identity rotation, certificates) is not named in the issue, and its sources write no counter yet. It is a follow-up.
What was built and where¶
All in platform/observability, except the decision record and its row in the index.
bin/grafana-applyimports rule files.rules.jsongainsimports, and each entry names a Prometheus rule file of another unit. The script reads each file (PyYAML) and loads every group as a Grafana rule group of the same name in the folderhis-platform:his-gateways, fromplatform/gateways/observability/alert-rules.yaml;his-clock-drift, fromplatform/deployment-topology/observability/clock-drift.rules.yaml.
Prometheus behaviour is kept. Each imported rule is query A (the expression as written) and the math condition $A == $A || $A != $A, so it fires for every series returned, a value of 0 included (node_timex_sync_status == 0). No series means no alert. for is kept, and $value in annotations becomes $values.A.Value. The clock-drift group's 15 s interval becomes 20 s, because Grafana evaluates in steps of 10 s.
The import entry adapts the file to FR-ISE-OBS-001:
- the gateways' warning severity becomes CFG-ISE-023's medium;
- a rule without a service label gets ise-gateways or ise-deployment-topology;
- each rule's runbook is in this folder.
- Rule model. A rule may now be a LogQL metric query on Loki ("datasource": "loki"). A rule without a threshold uses the any-series condition above.
- Group his-interfaces in rules.json, 10 rules on what the units write now:
| Rule | Reads | Severity, service |
|---|---|---|
| AuditEventQuarantined | his_audit_alerts_total{kind="quarantine"} (PR-AUD-001-2) |
high, ess-audit |
| AuditCompletenessException | …{kind="completeness"} (PR-AUD-001-3) |
high, ess-audit |
| AuditIntegrityFailure | …{kind="integrity"} (PR-AUD-002-1, a security alert) |
critical, ess-audit |
| AuditForwardingFailing | …{kind=~"forwarding-.*"} (FR-ESS-AUD-003, the same counter) |
high, ess-audit |
| BackboneRetentionRisk | his_backbone_alerts_total{kind="retention-risk"} (PR-EVT-001-1) |
high, the consuming unit from the subscription |
| BackboneUnregisteredConsumer | …{kind="unregistered-consumer"} |
medium, ise-event-backbone |
| PolicyEngineUnavailable | his_authz_decisions_total{outcome="unavailable"}: no version in force, or OPA down |
critical, ess-runtime-decision |
| PolicyDecisionsUnavailable | his_policy_decisions_total{outcome="unavailable"} of every unit's kit, ten or more in 5 minutes per caller |
critical, ess-runtime-decision |
| AuthorizationUnregisteredRequest | his_authz_unregistered_total (MOD-ESS-002 section 10, "Unknown action or resource type") |
medium, the calling source |
| StuckWorkRaised | Loki: ess-coordination's log line stuck <kind> <ref> (<reason>): alert to <roles> (CFG-ESS-015, PR-WFL-002-3) |
high, ess-coordination |
Each counter rule counts the occurrences in a window, and a new series counts in full (the DeadLetterRaised pattern).
- 18 runbooks in runbooks/: one for each new rule, the four gateway rules, and the four runbook names the clock-drift rules use (NodeClockDrift, NodeClockUnsynchronized, TimeSourcesUnreachable, ClockOffsetsNotReported). Their content follows A-01 to A-08 of the readiness runbooks and the specifications.
- Tests (ConfigurationFilesTest, which now reads the rules as grafana-apply --print-rules sends them to Grafana):
- "every alert of the gateway and clock-drift rule files is loaded …": each of the 10 alerts has its group, expression, duration and labels, and the any-series condition;
- "the audit, backbone, authorization and stuck-work alerts have a rule, on the counter or log line their unit actually writes": the rules exist, and the counter names, kinds and log text they read are in the units' sources;
- "every alert rule grafana-apply loads … has a severity of CFG-ISE-023, a summary, a service and a runbook": now covers all 30 rules, imported ones included.
The rule files and those sources are now inputs of the test task (mod-ise-008/build.gradle.kts), so a change to one runs the test again. Before this, Gradle took the test as up to date after a change to rules.json.
- End-to-end step 10 (scripts/lib/ends_when.py; the independent path is now step 11). It checks that all 30 rules are in Grafana and evaluate without error. It then sends, through the collector, what the units would report:
- an open gateway circuit;
- a node 0.7 s off and unsynchronized;
- audit integrity alerts;
- a retention-risk backlog;
- policy engine and decision outages;
- an unregistered request;
- a stuck-queue log line.
It sees each rule fire with the expected labels, and it checks that the clock-drift summary renders the value ("700ms"). It also sees ise-observability page on-call-l2 for AuditIntegrityFailure. send_otlp.py gains metrics and log.
- README, section "Alert rules": the four groups, and how a unit has its rule file imported.
- ADR-HIS-097 and its row in the decision record index (97 records).
No dependency was added to a lockfile. grafana-apply now needs PyYAML (python3-yaml) on the host that runs it, for the imports.
Checks and their result¶
The integration environment ran as HIS_SESSION=RC-1-S28-F13 (his-rc-1-s28-f13), full profile.
| Check | Command | Result |
|---|---|---|
| Test before and after the repair | ./gradlew :mod-ise-008:test --tests '*ConfigurationFilesTest' --rerun with bin/grafana-apply and rules.json of main, then of this branch |
Before: 2 of 11 failed ("GatewayPolicyServiceUnavailable of platform/gateways/observability/alert-rules.yaml is loaded: expecting actual not to be null"; the interface rules missing). After: 11 of 11 passed |
| Owning session's check (RC-1-S10 "Ends when", TEST-ISE-030) | HIS_SESSION=RC-1-S28-F13 platform/observability/scripts/ends-when.sh |
Passed. ./gradlew build: 99 tests, none failed or skipped. End to end: 11 of 11 steps, run 20261129T160517Z (evidence in platform/observability/build/ends-when/, build output, not committed) |
| Step 10 in that run | as above | 30 rules loaded; all 9 induced alerts fired with the labels above, within 145 s; AuditIntegrityFailure paged on-call-l2 |
| Static analysis | platform/delivery-pipeline/bin/static-analysis platform/observability |
No blocking finding |
| Secret scan, code and documentation | platform/delivery-pipeline/bin/secret-scan code\|docs origin/main HEAD |
No secret |
| Documentation links | python3 docs/implementation_plan/tools/check_links.py |
0 broken, 0 duplicate anchors |
| Documentation site | .venv/bin/mkdocs build |
Built |
The slice scenario (e2e/scenarios/RC-1) was not run again. It reads only platform/observability/collector/ from this folder, which is unchanged, and it does not run grafana-apply. The rule files of platform/gateways and platform/deployment-topology, and their promtool tests, are unchanged.
What the gate line now shows¶
- Criterion 6 (ACC-005), monitoring of each interface:
- IF-ISE-001 (gateway ingress) has its four rules loaded and evaluated. GatewayPolicyServiceUnavailable is shown firing on an open circuit.
- IF-ESS-003 (policy decision) has PolicyEngineUnavailable, PolicyDecisionsUnavailable and AuthorizationUnregisteredRequest, each shown firing.
- IF-ESS-008 (audit) has rules for quarantine, completeness, integrity and forwarding. Integrity is shown firing and paged.
- IF-ISE-002 (event publish and subscribe) gains BackboneRetentionRisk and BackboneUnregisteredConsumer.
- IF-ESS-010 (workflow) gains StuckWorkRaised.
The other failures of those interface lines belong to other fixes: #212, #213, #217 and #220 to #225. - Criterion 4: - FR-ISE-OBS-001: "alert rules not loaded or missing" is repaired. The six Appendix B indicators without a producer still show "No data", as RC-1-S10 recorded. - FR-ISE-PLT-004: the clock-drift rules are loaded, and NodeClockDriftCritical and NodeClockUnsynchronized are shown firing. AC-01 still needs production nodes (gate decision).
The next gate session (RC-1-S28-G2) repeats this with scripts/ends-when.sh, step 10.
Requirements and test scenarios of the card¶
| Item | Test |
|---|---|
| FR-ISE-OBS-001 AC-03 (alert rules and runbooks operational), for the gateway, clock-drift, audit, backbone, authorization and stuck-work alerts | ConfigurationFilesTest "every alert rule grafana-apply loads …", "every alert of the gateway and clock-drift rule files is loaded …", "the audit, backbone, authorization and stuck-work alerts have a rule …"; end-to-end step 10 |
| FR-ISE-PLT-004 (clock drift alerted), TEST-ISE-006's alert part | ConfigurationFilesTest "every alert of the gateway and clock-drift rule files is loaded …"; end-to-end step 10 (NodeClockDriftCritical, NodeClockUnsynchronized) |
| ACC-005 monitoring of IF-ISE-001, IF-ESS-003, IF-ESS-008, IF-ISE-002, IF-ESS-010 | End-to-end step 10 |
| PR-AUD-001-2, PR-AUD-001-3, PR-AUD-002-1 (audit alerts) | Rules AuditEventQuarantined, AuditCompletenessException, AuditIntegrityFailure; step 10 (integrity) |
| PR-EVT-001-1 (lag alert near retention) | Rule BackboneRetentionRisk; step 10 |
| PR-WFL-002-3 and CFG-ESS-015 (stuck work) | Rule StuckWorkRaised; step 10 |
| TEST-ISE-030 and the rest of RC-1-S10's card | Unchanged, steps 1 to 9 and 11 of the same run |
Differences from the card, specification or contract¶
- The clock-drift rules' runbook URLs. They pointed at
ise-deployment-topology/…, where no runbook exists. They now point at this folder's runbooks, by the same names (ADR-HIS-097, decision 3). - The gateways'
warningseverity is loaded asmedium, a service desk ticket, because CFG-ISE-023 routes only critical, high, medium and low. This is the same default for an unrouted severity that RC-1-S10 took for Medium and Low alerts (its Q2). - The clock-drift group is evaluated every 20 s, not 15 s, Grafana's nearest step. The rules'
fordurations (0 s to 5 minutes) are unchanged. - StuckWorkRaised resolves 15 minutes after the last stuck alert that
ess-coordinationlogged, and the work may still be stuck.StuckMonitorwrites no counter, so the rule counts log lines. The runbook says so. A gauge of stuck items iness-coordinationwould let the alert last as long as the condition (follow-up). - PolicyDecisionsUnavailable waits for ten refusals in 5 minutes per caller. A cold unit's first decision can exceed the 250 ms budget (RC-1-S10's follow-up). A single refusal would therefore page critical for nothing, while an outage reaches ten within seconds. This threshold is operational, not clinical. The fail-closed behaviour itself is unchanged.
- Severities and services of the new rules follow their requirement's wording: "security alert" for integrity (critical); "lag alert" and backlog before retention (high); "Deny, reported to the calling domain's support queue" (a medium ticket to the caller). None sets
escalation=clinical-safety, which waits for RC-1-S10's Q3.
Questions for a person¶
None stops this session.
- The RC-1 runbooks, section 4, still say that A-01 to A-04 are not loaded and that A-05 to A-08 have no rule. This session may not edit that readiness document. The next readiness or gate session should record the rules now loaded. The runbooks of this folder are each rule's
runbook_url. - RC-1-S10's Q2 (routing defaults where CFG-ISE-023 is silent) now also covers the gateways'
warningmapped tomedium. Q3 (which alerts take clinical safety escalation) is still open on issue #24, and no new rule sets that label.
Follow-ups outside the card¶
- A-09 (
ess-runtime-decisionMOD-ESS-001,platform/secrets-keys). The identity feed silent for 26 hours, an overdue service-identity rotation, certificate expiry and compromise. They need counters or a rule file from their units, imported as above. services/ess-coordination: a gauge of stuck tasks, queues and instances (his.workflow.stuck{kind}), so that StuckWorkRaised lasts while the work is stuck. Then move the rule from Loki to it.- The pipeline (
platform/delivery-pipeline, FN-S05'sbin/changes). A change to an imported rule file, or to a counter or log line thatConfigurationFilesTestchecks, should also runplatform/observability's build. Today it runs only whenplatform/observabilitychanges. - The post-sync job of
grafana-apply(RC-1-S20's Kubernetes follow-up of RC-1-S10): its image needs PyYAML. platform/deployment-topology: its rule file's comment says that observability loads it "as a follow-up of RC-1-S20", which is now done. Itsrunbook_urls can nameise-observability, so that the file says where its runbooks are.platform/gateways: its rules could carryrunbook_urland CFG-ISE-023 severities themselves, so that the import entry needs no mapping.