Pipeline Observability: Why CI Failures Don't Trigger Alerts (And Should)
Production monitoring catches user-facing issues. CI failures stay invisible until someone notices the merge queue is stuck. The metrics and alerts that make pipelines observable.
Key takeaways
- CI failures don't alert because nothing exports pipeline state to your monitoring stack.
- Subscribe a small receiver to GitHub's workflow_job webhook, turn each completed job into Prometheus counters and histograms, then alert on patterns such as success rate under 85 percent, p95 queue time over five minutes, or zero online runners.
On this page
CI failures don't page anyone because your CI system's state never reaches your monitoring stack. Fix it by subscribing a small receiver to GitHub's workflow_job webhook, exporting job outcomes, queue time and duration as Prometheus metrics, and alerting on patterns (success rate, queue time, runner count), never on single failed runs.
Verified against
Prometheus 3.15.1 (released 2026-10-21), against the GitHub Docs pages for webhook events, webhook signature validation, the workflow jobs and self-hosted runners REST APIs, and the Prometheus pushing and Alertmanager docs. Checked October 2026.
The classic way to learn this is a pipeline that breaks Friday evening and gets noticed Monday, when someone asks why their PR has been "waiting on checks" all weekend. We treat CI as production infrastructure now. This is what we monitor and how.
What goes wrong with CI
The failure modes that actually happen:
- Runners stop coming online. Self-hosted runners crash, replacements fail to register, and jobs queue indefinitely.
- Credentials expire silently. The token that pushes images expires and every build fails with the same error.
- Upstream dependencies break. A package registry has an outage and
npm installfails across every repo for an hour. - Disk fills. Self-hosted runners accumulate Docker layers until builds die with unhelpful errors.
- One test goes flaky. Most builds pass, a few fail, and merges slow down behind retries.
- Cache poisoning. A bad cached layer keeps getting reused; clean rebuilds pass and nobody suspects the cache.
Each has a metric signature. Without metrics, people see only the symptom: PRs not merging.
The metrics that earn their place
Treat the pipeline as a service and instrument it like one:
- Job outcomes by workflow (
success,failure,cancelled,timed_out), from which you derive success rate over 1h, 6h and 24h. - Queue time p95:
started_atminuscreated_aton the job. Healthy is seconds; minutes means the runner pool is undersized or unhealthy. - Job duration p95:
completed_atminusstarted_at. A jump means the workflow changed or the runners got slower. - Online runner count for self-hosted pools, with a floor.
- Per-step failures, which surface flaky tests before anyone has to hunt for the pattern.
- Total daily job minutes, the cheapest leading indicator of a retry loop or a runaway workflow.
How we collect: a webhook receiver
GitHub sends a workflow_job webhook with action queued, in_progress, waiting or completed. The completed payload's workflow_job object carries conclusion, created_at, started_at, completed_at, labels, runner_name, workflow_name and steps, which is everything above. Point an org-level webhook at a receiver like this one, which uses the Python prometheus_client library and validates the X-Hub-Signature-256 HMAC the way GitHub's docs show:
import hashlib, hmac, json, os
from datetime import datetime
from http.server import BaseHTTPRequestHandler, HTTPServer
from prometheus_client import Counter, Histogram, start_http_server
SECRET = os.environ["GITHUB_WEBHOOK_SECRET"].encode()
JOBS = Counter("ci_jobs_total", "Completed CI jobs", ["repo", "workflow", "conclusion"])
STEP_FAIL = Counter("ci_step_failures_total", "Failed steps", ["repo", "workflow", "step"])
QUEUE = Histogram("ci_job_queue_seconds", "Queue time", ["repo"],
buckets=(5, 15, 30, 60, 120, 300, 600, 1800))
DURATION = Histogram("ci_job_duration_seconds", "Run time", ["repo", "workflow"],
buckets=(60, 180, 300, 600, 1200, 1800, 3600))
def ts(s):
return datetime.fromisoformat(s.replace("Z", "+00:00"))
class Hook(BaseHTTPRequestHandler):
def do_POST(self):
body = self.rfile.read(int(self.headers["Content-Length"]))
sig = "sha256=" + hmac.new(SECRET, body, hashlib.sha256).hexdigest()
if not hmac.compare_digest(sig, self.headers.get("X-Hub-Signature-256", "")):
self.send_response(401); self.end_headers(); return
event = json.loads(body)
job = event.get("workflow_job")
if self.headers.get("X-GitHub-Event") == "workflow_job" and event.get("action") == "completed" and job:
repo, wf = event["repository"]["full_name"], job["workflow_name"]
JOBS.labels(repo, wf, job["conclusion"] or "none").inc()
if job.get("started_at"):
QUEUE.labels(repo).observe((ts(job["started_at"]) - ts(job["created_at"])).total_seconds())
DURATION.labels(repo, wf).observe((ts(job["completed_at"]) - ts(job["started_at"])).total_seconds())
for step in job.get("steps", []):
if step.get("conclusion") == "failure":
STEP_FAIL.labels(repo, wf, step["name"]).inc()
self.send_response(204); self.end_headers()
if __name__ == "__main__":
start_http_server(9105) # Prometheus scrapes :9105/metrics
HTTPServer(("", 8080), Hook).serve_forever() # GitHub posts to :8080
Run it and check it's alive:
GITHUB_WEBHOOK_SECRET=change-me python3 ci_exporter.py &
curl -s localhost:9105/metrics | grep ci_jobs_total
# HELP ci_jobs_total Completed CI jobs
# TYPE ci_jobs_total counter
We expose /metrics for Prometheus to scrape rather than using the Pushgateway. Prometheus's own docs say the Pushgateway's valid use case is service-level batch jobs, and warn that it "never forgets series pushed to it" and loses the up health signal. A scraped exporter keeps both. The tradeoff: counters reset when the receiver restarts, which rate() and increase() already tolerate.
For online runner count, poll GET /orgs/{org}/actions/runners every minute and export a gauge of runners with status online. Other CI systems expose equivalent webhooks.
Alerts that fire
Pattern alerts, never single-run alerts:
groups:
- name: ci
rules:
- alert: CISuccessRateLow
expr: |
sum by (repo, workflow) (increase(ci_jobs_total{conclusion="success"}[1h]))
/ sum by (repo, workflow) (increase(ci_jobs_total{conclusion=~"success|failure|timed_out"}[1h])) < 0.85
and sum by (repo, workflow) (increase(ci_jobs_total[1h])) > 10
for: 10m
labels: {severity: page}
- alert: CIQueueTimeHigh
expr: histogram_quantile(0.95, sum by (le, repo) (rate(ci_job_queue_seconds_bucket[15m]))) > 300
for: 15m
labels: {severity: page}
- alert: CIRunnersBelowFloor
expr: ci_runners_online < 4
for: 10m
labels: {severity: page}
- alert: CIMinutesSpike
expr: sum(increase(ci_job_duration_seconds_sum[1d])) > 2 * sum(increase(ci_job_duration_seconds_sum[7d])) / 7
labels: {severity: ticket}
The > 10 guard stops a workflow with three runs an hour from paging on one failure. Route page to on-call during business hours and to a ticket overnight in Alertmanager; its grouping keeps a registry outage that breaks 40 workflows down to one notification. Also add a "zero successful runs of the main-branch workflow in two weekday hours" rule, which catches a fully broken build that produces no completions at all.
Error strings and what they usually mean
| What you see | Usual cause | First move |
|---|---|---|
Waiting for a runner to pick up this job... for minutes | No online runner matches the job's labels | Check runner count and the runs-on labels |
No space left on device | Runner disk full of Docker layers | docker system prune -af on the host; add cleanup to provisioning |
toomanyrequests: You have reached your pull rate limit | Registry rate limiting | Authenticate pulls or use a mirror; don't hammer retries |
401 Unauthorized on push or deploy step | Expired or rotated secret | Check secret expiry dates and rotate |
| Same step failing intermittently on unchanged code | Flaky test | Quarantine it; ci_step_failures_total names the step |
The runbook
One runbook per alert. The most-used one, for success rate:
- Find the failing workflow on the dashboard.
- Open the most recent failed run and read the error.
- Classify it: real test failure (ping the owning team), credential (check secret expiry, rotate), dependency (check the upstream status page and wait instead of thrashing retries), or infrastructure (runner disk, network).
- If unclear, rerun one failed job with debug logging.
What we tried and dropped
Alerting on every failed run. Real test failures are CI doing its job. Paging on them trains the team to ignore the pager.
A formal SLO on CI. We got bogged down defining "available." The pattern alerts gave us the protection without the ceremony. If you want the stricter version, burn-rate alerting is the discipline to borrow.
Where this breaks
On GitHub-hosted runners only, the runner-count alert is meaningless and queue time mostly reflects GitHub's capacity and your concurrency limits, so drop the first and keep the second as a ticket. A webhook delivery that hits a down receiver is not something to count on being retried, so a receiver outage can silently drop data; check the delivery log or reconcile with the REST API if exact counts matter. And very small repos never clear the minimum-volume guard, which is fine: nobody needs paging for a repo that builds twice a day.
Questions people ask
How do I get alerts when a GitHub Actions workflow fails?
For a single workflow, add a final step with if: failure() that posts to Slack. For real alerting, subscribe a receiver to the workflow_job webhook, export completed-job conclusions as Prometheus counters, and alert when the success rate over an hour drops below a threshold such as 85 percent. Pattern alerts catch broken pipelines without paging on every legitimate test failure.
What CI/CD metrics should I monitor?
Six cover most incidents: job success rate per workflow, p95 queue time, p95 job duration, online self-hosted runner count, per-step failure counts, and total daily job minutes. Queue time catches runner capacity problems, per-step failures surface flaky tests, and daily minutes flags retry loops before the bill does. All six come from the workflow_job webhook plus the runners API.
Should I use the Prometheus Pushgateway for CI metrics?
Usually not. Prometheus's documentation limits the Pushgateway's valid use to service-level batch jobs and warns it keeps pushed series forever and loses the up health metric. A long-running webhook receiver that exposes /metrics for scraping is simpler and keeps health monitoring. Use the Pushgateway only for a one-shot job that cannot be scraped.
The call we'd make
Treat the build pipeline as production. A webhook receiver of under a hundred lines, four alert rules and one dashboard turn "when did the pipeline break?" into a page within minutes of the break. Alert on patterns, write one runbook per alert, and watch the minutes trend. If you're still building the pipeline itself, start with your first GitHub Actions pipeline and speeding up CI, and keep the pager humane with on-call rotations and runbooks.
Sources
Cite this article
Kiril Urbonas (2026). Pipeline Observability: Why CI Failures Don't Trigger Alerts (And Should). DevOpsNess. Updated 2026-10-31. https://www.devopsness.com/blog/pipeline-observability-ci-failures-alerts
[Pipeline Observability: Why CI Failures Don't Trigger Alerts (And Should)](https://www.devopsness.com/blog/pipeline-observability-ci-failures-alerts) (Kiril Urbonas, DevOpsNess, updated 2026-10-31)
More from DevOps
Explore more articles in this category
GitHub Actions Matrix Builds That Don't Waste Minutes
A practical guide to matrix builds in GitHub Actions that tests across versions and platforms without burning your monthly minutes.
.dockerignore Best Practices That Actually Matter
A bloated build context slows every build, wrecks your cache, and quietly leaks secrets into images. Here's how to keep it lean.
Fix Docker "exec format error" (Architecture Mismatch)
The container starts, then dies with "exec format error." Here's why the CPU architecture is wrong, how to confirm it, and how to build images that just run.
You might have missed
Evergreen posts worth revisiting.