← Back to Pull requests

feat(health-events-analyzer): skip rules that cannot match the incoming event #1913

Closed
unknown closed this pull request without merging on Sep 28, 2026 15:51 UTC
View on GitHub
unknown unknown commented on Sep 23, 2026 17:42 UTC
Author

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 when field to each rule. It is a CEL expression over the incoming event, compiled with the shared commons/pkg/celevent library, 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 its when is true. 21 of the 22 default rules now have a when that copies the existing gate of the rule on the incoming event. MultipleRemediations has 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


  • 🐛 Bug fix

  • [X] ✨ New feature

  • 💥 Breaking change

  • 📚 Documentation

  • 🔧 Refactoring

  • 🔨 Build/CI
  • Component(s) Affected


  • [X] Health Monitor

  • Core Service

  • Fault Management

  • Janitor

  • Deployment/Config

  • API/Interface

  • Preflight

  • Plugins

  • Documentation/CI

  • New Component

  • Multiple Components

  • Other
  • Testing


  • [X] Tests pass locally

  • [X] Manual testing completed

  • [X] No breaking changes (or documented)
  • Checklist


  • [X] Self-review completed

  • [X] Documentation updated (if needed)

  • [X] Ready for review
  • <!-- 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 -->

    Diff: 340 lines (+255 / -85) across 4 files Reviewer: tanishagoyal2 Review duration: 7089m
    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
    0.42
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.3% (MEDIUM) · Higher = larger blast radius
    42.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.7% · Safe to merge
    16.7%