Monitoring
Scrape the twins server's metrics, turn on its alerts on each platform, and know what to do when one fires.
Scrape the twins server's metrics, turn on its alerts on each platform, and know what to do when one fires.
Metrics
Prometheus format at :9464/metrics, and OTLP where OTEL_EXPORTER_OTLP_ENDPOINT is set
Runs on
Kubernetes · AWS · Google Cloud · Azure · Docker Compose
Logs
One JSON line per event
Watch out
Where networkPolicy.allowFrom closes the server, name the scraper in worlds.metrics.scrapers, or TwinsDown fires
Metrics
The twins server serves its metrics at :9464/metrics in Prometheus' format. TWINS_METRICS_PORT changes the port; on the Helm chart it is worlds.metrics.port, and 0 serves none.
It also pushes them over OTLP where OTEL_EXPORTER_OTLP_ENDPOINT is set.
And it writes a log line when something you must act on happens. An install that watches logs alone is told too.
The main metrics
twins_ready
Whether the server is ready. 0 while it is not.
http_server_request_duration_seconds
Request count and latency, by response status.
twins_volume_free_bytes, twins_volume_size_bytes
Free and total space on the worlds' volume.
twins_tenure_renewals_total
Renewals of the lease over the worlds' copies, by result (refused, failed).
twins_replication_writer_up, twins_replication_writer_responding
Whether Litestream is running and answering.
twins_replication_uploads_total
Copies uploaded. It should keep rising.
twins_replication_upload_errors_total, twins_replication_sync_errors_total
Litestream's failures.
twins_replication_disk_full
Litestream paused because the worlds' disk is full.
twins_replication_restores_total
Worlds restored from their copies, by result.
The replication and lease metrics apply where the worlds are copied to a bucket (worlds.replication, AWS replication).
Turn on alerts
worlds.metrics.serviceMonitor.enabled and worlds.metrics.rules.enabled give the Prometheus Operator (kube-prometheus-stack, and the managed Prometheus of GKE and AKS) a ServiceMonitor and twins' alerts as a PrometheusRule.
Each alert in the PrometheusRule carries a runbook_url. Where networkPolicy.allowFrom closes the server, name the scraper in worlds.metrics.scrapers, or the scrape fails and TwinsDown fires.
alarm_topic_arn turns on CloudWatch alarms. The module's own alarms, from AWS's recommended alarms:
The server's task not running.
Unhealthy targets:
UnHealthyHostCountabove 0 for five minutes.Server errors over
alarm_target_5xx_count(10) a minute, kept up for five minutes.Postgres short of storage, or over 90% CPU.
EFS at its I/O limit (
PercentIOLimitat 100 for fifteen minutes), and overalarm_worlds_metered_io_giban hour when you set it.
Beside those, one metric filter for each event the server and Litestream log, under the Twins/<name> namespace: the lease lost or failing to renew, Litestream not answering or logging errors, copies that do not line up, a restore refused, the worlds' volume low, and the server refusing its records' database. Each alarm's description names its runbook.
alert_notification_channels (Cloud Monitoring notification channels) turns on one log-based alert policy per event you must act on: the lease lost or failing to renew, Litestream not answering or logging errors, a restore refused, the worlds' volume low, and the server refusing its records' database. Each policy notifies at most every five minutes and names its runbook.
Google Cloud Managed Service for Prometheus can also scrape the chart's metrics (worlds.metrics).
alert_action_group_ids (Azure Monitor action groups) turns on one log alert rule per event you must act on, queried from Container Insights' ContainerLogV2 every five minutes: the lease lost or failing to renew, Litestream not answering or logging errors, a restore refused, the worlds' volume low, and the server refusing its records' database. It needs monitoring on. Each rule names its runbook.
Azure Monitor managed service for Prometheus can also scrape the chart's metrics (worlds.metrics).
Scrape port 9464 with your own Prometheus. The Compose file does not publish it, so publish it the way TWINS_PORT is published. Or send the server's log to a log tool and alert on the events below.
Read the server's log
The server writes one JSON line per event.
Docker Compose
docker compose -f deploy/docker-compose.selfhost.yml logs worlds
Kubernetes
kubectl -n twins logs statefulset/twins-worlds
AWS (ECS)
aws logs tail <log group> --follow
To find one kind of event, filter with jq:
Alerts and what to do
TwinsDown
Critical
Nothing answers the metrics scrape for 2 minutes. Nothing is served.
Check the pod or task is running, and read the previous container's log. On Kubernetes, let the scraper reach port 9464 (worlds.metrics.scrapers).
TwinsNotReady
Critical
/ready has answered 503 for five minutes. Every request but /health is refused.
Read the log, newest first, for the events below. Stop whatever else holds the lease or the lock. The server waits and needs no restart.
TwinsLeaseLost
Critical
Another process took the lease over the worlds' copies. The server stopped writing and exits.
Make sure exactly one install writes each bucket and prefix. The bucket's <prefix>/tenure.json names the holder.
TwinsLeaseRenewalsFailing
Warning
Renewals of the lease are failing. When the term runs out, the server stops.
Restore the server's access to the bucket: credentials, bucket policy, proxy or DNS. Renewals resume by themselves.
TwinsReplicationStalled
Critical
Litestream is not running or not answering. Writes reach no copy.
Restart the server. Then check twins_replication_uploads_total rises again.
TwinsReplicationErrors
Warning
Litestream is failing to sync or upload some copies.
Fix access to the bucket or the disk. For validation error detected, make sure one install writes the prefix, and tell us the database and the line.
TwinsReplicationDiskFull
Critical
Litestream paused because the worlds' disk is full.
Grow the volume (see TwinsVolumeLow).
TwinsRestoreRefused
Critical
A world's copy could not be restored whole. That world will not open; every other world is served.
Restore that world from a point before the damage, or from the volume's backup. Then delete <name>.db.refused.
TwinsVolumeLow
Warning
Less than 10% of the worlds' volume is free.
Grow the volume, or remove worlds no longer needed. Old dumps in backups/ can go.
TwinsVolumeCritical
Critical
Less than 5% of the worlds' volume is free. Writes fail when it fills.
As for TwinsVolumeLow, now.
TwinsErrors
Warning
More than 5% of requests failed with a 5xx for ten minutes.
Read the log for request.failed. If it is not a readiness or connection problem, send us the lines with their request.id.
TwinsSlow
Warning
The slowest 5% of requests took more than two seconds for fifteen minutes.
Give the server more CPU or memory, or move the database or cache closer. Else send us the slow requests' request.path and duration.
Next
Backups: restore a world or a whole install.
Upgrades: roll back a version the database refuses.
Troubleshooting: problems that raise no alert.
Last updated: 27 October 2026
Was this helpful?