Files
errors.bitreport.pt/docs/RUNBOOK_OPERATIONS.md
T
Peter Spark 550a5cdd3f docs: runbook for CRM View @errormonitoring/dashboard (BIT-873)
Add RUNBOOK_REPORTER_CRM_ERRORMONITORING_VIEW.md for ERRSIG:f51049a03fba
(View.php missing module view on crm.pmx.bet). Cross-link from RUNBOOK_TRIAGE
and RUNBOOK_OPERATIONS.

Paperclip-Issue: BIT-873
Paperclip-Run: 4e3500e4-fdbf-4386-b3f1-bd001356b769
Paperclip-Agent: david-santos
Made-with: Cursor
2026-04-05 01:46:05 +00:00

3.5 KiB

Runbook — five common operational scenarios (hub)

Audience: Operators without the admin UI.
Tools: scripts/er-cli.sh (recommended) or curl + jq as in HTTP_CONTRACTS.md.

export ERROR_RESOLVE_API_KEY="<from vault>"
export ER_API_BASE="https://errors.bitreport.pt"   # or internal Fastify URL

Scenario 1 — List open incidents for a project

Goal: See everything open/investigating for slug crm.

./scripts/er-cli.sh list-open --project crm --limit 200

curl equivalent

curl -sS -G "${ER_API_BASE}/api/error-monitoring/recent-errors" \
  --data-urlencode "api_key=${ERROR_RESOLVE_API_KEY}" \
  --data-urlencode "status=open,investigating" \
  --data-urlencode "project_slug=crm" \
  --data-urlencode "limit=200" | jq '.data[] | {unique_id, project_slug, severity, message}'

Scenario 2 — Search by title/message/fingerprint substring

Goal: Find rows matching a failing dependency or error text.

./scripts/er-cli.sh list-open --q "Redis connection" --limit 500

Use export for offline analysis:

./scripts/er-cli.sh export --state open --format json | jq '.[] | select(.message | test("Redis"; "i"))'

Scenario 3 — Resolve one incident (by occurrence or incident id)

Goal: Close after deploy; unique_id is the numeric id from list-open / recent-errors.

./scripts/er-cli.sh resolve 123456789 --note "fixed in release 1.2.3" --assigned-to "oncall"

curl

curl -sS -X POST "${ER_API_BASE}/api/error-monitoring/resolve" \
  -H "Content-Type: application/json" \
  -H "X-Error-Resolve-Key: ${ERROR_RESOLVE_API_KEY}" \
  -d '{"unique_id":"123456789","resolution_notes":"fixed in release 1.2.3"}' | jq .

Scenario 4 — Bulk resolve by message pattern

Goal: Clear a class of errors after a shared root cause.

  1. Dry run (lists matches, no mutation):
./scripts/er-cli.sh resolve-by-pattern "Timeout contacting upstream" --dry-run
  1. Execute
./scripts/er-cli.sh resolve-by-pattern "Timeout contacting upstream" \
  --note "upstream restored 2026-04-02"

This calls POST /api/error-monitoring/bulk-resolve with message_pattern.


Scenario 5 — Purge resolved incidents (destructive)

Goal: reclaim DB space after retention policy. Always dry-run first.

./scripts/er-cli.sh purge --dry-run
# review would_delete
./scripts/er-cli.sh purge

Current implementation deletes all resolved incidents in one call (no age filter). Plan maintenance accordingly; see HTTP_CONTRACTS.md § purge-resolved.


Extras (same session)

Need Command / endpoint
Snapshot CSV ./scripts/er-cli.sh export --state open --format csv > open.csv
Hub stats + Prometheus gauge refresh GET /api/error-monitoring/stats?api_key=…
Admin drill-down Cookie login + GET /v1/incidents/:id (HTTP_CONTRACTS.md)