← Back to Pull requests

feat(observability): detect new HCP alerts after upgrades (WIP) #7946

Open
unknown opened this pull request with 484 lines diff across 6 files
View on GitHub
unknown unknown commented on Nov 04, 2026 14:22 UTC
Author

Detect newly firing alerts on recently upgraded HCPs to help identify
possible upgrade regressions. Exposing this signal through monitoring
supports investigation across regions and the fleet. It also lays the
groundwork for rollout automation to count affected clusters as failed
and react to unhealthy upgrades.

Summary

An alert is new when it fires after the upgrade completed, it started at or after
the upgrade started, and its namespace + alert name did not fire in the 24h before the
upgrade started. Detection runs from completion until 24h after.

flowchart LR
    KSM["KSM: HostedCluster<br/>controlPlaneVersion.history"] --> UP["hcp:upgrade_started_timestamp_seconds"]
    AL["ALERTS / ALERTS_FOR_STATE"] --> ID["hcp:alerts<br/>hcp:alerts_for_state"]
    UP --> NEW["HCPUpgradeNewAlert<br/>per HCP + version + new_alertname + cluster"]
    ID --> NEW
    NEW -- "Kusto-only lane" --> K[("Kusto alertEvents")]
    NEW -- "ALERTS" --> REG["HCPUpgradeVersionNewAlerts<br/>count of HCPs per region + version + cluster"]
    REG -- "RP lane, SEV 4" --> ICM["IcM: one incident per<br/>region + version"]

  • HCPUpgradeNewAlert names the triggering alert in new_alertname and only goes to

  • Kusto, so per-HCP detail is kept without flooding IcM.
  • HCPUpgradeVersionNewAlerts is the rollout signal. Its correlation ID

  • HCPUpgradeVersionNewAlerts/<region>/<version> omits the cluster, so IcM merges the
    management clusters of a region. Its description carries a KQL query listing the
    affected HCPs and alerts.

    Design and limits: docs/alerts/hcp-upgrade-new-alert/.

    Evidence

  • Before: the personal-dev E2E (2026-11-04) saw one HCPUpgradeNewAlert per upgrade

  • attempt, with no way to tell which alert triggered it. It then timed out waiting for a
    deleted rule group's alert to resolve (Azure keeps those Fired).
    After: personal-dev E2E, real upgrade 4.21 → 4.22.23, passed (2026-11-17):

      pre-upgrade:  TestAlertPreUpgrade fires, no HCPUpgradeNewAlert for the HCP     ✓
      upgrade:      TestAlertDuringUpgrade fires                                     ✓
      completed:    HCPUpgradeNewAlert{new_alertname=TestAlertDuringUpgrade}         ✓
                    HCPUpgradeNewAlert{new_alertname=TestAlertPostUpgrade}           ✓
                    HCPUpgradeNewAlert{new_alertname=TestAlertPreUpgrade} absent     ✓
                    version=4.22.23, cluster=pers-usw3gobe-mgmt-1                    ✓
      region:       HCPUpgradeVersionNewAlerts{region=westus3, version=4.22.23,
                    cluster=pers-usw3gobe-mgmt-1} fires                              ✓
      

  • promtool covers 23 scenario timelines for HCPUpgradeNewAlert (including two new

  • alerts → two instances, and same-version retries → one instance) and HCP counting
    per region, version and management cluster for HCPUpgradeVersionNewAlerts.

    Not verified: IcM incident creation and merging across management clusters
    (personal-dev has no IcM connection), Kusto rows (personal-dev does not feed the shared
    Kusto cluster), AMA collection of the KSM history metrics, and fleet-scale query cost.

    Merge Danger

    Door: two-way

    New Prometheus rule groups only; reverting removes them. Incremental deployment does not
    delete rule groups, so a revert also needs the two groups removed by hand.

    Blast Radius: RP IcM queue

    Once deployed to int/stg/prod, every completed upgrade that is followed by a new alert
    opens a SEV 4 incident in the RP queue, merged per region and version. A long rollout
    can open more than one incident per version.

    Rollout prerequisites: Event Hub alerting must be enabled so HCPUpgradeNewAlert
    reaches Kusto, and the recording rules should run for 24 hours before the alerts are
    enabled, since hcp:alerts has no history before its first deployment.

    🤖 Generated with Claude Code

    Diff: 484 lines (+363 / -121) across 6 files Reviewer: geoberle Review duration: 38347m
    All Vouch review confidence checks passed
    Residual risk 0.25 = Change Risk (0.47) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.47 · 484 lines diff across 6 files
    0.47
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    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.370
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #7946"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% 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: 47.3% (MEDIUM) · Higher = larger blast radius
    47.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: 46.7% · Lower = rushed or shallow review
    46.7%
    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: 25.2% · Safe to merge
    25.2%
    Repository