CI & Synthetic Monitoring
What it is
Section titled “What it is”CI (continuous integration) runs your test suite automatically on every change and gates the merge on the result. Synthetic monitoring runs the same kinds of checks against production on a schedule, from outside the system, so you learn about a broken login flow before your users do.
Push / PR │ ▼ [ CI pipeline ] ← unit → integration → E2E on every change │ green ▼ [ Deploy ] │ ▼ [ Synthetic monitor ] ← scheduled E2E + API checks in production │ failure ▼ Alert (pager / Slack)CI and synthetic monitoring share tests, assertions and reporting; they differ in where and when they run. Keep them consistent so a test you trust on PRs means the same thing in production.
When to use it / when to avoid it
Section titled “When to use it / when to avoid it”Use it for
- Gating merges on automated tests (CI)
- Catching production-only failures: DNS, TLS, third-party outages, region issues
- Watching critical user journeys (login, checkout) around the clock
- Trending performance budgets and availability over time
Avoid or reduce it when
- Synthetic checks duplicate every unit test — monitor the critical paths, not all code
- Flaky tests gate the pipeline; quarantine and fix them instead of rerunning blindly
- Monitoring runs from a single region only, giving a false picture of global health
Frameworks & tools
Section titled “Frameworks & tools”| Tool | Ecosystem | Notes |
|---|---|---|
| GitHub Actions | CI | YAML workflows; huge marketplace of actions |
| GitLab CI | CI | .gitlab-ci.yml; stages, artifacts, environments |
| Jenkins | CI | Self-hosted, plugin-driven, very flexible |
| Playwright | CI/E2E | Runs in CI; trace viewer and reporters |
| Checkly | Synthetic | Playwright-based checks + API monitors, alerting |
| Grafana Synthetic Monitoring | Synthetic | Probe-based checks, dashboards and alerts in Grafana |
Quick setup
Section titled “Quick setup”on: [push, pull_request]jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: { node-version: 20 } - run: npm ci - run: npm testtest: image: node:20 script: - npm ci - npm test// Jenkinsfilepipeline { agent any stages { stage('Test') { steps { sh 'npm ci && npm test' } } }}npm install -D checklynpx checkly loginnpx checkly test # run checks locally oncenpx checkly deploy # push checks to the cloud# Install the synthetic-monitoring-agent and point it at your Grafanadocker run -d --name sm-agent \ -e SM_API_HOSTNAME=your-instance.grafana.net \ grafana/synthetic-monitoring-agentExample
Section titled “Example”name: cion: push: { branches: [main] } pull_request:
jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: { node-version: 20, cache: npm } - run: npm ci - run: npx playwright install --with-deps chromium - run: npm run test:unit - run: npm run test:e2e - uses: actions/upload-artifact@v4 if: always() with: name: playwright-report path: playwright-report/import { defineConfig, devices } from '@playwright/test';
export default defineConfig({ retries: process.env.CI ? 2 : 0, workers: process.env.CI ? 2 : undefined, reporter: [['html'], ['list']], use: { trace: 'on-first-retry' }, projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }],});import { test, expect } from '@playwright/test';
test('login flow', async ({ page }) => { await page.goto('https://app.example.com'); await page.getByLabel('Email').fill('monitor@example.com'); await expect(page.getByRole('heading', { name: 'Dashboard' })) .toBeVisible();});Anti-patterns & best practices
Section titled “Anti-patterns & best practices”- Fail the build on red. A pipeline people ignore is worse than no pipeline.
- Cache dependencies and split slow suites into parallel jobs to keep CI fast.
- Quarantine flaky tests with an owner and a deadline; never auto-rerun forever.
- Upload reports and traces as artefacts so a failure is reproducible after the run.
- Monitor critical journeys, not everything. Synthetic checks are a smoke alarm, not a substitute for a full test suite.
- Alert on symptoms (checkout failing) rather than raw internals, and set thresholds to avoid alert fatigue.
Self-assessment quiz
Section titled “Self-assessment quiz”Self-assessment quiz
Pick one answer per question, then press Check answers.