Skip to Content
OpenPerf

Self-hosting

Operations

Health checks, logs, queues, scaling and retention.

Health

ServiceReadinessReady whenLiveness
api/health/readyPostgreSQL and ClickHouse/health/live
api-ingest/healthzRedis/health/live
mcp/healthzPostgreSQL, ClickHouse, Redis/health/live
worker-errors/healthz on :4400PostgreSQL and Redis/health/live
worker-jobs/healthz on :4200PostgreSQL/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, time and msg are always set. module names the component. A failure carries err with type, message and stack, including its causes.
  • Requests. api, api-ingest and mcp write one record per request when it ends. api-ingest and mcp write the route template as route instead of path. Health probes and preflights are not logged. api-ingest writes successful intake requests at debug.
  • Errors. A 5xx is logged once at error with its err. So is a failed background job, with its queue and jobId.
  • Request IDs. Each request gets an ID, logged as requestId. A service keeps an incoming x-request-id instead only from one of the TRUSTED_PROXIES, and only when it holds 1 to 64 letters, digits, _ or -. api returns it in error responses.
  • Redaction. Records hold no headers, query strings or bodies. The params of a failed SQL query and the detail of 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.

FailureWhat happens
ClickHouse downExport 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 crashRows 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 rowsThe 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-onlyIntake answers 503 until the journal can be written again.
Redis fullErrors 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 floodsIntake 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 seconds

Read 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 installationRow rate15 minutes of journal4 hours of journal
500 spans and 200 log records per second1.4 MB/s1.2 GB20 GB
5,000 spans and 2,000 log records per second14 MB/s12 GB200 GB
20,000 spans and 10,000 log records per second57 MB/s51 GB820 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

ServiceScale withNotes
api-ingestIncoming telemetryINGEST_WORKERS adds intake processes on one host. Each instance has its own journal volume and exports it.
worker-errorsError volumeEach instance keeps its own source map cache of SOURCE_MAP_CACHE_BYTES.
worker-jobsAlert rules and notificationsOne or two instances. JOB_CONCURRENCY applies per instance.
api, webDashboard usersStateless.

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.

On this page