Skip to content

feat(relay): log metric and console alert for unreadable cell switch files (evidence code) - #27024

Merged
Jinwoo-H merged 1 commit into
mainfrom
relay-control-flags-unreadable-alert
Oct 10, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
relay-control-flags-unreadable-alert

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​37 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​37
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​71 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​70

Evidence code: this changes cloud/infra/terraform/relay-observability.tf, which is in the relay evidence-code set (relay-evidence-code-provenance.mjs). Merge between rolls, never during a wave: a merge changes the evidence a running monitor was sealed against.

ELI5

Each relay cell reads a small switch file from Cloud Storage every 5 seconds. When that read starts failing, the cell writes one log line and keeps its last switches. Nobody sees that line today. This PR counts it and shows an alert in the monitoring console. Nothing is created until someone runs the targeted apply below.

What Changed

  • Metric orca_relay_control_flags_unreadable (GCE cells only), counting the orca_relay_control_flags_unreadable line from relay-control-flag-channel.ts, labelled by cell_id (taken from the line's object, cells/<cell>.json) and failure (metadata, not-found, http, network, malformed, void).
  • Alert Orca Relay: cell cannot read its switch file, console only (notification_channels = []) until the step-3/5 roll finishes: any line on a cell in a 5-minute window, one series per cell.
  • relay-control-flag-alerts.test.mjs pins the event name, the object/failure fields and the object-name shape on the relay side against the metric, plus the alert's threshold and console-only routing. The two resources are added to the root-partition fixture.

Before: a cell that can't read its switch file, or that rejects a bad file, shows up only in raw logs. After apply: it's charted per cell and failure cause, and opens a console incident.

Why

Threshold: any line (> 0). The reader logs once per change of cause, not once per failed poll, and logs nothing on recovery. A cell stuck failing writes exactly one line, so any bar above zero would miss the case that matters most. For the same reason the incident closing doesn't mean the cell recovered; the alert docs say to compare the object's generation with the cell's last orca_relay_cell_flags_applied line.

Why console only for now: one storage 5xx or a network blip on one cell also writes a line. Staging measured on 2026-10-09 (18:25–19:23Z, three cells): 6 lines, 5 not-found from boots before any object was written and 1 network on staging-gce-c3. That's fine to see in the console but too noisy to page on before every production cell has an object. Paging can be turned on after the roll, once all-off objects exist for every cell. At that point not-found and void mean real operator or IAM faults.

Why a separate metric and not an entry in relay_incident_metrics: that map has no labels. Here the cell and the failure cause are what tell a one-cell blip (ignore it) apart from a bucket or IAM fault (every cell at once) or a bad object (void). Staging confirms that the console.warn JSON on cos_containers is parsed into jsonPayload with these exact fields.

How to apply (targeted only; never a root plan)

Apply after #26835 (bucket and IAM) and after an all-off object exists for every production cell. Before that, every cell logs not-found once per boot. From cloud/infra/terraform, production credentials:

terraform init -backend-config=backend/production.hcl
terraform plan -var-file=environments/production.tfvars \
  -target=google_logging_metric.relay_control_flags_unreadable \
  -target=google_monitoring_alert_policy.relay_control_flags_unreadable \
  -out=relay-control-flags-unreadable.tfplan
terraform show relay-control-flags-unreadable.tfplan
terraform apply relay-control-flags-unreadable.tfplan

Go: 2 to add, 0 to change, 0 to destroy. Anything else means stop.

Linked Issue

N/A (internal relay redesign; step-3/5 pre-roll observability).

Visual Proof

N/A: monitoring declarations only.

Testing

  • terraform fmt -check and terraform validate pass.

  • node --test dev/scripts/relay-control-flag-alerts.test.mjs dev/scripts/relay-db-fault-alerts.test.mjs dev/scripts/terraform-root-partition.test.mjs: 13 pass.

  • Targeted terraform plan -lock=false (no -out, no apply) against production state on 2026-10-09: Plan: 2 to add, 0 to change, 0 to destroy (the metric and the policy).

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Don't merge outside the between-rolls window, and don't apply without the owner's go.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 377fb350-44e4-4864-a086-18e206c3cd75

📥 Commits

Reviewing files that changed from the base of the PR and between 9764dc8 and 17276bf.


📒 Files selected for processing (4)
  • cloud/dev/fixtures/terraform-root-partition/families.json
  • cloud/dev/scripts/relay-control-flag-alerts.test.mjs
  • cloud/infra/terraform/relay-observability.tf
  • cloud/package.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.



📝 Walkthrough

Walkthrough

The change adds a GCE logging metric for unreadable relay control flags, with cell and failure-category labels. A console-only alert triggers when the metric’s per-cell sum exceeds zero. Tests check the event and metric configuration, along with the alert threshold, channels, metric type, and grouping. The relay fixture includes the new metric and alert, and the pretest command runs the new test.


Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 17276

This change only adds a console-only monitoring metric and alert for unreadable relay switch files, plus matching tests. It does not affect relay runtime behavior, and nothing changes in production until the documented targeted apply is run. No merge-blocking risk remains.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check Passed The title clearly identifies the main change: adding a relay logging metric and console alert for unreadable cell switch files.
Description check Passed The description is complete and aligned with the template. It explains the change, rationale, rollout conditions, testing, visual proof, and checklist status. The linked issue is marked N/A, but the d…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.


✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

📝 Generate docstrings
  • Commit to this branch
  • Create a new PR


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Jinwoo-H
Jinwoo-H merged commit 9029e84 into main Oct 10, 2026
26 of 27 checks passed
Jinwoo-H added a commit that referenced this pull request Oct 10, 2026
Rebased onto main as one commit after its parent squash-merged; kept both sides of the add/add list conflicts with #27024.
Jinwoo-H added a commit that referenced this pull request Oct 10, 2026
Rebased onto main as one commit after its parent squash-merged; kept both sides of the add/add list conflicts with #27024.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant