Files
errors.bitreport.pt/docs/RUNBOOK_OPERATIONS.md
T
Peter Spark 4a3ecc1088 docs: add runbook for Google OAuth TLS failures on PHP reporters
New RUNBOOK_REPORTER_GOOGLE_TLS.md documents triage for cURL error 35 /
SSL_connect reset to oauth2.googleapis.com from Guzzle/Google client stacks
(e.g. wdmi-store Importer). Cross-linked from RUNBOOK_TRIAGE and
RUNBOOK_OPERATIONS.

Paperclip-Agent: 0b1fcf92-5fe3-4ac0-9f29-df4ab72f5376
Paperclip-Issue: BIT-866
Paperclip-Run: acd11e33-7d18-468f-a2c1-2e15647f2fd4
Made-with: Cursor
2026-04-05 01:40:51 +00:00

118 lines
3.3 KiB
Markdown

# Runbook — five common operational scenarios (hub)
**Audience:** Operators without the admin UI.
**Tools:** [scripts/er-cli.sh](../scripts/er-cli.sh) (recommended) or `curl` + `jq` as in [HTTP_CONTRACTS.md](HTTP_CONTRACTS.md).
```bash
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`.
```bash
./scripts/er-cli.sh list-open --project crm --limit 200
```
**curl equivalent**
```bash
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.
```bash
./scripts/er-cli.sh list-open --q "Redis connection" --limit 500
```
Use **`export`** for offline analysis:
```bash
./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`.
```bash
./scripts/er-cli.sh resolve 123456789 --note "fixed in release 1.2.3" --assigned-to "oncall"
```
**curl**
```bash
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):
```bash
./scripts/er-cli.sh resolve-by-pattern "Timeout contacting upstream" --dry-run
```
2. **Execute**
```bash
./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.**
```bash
./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](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](HTTP_CONTRACTS.md)) |
---
## Related
- [RUNBOOK_TRIAGE.md](RUNBOOK_TRIAGE.md) — broader triage and deploy notes.
- [RUNBOOK_INGEST_DEBUG.md](RUNBOOK_INGEST_DEBUG.md) — sender-side ingest issues.
- [RUNBOOK_REPORTER_GOOGLE_TLS.md](RUNBOOK_REPORTER_GOOGLE_TLS.md) — TLS / Google OAuth failures on **reporting** apps (PHP, Guzzle), not hub ingest.