Skip to content

Commit dffab5c

Browse files
alerts(prom): orphan_sweep reaped/failed alerts (PASS 3/6, 2026-05-20)
Three new Prometheus alerts tied to the worker repo's PASS 3 enhanced reasons + PASS 6 stuck-build counters: - OrphanSweepNoDBRowReap (CRITICAL, 1h): a k8s namespace had no backing deployments row — the P0-3 atomic-provision symptom. Pages on first occurrence over 1h. - OrphanSweepStuckBuildSpike (WARNING, 15m): >5 stuck-build flips in 15m means the kaniko/GHCR build pipeline is degraded for many customers at once. - OrphanSweepReapFailureRate (WARNING, 30m): the reconciler detected orphans it cannot reap (k8s/DB write failure sustained). The counters land in worker master commit 7d2ff0d; the alerts go live once the deploy lands + scrape picks them up. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 548b031 commit dffab5c

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

k8s/prometheus-rules.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,3 +218,64 @@ spec:
218218
annotations:
219219
summary: "instant-worker saw a pending_propagations kind it doesn't recognise (kind={{ $labels.kind }})"
220220
description: "instant_propagation_unknown_kind_total{kind=\"{{ $labels.kind }}\"} > 0 for >5m. A worker pod is running an older image than the api enqueued (kind={{ $labels.kind }} is not in propagationHandlers). Finish the rollout — `kubectl rollout status deploy/instant-worker -n instant-infra` and confirm pods are on the same image as instant-api. The row will dead-letter after propagationMaxAttempts (10) attempts (~24h cumulative backoff) which will fire PropagationDeadLettered above; this is the early warning."
221+
222+
# instant-worker — orphan_sweep PASS 3/4/5/6 reap alerts (2026-05-20).
223+
# Fires on the worker's instant_orphan_sweep_reaped_total counter
224+
# (introduced in worker repo, see metrics.go::OrphanSweepReapedTotal).
225+
# Each reap is labelled by `reason`; the alerts here key on the
226+
# reasons that imply a distinct upstream bug worth paging on.
227+
- name: instant-worker-orphan-sweep
228+
rules:
229+
- alert: OrphanSweepNoDBRowReap
230+
expr: |
231+
sum(rate(instant_orphan_sweep_reaped_total{reason="no_db_row"}[1h])) > 0
232+
for: 1h
233+
labels:
234+
severity: critical
235+
service: worker
236+
annotations:
237+
summary: "orphan_sweep reaped an instant-deploy-* namespace with NO backing deployments row (P0-3 atomic-provision bug)"
238+
description: |
239+
instant_orphan_sweep_reaped_total{reason="no_db_row"} > 0 for >1h.
240+
A no_db_row event means a k8s namespace was provisioned (instant-deploy-<appID>)
241+
but no deployments row exists for that app_id — the api created the namespace
242+
but the INSERT into deployments never landed. This is the P0-3 atomic-provision
243+
symptom surfacing in prod.
244+
Investigate same hour: search NR Logs for `jobs.orphan_sweep.proposed_reap`
245+
with reason=no_db_row, capture the app_id, then trace back through the api
246+
POST /deploy/new logs for the same time window to find the partial-commit
247+
path that needs the atomic-rollback fix.
248+
249+
- alert: OrphanSweepStuckBuildSpike
250+
expr: |
251+
sum(rate(instant_orphan_sweep_reaped_total{reason="failed_build"}[15m])) * 900 > 5
252+
for: 15m
253+
labels:
254+
severity: warning
255+
service: worker
256+
annotations:
257+
summary: "orphan_sweep PASS 6 flipped >5 stuck builds to failed in 15m (build pipeline degraded)"
258+
description: |
259+
instant_orphan_sweep_reaped_total{reason="failed_build"} > 5 events in 15m.
260+
PASS 6 catches deployments stuck in 'building'/'deploying' for >30min whose
261+
pod is in ImagePullBackOff/ErrImagePull/CrashLoopBackOff. A burst means many
262+
customers' builds are wedged at once — the most likely cause is a ghcr.io
263+
outage, a Kaniko image-push 403 (worker-rbac.yaml GHCR_PUSH_TOKEN scope), or
264+
an upstream registry auth failure. Check ghcr.io status, the deploy.yml CI
265+
push step, and the kaniko build pod logs in instant-deploy-* namespaces.
266+
267+
- alert: OrphanSweepReapFailureRate
268+
expr: |
269+
sum(rate(instant_orphan_sweep_reap_failed_total[15m])) by (reason) > 0
270+
for: 30m
271+
labels:
272+
severity: warning
273+
service: worker
274+
annotations:
275+
summary: "orphan_sweep reap_failed > 0 sustained for 30m (reason={{ $labels.reason }})"
276+
description: |
277+
instant_orphan_sweep_reap_failed_total{reason="{{ $labels.reason }}"} > 0
278+
sustained for >30 minutes. The reconciler detected an orphan but could not
279+
clean it — a k8s API outage or a DB write failure. Single transient events
280+
are fine; a sustained rate means the reap path itself is broken. Check
281+
instant-worker pod logs for `jobs.orphan_sweep.*_delete_failed` lines.

0 commit comments

Comments
 (0)