Skip to main content

Metrics Endpoint

PowerSync exposes instance metrics via a Prometheus-compatible endpoint. This allows you to integrate with Prometheus or other monitoring systems that scrape Prometheus endpoints.
It’s not recommended to scrape the Prometheus endpoint manually, we suggest using Prometheus or other compatible tools. PowerSync does not currently support pushing to OpenTelemetry collectors.

Configuration

  1. To enable metrics, update your PowerSync YAML file to include the prometheus_port and set a port number.
service.yaml
  1. Update your Docker compose file to forward the prometheus_port.
docker-compose.yaml
Once enabled, restart the service and the metrics endpoint will return Prometheus-formatted metrics, as described in the What is Collected section of the Usage Reporting docs.
If you’re running multiple containers (e.g. splitting up replication containers and API containers) you need to scrape the metrics separately for each container.

Sync Connection Outcomes

powersync_sync_connections_total counts sync streams as they close, plus connection attempts the Service rejects before a stream opens. Use it to see whether clients are disconnecting cleanly, failing mid-stream, or being turned away, and why. powersync_concurrent_connections remains the gauge for streams that are currently open. The counter has four labels: outcome, close_reason, error_code and transport (http_stream or rsocket).
  • success means the stream ended without an error. Token expiry, a sync config switch and process shutdown all count as success. It says nothing about whether the client finished syncing.
  • storage_error and sync_config_error are failures to load or parse the active sync config while setting up the stream.
  • Over HTTP, concurrency_limit returns a bare 429 with no PowerSync error code, so error_code is other.
  • Requests that fail authentication or validation are not counted.
See Error Codes for the meaning of each PSYNC_ code.

PromQL Examples

Rate of closes and rejections by outcome:
Stream errors in the last hour, by code:
Rejected attempts in the last hour, by reason. Anything above zero here is worth alerting on: