feat(health-events-analyzer): skip rules that cannot match the incoming event #1913
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 340 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.349
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1913"
general
weight: 0.35
tanishagoyal2
Summary
The health-events-analyzer evaluates 22 rules for each health event, and each rule sends one aggregation query to the datastore. Most rules apply to only one XID or one check. For all other events their query cannot match, but MongoDB does not skip it. It reads the events of the node in the time window of the rule before the gate of the rule on the incoming event removes all of them.
This PR adds an optional
whenfield to each rule. It is a CEL expression over the incoming event, compiled with the sharedcommons/pkg/celeventlibrary, so it uses the same fields as the platform connector overrides and the event exporter filter. The analyzer runs the query of a rule only when itswhenis true. 21 of the 22 default rules now have awhenthat copies the existing gate of the rule on the incoming event.MultipleRemediationshas no such gate, so it still runs for every event.Results
| Workers | Build | Throughput | Compared to
main| Event handling time | Queries for each event | mongod CPU for each event || --- | --- | --- | --- | --- | --- | --- |
| 1 |
main| 10.5 events/s | 1.00× | 94 ms | 22.0 | 93 ms || 1 | this PR, rules without
when| 10.1 events/s | 0.97× (ranges overlap) | 96 ms | 22.0 | 95 ms || 1 | this PR | 22.2 events/s | 2.13× | 43 ms | 5.2 | 47 ms |
| 16 |
main| 40.8 events/s | 1.00× | 126 ms | 22.0 | 127 ms || 16 | this PR | 63.6 events/s | 1.56× | 56 ms | 5.2 | 62 ms |
Type of Change
Component(s) Affected
Testing
Checklist
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
Summary by CodeRabbit
New Features
Health-event rules can use event-level conditions to skip checks when incoming events do not match.
XID and NIC rules now filter events by relevant error codes, agents, check names, and health or fatal status.
Rules without conditions continue to run as before. If a condition cannot be evaluated, the check still runs.
Documentation
Added guidance and an example for configuring event-level conditions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->