Break down noise filter counters per noise policy rule for Prometheus observability. Paperclip-Agent: David Santos (urlKey david-santos; id 0b1fcf92-5fe3-4ac0-9f29-df4ab72f5376) Paperclip-Issue: BIT-26791 Paperclip-Run: cea24469-2886-457d-9f6f-09d83aaf9e4a
7.3 KiB
Runbook — debugging ingest (errors.bitreport.pt)
Audience: DevOps, on-call, integrators shipping events into the ingest API.
Prerequisites: curl, optional jq, a valid per-project ingest key from the vault/admin UI, and network path to INGEST_API_BASE.
0. Deploy smoke: BIT-SMOKE error hub ingest live check (wdmi-store / CRM)
Symptoms: Hub incident titled like BIT-SMOKE error hub ingest live check (ex.: BIT-931, ERRSIG:0dfffa22f758) — the application’s post-deploy probe could not complete a successful POST /v1/ingest/events (or treated the response as failure).
Not the same as feed/XML upload failures — those hit catalog APIs; see RUNBOOK_REPORTER_WDMI_FEED_UPLOAD.md.
Checks (in order)
- From the reporter host (same egress as the app), run scripts/examples/ingest_smoke.sh with production
INGEST_API_BASEand the same ingest key as the app (read token from a file; avoid shell history). - URL: must be the ingest service base (no path suffix in env) — clients append
/v1/ingest/eventsthemselves (see clients/php/ErrorReporter.php, HTTP_CONTRACTS.md). - Credentials:
Authorization: Bearer <token>orX-Api-Key; key must be active and unexpired iner_ingest_keys(§2). - HTTP codes:
401/429/5xx/ timeouts — use sections below; CRM cURL timeouts are short (e.g. 4s) — slow proxies can fail smokes before the hub responds. - HTTP 400 from schema validation should be rare; the hub ignores unknown event-level JSON keys and unknown top-level keys on the batch object (only
eventsis required). Required per event:schema_version,occurred_at,level,message. - Intentional throw smokes (
BIT-SMOKE-*) — some reporters POST a deliberate error (e.g.BIT-SMOKE-WDMI-DIRECT-INGEST) to prove the pipe works. The ingest API noise-filters these whenBIT-SMOKE-appears in the eventmessageor clientstacktrace(noise_ruleset_versionfromnoisePolicy.ts; see ingest-hardening-runbook). Expectskipped: true/rule_id: bitreport_smoke_markerand no new incident. The deploy live-check failure titleBIT-SMOKE error hub ingest live check(exact message; uses a space, notBIT-SMOKE-) is filtered the same way from ruleset 1.0.4 onward so ERRCLUSTER loops on that signature stop once production runs the new build. If BIT-309 still reopens after that deploy, treat as stale nodes or a different root cause (BIT-942).
After the root cause is fixed
./scripts/er-cli.sh list-open --project wdmi-store --q "ERRSIG:0dfffa22f758"
./scripts/er-cli.sh resolve <unique_id> --note "ingest smoke restored; verified POST /v1/ingest/events from wdmi-store" --assigned-to "oncall"
1. Quick health
curl -sS "${INGEST_API_BASE}/health"
# expect: {"status":"ok"}
If this fails, treat as process / proxy / TLS — not application auth.
2. HTTP 401 — unauthorized / missing credentials
Symptoms: JSON like { "error": "unauthorized", "message": "Missing ingest credentials …" } or Invalid or inactive ingest key.
Checks
- Header present: send exactly one of:
Authorization: Bearer <plaintext-token>X-Api-Key: <plaintext-token>
- Key state in DB: key must be
active, not revoked, not expired (er_ingest_keys). A common mistake is rotating the key in the UI but leaving old tokens in systemd/env on senders. - Wrong environment: staging token against production base URL (or vice versa).
Sanitized curl (no token in shell history): read token from a file.
curl -sS -X POST "${INGEST_API_BASE}/v1/ingest/events" \
-H "Authorization: Bearer $(cat /run/secrets/er_ingest_token)" \
-H "Content-Type: application/json" \
-d '{"events":[{"schema_version":1,"occurred_at":"2026-04-02T12:00:00.000Z","level":"error","message":"auth probe"}]}'
3. HTTP 429 — rate limits
Two layers:
- Anonymous IP — unauthenticated
POST /v1/ingest/eventsfrom an IP is throttled (INGEST_ANON_IP_MAX/INGEST_ANON_IP_WINDOW_MS). Response includesRetry-After(seconds). - Per API key — after successful auth, limits use
rate_limit_max/rate_limit_window_mson the key row, else service defaults (INGEST_RATE_LIMIT_MAX,INGEST_RATE_LIMIT_WINDOW_MS).
What to do
- Back off using
Retry-After. - Fix misconfigured clients (tight loops, duplicate crons).
- For legitimate bursts, raise per-key limits in DB (or split traffic across keys only if product policy allows).
Metrics: er_ingest_requests_total{status_code="429"} and histogram er_ingest_request_duration_seconds — see OBSERVABILITY_PROMETHEUS.md.
4. Events accepted but “wrong” incident / duplicate noise — fingerprints
Fingerprinting uses message normalization (first line, NFKC, collapsed whitespace) and location from context (file_path / file, line_number / line / lineno, or nested stack_info). See ingest-api fingerprintPolicy.ts and normalize.ts.
Symptoms
- Same logical bug creates multiple incidents because
messagediffers slightly (timestamps, IDs in text). - Unexpected grouping because
context.file_pathis missing or varies per host.
Checks
- Compare raw
messagestrings from the sender; normalize mentally (first line only). - Ensure stable
context.file_path(and line) for stack-less errors. - Optionally send an explicit
fingerprintfield (max 128 chars) for stable dedup when message text is inherently volatile (document this choice per project).
Verify in hub: use admin GET /v1/incidents/:id or public recent-errors with q=<substring> after triage key is set.
5. HTTP 400 — schema_version / occurred_at
- Only
schema_version: 1is accepted. occurred_atmust parse as valid ISO-8601 (see server validation).
# Bad: will 400
curl -sS -w "\n%{http_code}\n" -X POST "${INGEST_API_BASE}/v1/ingest/events" \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"events":[{"schema_version":2,"occurred_at":"not-a-date","level":"e","message":"x"}]}'
6. HTTP 409 — idempotency conflict
When Idempotency-Key is reused with a different JSON body, the API returns 409 idempotency_conflict. Use a new key or retry the exact original payload.
7. Noise rules — events “disappear”
If the response shows results[] entries with "skipped": true, the event matched a noise rule (rule_id, reason). This is expected for filtered traffic. Check noise_filtered_count and compare with er_ingest_events_total{outcome="skipped_noise"} in Prometheus (series also carry rule_id).
8. OpenAPI / Swagger
For interactive inspection (lab only):
GET ${INGEST_API_BASE}/v1/openapi.json- Browser:
${INGEST_API_BASE}/v1/docs/ui
Related
- HTTP_CONTRACTS.md — full request/response shapes.
- RUNBOOK_OPERATIONS.md — hub-side listing and mutations.