Self-hosting
Operations
Health checks, logs, queues, scaling and retention.
Health
| Service | Readiness | Ready when | Liveness |
|---|---|---|---|
api | /health/ready | PostgreSQL and ClickHouse | /health/live |
api-ingest | /healthz | Redis | /health/live |
mcp | /healthz | PostgreSQL, ClickHouse, Redis | /health/live |
worker-errors | /healthz on :4400 | PostgreSQL and Redis | /health/live |
worker-jobs | /healthz on :4200 | PostgreSQL | /health/live |
web | — | — | /health/live |
Each image declares a Docker HEALTHCHECK (<service> healthcheck) on its readiness endpoint, web on liveness, at the port in PORT. Every service runs as the non-root openperf user on oven/bun:1.4.5-alpine. The image sets OPENPERF_VERSION to its release, and /healthz reports it as version in the full answer.
api-ingest stays ready while PostgreSQL or ClickHouse is down: the journal holds telemetry until ClickHouse returns, and cached project keys keep accepting requests. /healthz still reports both.
/healthz of api-ingest also reports the journal as queues: the bytes waiting for export, the lag of the oldest of them, how long export has been paused, the dead-lettered requests and their bytes, and the rows and bytes exported since the journal was created.
/healthz of worker-errors reports the error queue: pending, retrying, in-flight and dead entries, the bytes the dead letters hold, the lag of the oldest entry, how long draining has been paused, the rows and bytes written since start, and the used and maximum memory of the state Redis.
api-ingest and mcp answer /healthz in full only to a caller whose address is in TRUSTED_PROXIES. Any other caller gets the status code and status, without the dependencies or the queue.
Logs
Each service writes pino JSON to stdout, one record per line. LOG_LEVEL sets the lowest level. Records carry no service name: take it from the container.
{
"level": "info",
"time": "2026-11-05T14:02:15.871Z",
"requestId": "01JC9X4M2T8Q6R0B5N7V3W1YZK",
"organizationId": "…",
"userId": "…",
"module": "http",
"method": "POST",
"path": "/api/v1/alert-rules",
"status": 201,
"durationMs": 18,
"msg": "POST /api/v1/alert-rules 201"
}- Fields.
level,timeandmsgare always set.modulenames the component. A failure carrieserrwithtype,messageandstack, including its causes. - Requests.
api,api-ingestandmcpwrite one record per request when it ends.api-ingestandmcpwrite the route template asrouteinstead ofpath. Health probes and preflights are not logged.api-ingestwrites successful intake requests atdebug. - Errors. A 5xx is logged once at
errorwith itserr. So is a failed background job, with itsqueueandjobId. - Request IDs. Each request gets an ID, logged as
requestId. A service keeps an incomingx-request-idinstead only from one of theTRUSTED_PROXIES, and only when it holds 1 to 64 letters, digits,_or-.apireturns it in error responses. - Redaction. Records hold no headers, query strings or bodies. The
paramsof a failed SQL query and thedetailof a database error are written as[REDACTED].
Queues
Logs and spans wait in the journal of api-ingest: files in INGEST_JOURNAL_DIR, synced to disk before a request is answered. An exporter reads them and inserts into ClickHouse in batches of up to 32 MiB (scaled down to 16 MiB for a 4 GiB journal), at the latest 500 ms after a row arrived. A batch sent twice is deduplicated.
Errors pass through the journal into ingest:queue:error_intake in the state Redis, which worker-errors drains.
| Failure | What happens |
|---|---|
| ClickHouse down | Export of the failing table pauses with a growing backoff; other tables keep exporting. Intake accepts until the journal holds INGEST_JOURNAL_MAX_BYTES, then answers 429. |
| Restart or crash | Rows of answered requests are on disk and are exported after the restart. An insert that was in flight is sent again as the same batch, which ClickHouse deduplicates. |
| Rejected rows | The exporter halves the batch until it finds the request ClickHouse rejects, and moves it to dead/ next to the journal files once other rows of the table land. While every row is rejected, nothing is dropped: export retries with a growing backoff, and rows move to the dead letters only after 24 hours. |
| Disk full or read-only | Intake answers 503 until the journal can be written again. |
| Redis full | Errors wait in the journal while the error queue holds 10,000 entries or the state Redis holds 80% of its maxmemory. Dead letters of the error queue stop at 3% of maxmemory; past it, rejected batches stay queued. |
| One project floods | Intake answers that project 429 once its rows in the current minute reach its byte quota (INGEST_RATE_LIMIT_PER_MINUTE × 32 KiB), while other projects keep sending. Instances share the count through Redis several times a second, and the minute is a fixed window, so a project can pass the quota briefly. It caps the rate, not journal share. |
Run the state Redis with maxmemory and maxmemory-policy noeviction. worker-errors logs an error at start when it can evict keys, which loses queued errors, and a warning when it has no maxmemory.
Sizing the journal
Nearly all of the journal is what builds up while ClickHouse is down. Size the disk and INGEST_JOURNAL_MAX_BYTES for the outage you want intake to ride out without a 429:
INGEST_JOURNAL_MAX_BYTES ≈ row bytes per second × outage secondsRead the row rate from writtenBytes in /healthz, two readings apart. Until there is traffic, estimate it from these row sizes, measured on a typical Kubernetes service: about 2.2 KB per span and 1.3 KB per log record. Rows are about five times the size of the protobuf body.
| Traffic, whole installation | Row rate | 15 minutes of journal | 4 hours of journal |
|---|---|---|---|
| 500 spans and 200 log records per second | 1.4 MB/s | 1.2 GB | 20 GB |
| 5,000 spans and 2,000 log records per second | 14 MB/s | 12 GB | 200 GB |
| 20,000 spans and 10,000 log records per second | 57 MB/s | 51 GB | 820 GB |
- Disk. Keep the journal on a local SSD. Every request waits for one sync of the disk, shared with the requests that arrived meanwhile.
- Catching up. A journal built up during an outage is exported only as fast as ClickHouse takes it on top of live traffic.
- One instance per directory. A second instance on a journal directory that a running one holds answers 503 and exports nothing.
Sizing the state Redis
It holds the error queue, about 6 KB per error, plus rate limit counters and the idempotency keys of errors. 512 MB covers 15 minutes of 50 errors per second with ClickHouse down. Give the host 1.5 to 2 times maxmemory, because rewriting the append-only file forks Redis, and keep twice maxmemory free on disk for that file.
Background jobs live in PostgreSQL, in the pgboss schema, and survive restarts.
Scaling
| Service | Scale with | Notes |
|---|---|---|
api-ingest | Incoming telemetry | INGEST_WORKERS adds intake processes on one host. Each instance has its own journal volume and exports it. |
worker-errors | Error volume | Each instance keeps its own source map cache of SOURCE_MAP_CACHE_BYTES. |
worker-jobs | Alert rules and notifications | One or two instances. JOB_CONCURRENCY applies per instance. |
api, web | Dashboard users | Stateless. |
Retention
Each ClickHouse table sets its retention as a TTL: 180 days for logs, spans and error events. Change it with a new ALTER TABLE … MODIFY TTL migration. Fired alert events are kept for ALERT_EVENT_RETENTION_DAYS.
Deleting a project, or the organization that owns it, removes its ClickHouse rows, replays and source maps through a project-cleanup job.