Skip to content

feat(infra): show pod restarts and last termination reason - #1389

Merged
Makisuo merged 7 commits into
mainfrom
feat/k8s-pod-restart-reasons
Oct 12, 2026
Merged

Makisuo merged 7 commits into
mainfrom
feat/k8s-pod-restart-reasons

Merge remote-tracking branch 'origin/main' into feat/k8s-pod-restart-…

cd60ce5
Select commit
Loading
Failed to load commit list.
Maple Review Bot / Maple / review succeeded Oct 12, 2026 in 3m 24s

Confidence 8/10 · No issues found

🟢 Confidence 8/10 · likely safe to merge
The pod-restart query is pinned by the recorded SQL baseline and the folding/tone helpers by unit tests; only the collector's resource attribute itself is unverified here.
quality 100/100 · no findings · tests covered · risk medium · 2/2 new units observable

Adds podRestartsQuery, a POST /pod-restarts endpoint and pod-page UI for restarts and last termination reason. Containment is good and the SQL is pinned by the catalog baseline; safe to merge. The open WarehouseInvalidInputError in warehouse-query-atoms.ts is unrelated and untouched by this diff.

  • podRestartsQuery counts window restarts as last minus first, floored at 0, and adds lastTerminatedReason
  • POST /pod-restarts plus a podRestarts registry query and API handler
  • Pod list shows a per-pod restart marker from a second query over the visible pod names
  • Pod page gains a Restarts tile and a per-container restarts table

Production impact

Open errors in the changed files
Issue Service Occurrences File
@maple/web/errors/WarehouseInvalidInputError maple-web 12 apps/web/src/lib/services/atoms/warehouse-query-atoms.ts

After this merges, Maple checks whether they stop.

Production traffic of the changed files (last 7 days)
File Calls/day Busiest operations
apps/api/src/routes/internal/query-engine.http.ts 5 podInfraTimeseries 5/day, 0.0% err
packages/domain/src/http/query-engine.ts 5 podInfraTimeseries 5/day, 0.0% err
What was checked
  • Counter resets: greatest(argMax - argMin, 0) cannot overcount, matching the doc at infra.ts:739
  • Empty podNames skips the filter instead of emitting IN () (infra.ts:783, infra.test.ts:372)
  • ResourceAttributes[...] and argMax per container are pinned verbatim in __sql_baseline__/catalog.sql:1467
Observability coverage: 2 of 2 changes observable
Change Kind Observable Evidence
POST /pod-restarts (query-engine HTTP API) inbound endpoint yes The API registers HttpMiddleware.tracer for all HttpApi routes (apps/api/src/http/api-observability.ts:28-34); siblings like podInfraTimeseries already report ~5 calls/day in Maple.
podRestarts warehouse query outbound query yes Runs through the shared runQuery/runWarehouseQuery path, the same one that reports podInfraTimeseries operations for maple-web.

cd60ce5 · Updated on every push. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.