Monitoring
Watch a ClipMux server with its health checks, Prometheus metrics, ready-made alerts and structured logs.
A ClipMux server tells you how it's doing in three ways: two health checks for a load balancer or uptime monitor, Prometheus metrics on a listener of their own, and one structured log line per request. The repository ships alert rules for the metrics.
Before you start
- A running server. The one-line install already turns on metrics and JSON logs.
- For metrics: Prometheus, or anything that scrapes the Prometheus text format, on a network that can reach the metrics listener.
Health checks
| Path | Answers 200 ok when |
|---|---|
/healthz | The process is up. |
/readyz | Postgres answers within 2 seconds and the server isn't shutting down. Otherwise 503, with database unavailable or draining. |
Both are on the main listener, so https://video.example.com/readyz works
through Caddy. The compose files declare the Docker health check, which runs
clipmux healthcheck; the image has none, because the same image runs the
cloud GPU workers.
Metrics
Set CLIPMUX_METRICS_ADDR to a host:port and the server serves /metrics
there, on a listener of its own with no authentication. Keep it off the
internet.
The one-line install sets it to :9090 and only exposes the port inside the
Compose network; it's never published on the host. Run Prometheus on that
network and scrape app:9090 with the job name clipmux. Setting
CLIPMUX_PPROF=true adds Go's profiler on the same listener.
What it reports
Requests and delivery
clipmux_http_requests_totalbyrouteandcodeclipmux_http_request_duration_secondsbyroute, long-polls left outclipmux_http_in_flightclipmux_delivery_bytes_totalby playback policyclipmux_delivery_cache_lookups_totalbytableandresult(hitormiss)
Jobs and workers
clipmux_jobs: queued and running jobs, bykind,status,routed_toandroute_reasonclipmux_job_queue_oldest_secondsbykindclipmux_attempts_finished_totalbyexecutor,resultanderror_codeclipmux_workers_onlinebykind: PC agents and the built-in worker seen in the last minuteclipmux_dispatches: Modal and RunPod machines, byproviderandstatus
Background loops and the outbox
clipmux_leader: 1 on the replica that runs the background loopsclipmux_sweeper_pass_seconds,clipmux_sweeper_errors_total,clipmux_sweeper_panics_totalandclipmux_sweeper_last_success_timestamp_seconds, by loopclipmux_outbox_pendingandclipmux_outbox_oldest_pending_secondsbykind: route publications, webhooks, wakes and stops not yet doneclipmux_webhook_deliveriesbystatus
Analytics and speech
clipmux_analytics_flush_rows_total: rows the analytics flushes wroteclipmux_analytics_dropped_total: viewer keys dropped because more than 100,000 piled up between flushesclipmux_speech_api_audio_seconds_total: seconds of audio sent to a speech API
Backups and recovery
clipmux_backup_last_success_timestamp_seconds: when the newest backup was written,0if noneclipmux_backup_last_verified_timestamp_seconds: when a backup last passed its restore check,0if none hasclipmux_backup_verify_failed:1if the newest check failedclipmux_backup_interval_seconds: how often backups are taken,0when they are offclipmux_backup_last_bytes: size of the newest backup, as storedclipmux_backup_sources_pending: committed sources not yet copied to the backup targetclipmux_restore_fenced:1while the restore fence stops storage deletesclipmux_db_size_bytes: size of the Postgres databaseclipmux_data_free_bytesandclipmux_data_total_bytes: the disk holding the data directory
Database pool and process
clipmux_db_pool_acquired_conns,clipmux_db_pool_idle_conns,clipmux_db_pool_max_conns,clipmux_db_pool_acquire_wait_seconds_totalandclipmux_db_pool_empty_acquires_totalclipmux_build_infobyversion,clipmux_process_start_time_seconds,clipmux_go_goroutinesandclipmux_go_heap_bytes
Alerts
Load
deploy/prometheus/alerts.yml
from the repository into Prometheus. It alerts when:
- the server stops answering its metrics listener;
- no replica runs the background loops;
- more than 2% of requests answer 5xx;
- a background loop keeps failing, or panics;
- outbox rows other than webhooks have been pending for over an hour;
- a job has waited over 30 minutes;
- jobs are queued and no worker has been seen in the last minute;
- webhook deliveries gave up;
- the Postgres pool is more than 90% used;
- no backup has been written for twice the backup interval;
- the newest backup failed its restore check, or none has passed one in 8 days;
- the restore fence is up;
- under 10% of the disk holding the data directory is free.
The same file records the install's service levels as series, in a group
named clipmux-slo: clipmux:http_availability:ratio_rate5m and
…ratio_rate1h (the share of requests that didn't answer 5xx), and
clipmux:http_request_duration_seconds:p95_rate5m and …p95_rate1h (the 95th
percentile of request time). Chart them, or alert on a burn rate of your own.
Logs
The server logs to standard output.
CLIPMUX_LOG_FORMATistext(the default) orjson, one object per line. The one-line install usesjson, and Docker rotates the log at 5 files of 50 MB.CLIPMUX_LOG_LEVELisdebug,info(the default),warnorerror.
Every request logs one http request line with its method, route pattern,
path, status, bytes, duration and client address. Successful playback,
storage, worker and health-check requests log at debug, so they stay out
of the way at info; any 4xx logs at info and any 5xx at warn.
Each request has an ID, logged as request_id and sent back in the
X-Request-Id header. When someone reports an error with that ID, it finds
the request's line and any error logged for it. The server takes an incoming
X-Request-Id only from a proxy named in CLIPMUX_TRUSTED_PROXIES.
Credentials are redacted before anything is written, whatever logged them:
API, agent and dispatch keys, webhook secrets, any JWT, the playback token
in a /v/{token}/ path, a share link's secret, pairing codes, and URL query
strings, which may carry signatures. Request lines never include the query,
the Referer or the Authorization header.
cd /opt/clipmux
docker compose logs app | grep req_…Check it works
curl -s https://video.example.com/readyzok: the server and Postgres are up.database unavailable: the server can't reach Postgres.draining: the server is shutting down.
For metrics, Prometheus's targets page shows the clipmux job as up. If
it's down, check that CLIPMUX_METRICS_ADDR is set and that Prometheus runs
on the Compose network.