Skip to content

alerting: bound infra scan queries so they fit the statement timeout - #137

Merged
Thangnguyenvn98 merged 1 commit into
mainfrom
agent/infra-scan-query-bounds
Sep 3, 2026
Merged

Thangnguyenvn98 merged 1 commit into
mainfrom
agent/infra-scan-query-bounds

Conversation

@Thangnguyenvn98

Copy link
Copy Markdown
Collaborator

Problem

The infra scan (restored today) has never completed a run: after fixing the Buildkite read_agents scope, every scan fails with canceling statement due to statement timeout.

Measured on the worker against production data:

query result
gpu_snapshots size 8,532,264 rows
statement_timeout 2min
latest_reports 12.3s (passes, but unbounded)
gpu_temperatures times out at 120s

Root cause: unbounded DISTINCT ON over all of gpu_snapshots history.

Fix

  • gpu_temperatures: only readings from the last 2 days count. This is also semantically right — _plan_gpu_temperature has no staleness check, so a dead host's last hot reading would otherwise sustain a temperature breach forever; a silent host is the unreporting alert's job.
  • latest_reports (gpu CTE): bounded at 14 days = 2× the 7-day RETIREMENT_AGE, so retirement aging still sees every last-report it needs while skipping the rest of history.

Tests

pytest alerting 199 passed, ruff clean, mypy shows only the pre-existing local-venv boto3 stub errors (identical without this change). The fake-connection infra tests match on the queries' SELECT DISTINCT ON prefix, which is unchanged.

Deploy

Worker picks this up on the next install.sh from main; after that the 5-minute infra scan should go green and we can flip control/infra.mode to live.

Signed-off-by: Thang Nguyen thang.nguyen@inferact.ai

The infra scan never completed a single run at production data scale:
gpu_temperatures and the gpu side of latest_reports run unbounded
DISTINCT ON over gpu_snapshots (8.5M rows), and gpu_temperatures
exceeds the 2-minute statement timeout every scan.

- gpu_temperatures: only readings from the last 2 days count. Stale
  readings should not sustain a temperature breach anyway — a host that
  stops reporting is the unreporting alert's job.
- latest_reports (gpu side): bound at 14 days, twice the 7-day
  retirement age, so retirement aging still sees the last reports it
  needs while skipping the rest of history.

Signed-off-by: Thang Nguyen <thang.nguyen@inferact.ai>
@vercel

vercel Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
vllm-ci-dashboard Ready Ready Preview Sep 3, 2026 7:53pm UTC

Request Review

@Thangnguyenvn98
Thangnguyenvn98 merged commit 39b30a9 into main Sep 3, 2026
3 of 4 checks passed

This branch was successfully deployed

1 active deployment
Preview — a5112ba5 Deployed Sep 3, 2026 by vercel[bot]
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