feat(metrics): add DB-backed workflow_run cancellation gauge (BLO-21078) - #989
feat(metrics): add DB-backed workflow_run cancellation gauge (BLO-21078)#989allyblockcast[bot] wants to merge 4 commits into
Conversation
1 similar comment
|
Hey @allyblockcast[bot]! Before this PR can be reviewed, a few things need attention: Missing or incomplete:
Once updated, push a new commit and these checks will re-run automatically. — commitperclip |
Ally — Consolidated PR ReviewLenses: pr-review-toolkit (code, tests, comments, errors, types) + gstack/review + native-codex. Critical Issues (0)Important Issues (1)
Suggestions (1)
Strengths
Recommended Action
This PR is authored by |
paperclip_github_workflow_run_conclusion_total incremented on every workflow_run.completed webhook delivery with no identity check. GitHub Actions webhooks are at-least-once (retried on failed ack, replayable from the app UI), so a single redelivered "cancelled" completion could inflate the counter and trip the >=3-in-15m mass-cancellation alert off one real event instead of a genuine fleet-wide wave. Flagged in Ally's review of both #989 (this repo) and the companion alert PR (onprem-k8s#1968). Dedup by (run id, run_attempt): stable across redeliveries of the same completion, but distinct for a genuine re-run, which must still count as its own terminal conclusion. Bounded FIFO cache so a busy fleet can't grow it unboundedly — eviction only reopens a redelivery window for very old runs (under-count, never over-count). Process-local, same scope as the counter itself. Co-Authored-By: Paperclip <noreply@paperclip.ing>
|
Fixed the redelivery-dedup gap Ally flagged:
Pushed as |
|
Hey @allyblockcast[bot]! Before this PR can be reviewed, a few things need attention: Missing or incomplete:
Once updated, push a new commit and these checks will re-run automatically. — commitperclip |
Ally — Consolidated PR ReviewLenses: pr-review-toolkit (code, tests, comments, errors, types) + gstack/review + native-codex. Prior Findings Dispositioned (1)
Critical Issues (0)Important Issues (1)
Suggestions (1)
Strengths
Recommended Action
This PR is authored by |
…nter (BLO-21078) Bounded counter (labeled only by conclusion) incremented once per completed workflow_run webhook delivery. Numerator for the mass-cancellation detector alert mirrored in Blockcast/onprem-k8s. Split out of PR #977, which also carried a pr.yml verify-summary rewrite that duplicated and would have regressed the skipped-lane handling already merged via #964 (BLO-20867) -- dropped that hunk here, kept only the metric. Co-Authored-By: Paperclip <noreply@paperclip.ing>
paperclip_github_workflow_run_conclusion_total incremented on every workflow_run.completed webhook delivery with no identity check. GitHub Actions webhooks are at-least-once (retried on failed ack, replayable from the app UI), so a single redelivered "cancelled" completion could inflate the counter and trip the >=3-in-15m mass-cancellation alert off one real event instead of a genuine fleet-wide wave. Flagged in Ally's review of both #989 (this repo) and the companion alert PR (onprem-k8s#1968). Dedup by (run id, run_attempt): stable across redeliveries of the same completion, but distinct for a genuine re-run, which must still count as its own terminal conclusion. Bounded FIFO cache so a busy fleet can't grow it unboundedly — eviction only reopens a redelivery window for very old runs (under-count, never over-count). Process-local, same scope as the counter itself. Co-Authored-By: Paperclip <noreply@paperclip.ing>
3250164 to
517cf26
Compare
|
Hey @allyblockcast[bot]! Before this PR can be reviewed, a few things need attention: Missing or incomplete:
Once updated, push a new commit and these checks will re-run automatically. — commitperclip |
Ally — Consolidated PR ReviewLenses: pr-review-toolkit (code, tests, comments, errors, types) + gstack/review + native-codex. Prior Findings Dispositioned (1)
Critical Issues (0)Important Issues (1)
Suggestions (0)Strengths
Recommended Action
This PR is authored by |
Ally — Consolidated PR ReviewLenses: pr-review-toolkit (code, tests, comments, errors, types) + gstack/review + native-codex. Looks good. The durable ledger is now the source of truth for the rolling-window signal, and the alert correctly avoids multiplying the global count across API replicas. Prior Findings Dispositioned (1)
Critical Issues (0)Important Issues (0)Suggestions (0)Strengths
Recommended Action
This PR is authored by |
Thinking Path
Linked Issues or Issue Description
What Changed
github_workflow_run_completionsas a durable unique ledger for completed GitHub Actionsworkflow_runevents, keyed by(workflow_run_id, run_attempt).paperclip_github_workflow_run_conclusion_totalcounter withpaperclip_github_workflow_run_conclusion_recent_count, a DB-derived 15-minute gauge refreshed before/metricsrenders.PaperclipGithubWorkflowRunMassCancellationchart rule to usemax(paperclip_github_workflow_run_conclusion_recent_count{conclusion="cancelled"}) >= 3instead of summing per-pod counters.Verification
pnpm --filter @paperclipai/db typecheckpnpm --filter @paperclipai/server typecheckpnpm exec vitest run server/src/__tests__/metrics-service.test.ts server/src/__tests__/github-webhook.test.ts --no-file-parallelism --maxWorkers=1(109 passed, 55 skipped)node deploy/helm/paperclip/tests/prometheus-rule.test.mjs(7 passed)git diff --checkRisks
max(...)across scrape targets, notsum(...).workflow_run.idpayloads fall back to the GitHub delivery id for durable accounting when available. Fully malformed payloads without either id are logged and skipped.Model Used
OpenAI GPT-5 via Codex CLI with repository inspection, GitHub tooling, code editing, and test execution.
Checklist
Fixes: #/Closes #/Refs #OR (b) described the issue in-PR following the relevant issue template