chore(lab): sync working tree from Paperclip execution host (10.10.50.17)
CI / Test ingest-api (push) Has been cancelled
CI / Test api (push) Has been cancelled
CI / Lint and typecheck admin-ui (push) Has been cancelled
CI / Validate Docker build (push) Has been cancelled

This commit is contained in:
David Santos committed 2026-04-16 10:24:33 +00:00
1 parent 2d93c4a3fc
commit 7daa867374
8 files changed
+189 -8

No files matched your search

+20
View File
@@ -89,6 +89,26 @@ groups:
summary: "Error monitoring API is unreachable"
```
### Collector → ingest resilience ([BIT-2600](/BIT/issues/BIT-2600))
The **collector-worker** pushes batched events to **ingest-api** (`POST /v1/ingest/events`). Large or bursty payloads (for example many “feed upload” failure reports from upstream jobs) benefit from tunable timeouts and client-side retries before the worker applies source-level backoff.
| Variable | Default (code / compose) | Role |
|----------|--------------------------|------|
| `INGEST_PUSH_TIMEOUT_MS` | `60000` | Per-attempt HTTP timeout (abort + retry if transient). |
| `INGEST_PUSH_MAX_RETRIES` | `3` | Extra attempts after the first failure (cap 12 in code). |
| `INGEST_PUSH_RETRY_BASE_MS` | `500` | Base delay; delay before retry *k* is `base * 2^k` + jitter. |
| `INGEST_PUSH_RETRY_MAX_JITTER_MS` | `250` | Random jitter upper bound (inclusive) added to each delay. |
Transient failures retried: HTTP `408`, `425`, `429`, `5xx`, timeouts, and common Node `fetch` network errors. Non-transient `4xx` (except those listed) are not retried.
**Structured logs:** on failure, `collector_ingest_failed` includes `ingest_push_attempts` (total HTTP attempts in that cycle) and `consecutive_failures` (scheduler backoff counter). On success after retries, `collector_cycle_complete` still includes `ingest_push_attempts` when it was greater than one.
**Alerting ideas**
- **Ingest SLO:** keep using `IngestErrorRateHigh` on `er_ingest_requests_total` — sustained 5xx/429 from the collector’s perspective show up here.
- **Log / trace backend:** alert when `msg="collector_ingest_failed"` and `consecutive_failures` stays above a threshold (for example ≥ 5) for longer than your SLO window, which indicates the source is failing every poll even after ingest push retries.
---
## Prometheus Scrape Config
@@ -61,6 +61,7 @@ docker compose up --build
| `INGEST_RATE_LIMIT_MAX` | ingest-api | Máx. pedidos por janela (opcional) |
| `INGEST_RATE_LIMIT_WINDOW_MS` | ingest-api | Janela em ms (opcional) |
| `TICK_INTERVAL_MS`, `SOURCE_REFRESH_MS`, `HTTP_FETCH_TIMEOUT_MS`, `MAX_BACKOFF_EXPONENT` | collector-worker | Intervalos e limites (opcional) |
| `INGEST_PUSH_TIMEOUT_MS`, `INGEST_PUSH_MAX_RETRIES`, `INGEST_PUSH_RETRY_BASE_MS`, `INGEST_PUSH_RETRY_MAX_JITTER_MS` | collector-worker | Push para ingest-api: timeout por tentativa, retries com backoff exponencial + jitter (opcional; ver [RUNBOOK_SLO.md](../RUNBOOK_SLO.md) § Collector) |
| `COLLECTOR_DEFAULT_INGEST_TOKEN` | collector-worker | Fallback para referências `env:VAR` vazias (opcional) |
A `DATABASE_URL` usada nos containers é construída pelo Compose no formato `mysql://USER:PASSWORD@mariadb:3306/DATABASE`. Palavras-passe com caracteres especiais devem ser [percent-encoded](https://datatracker.ietf.org/doc/html/rfc3986#section-2.1).