Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Monitoring

The pg-tide relay exposes Prometheus metrics and a health endpoint for observability.


Endpoints

EndpointPortDescription
GET /metrics9090 (default)Prometheus metrics
GET /health9090 (default)Liveness + readiness check

Configure the port with --metrics-addr:

pg-tide --metrics-addr 0.0.0.0:9090

Prometheus Metrics

Counters

MetricLabelsDescription
pg_tide_relay_messages_published_totalpipeline, directionMessages successfully delivered to sink
pg_tide_relay_messages_consumed_totalpipeline, directionMessages read from source
pg_tide_relay_publish_errors_totalpipeline, directionFailed delivery attempts
pg_tide_relay_dedup_skipped_totalpipelineMessages skipped (duplicate dedup key)

Gauges

MetricLabelsDescription
pg_tide_relay_pipeline_healthypipeline1 if pipeline is operational, 0 otherwise

Health Endpoint

curl http://localhost:9090/health
  • 200 OK — all pipelines healthy
  • 503 Service Unavailable — one or more pipelines unhealthy

Response body includes unhealthy pipeline names when degraded.


SQL-Level Monitoring

In addition to relay metrics, monitor from PostgreSQL:

-- Pending messages per outbox
SELECT * FROM tide.outbox_pending;

-- Consumer lag
SELECT * FROM tide.consumer_lag;

-- Pipeline status
SELECT tide.relay_list_configs();

Grafana Dashboard

Example PromQL queries for a Grafana dashboard:

# Message throughput (published/sec)
rate(pg_tide_relay_messages_published_total[5m])

# Error rate
rate(pg_tide_relay_publish_errors_total[5m])

# Consumer lag (from PostgreSQL — use a Postgres exporter)
pg_tide_consumer_lag{group_name="my-relay"}

# Pipeline health
pg_tide_relay_pipeline_healthy

Alerting Recommendations

ConditionSeverityAlert
pg_tide_relay_pipeline_healthy == 0CriticalPipeline down
rate(publish_errors_total[5m]) > 0WarningDelivery errors
Consumer lag > thresholdWarningRelay falling behind
No heartbeat for > 60sCriticalRelay process dead