feat: add sync WAL lag Prometheus metric for physical mode
Summary
Add new Prometheus metrics to monitor the sync instance in physical mode:
-
dblab_sync_wal_lag_seconds- WAL replay lag in seconds (the key metric) -
dblab_sync_status- Status of the sync instance -
dblab_sync_uptime_seconds- Uptime of the sync instance -
dblab_sync_last_replayed_timestamp- Unix timestamp of last replayed transaction
Why
These metrics enable monitoring of WAL replay lag when using restore_command in physical mode. Critical for customers using DBLab instances for data extraction for analytics.
Changes
-
engine/internal/srv/metrics/metrics.go- metric definitions -
engine/internal/srv/metrics/collector.go- collection logic (only runs in physical mode) -
PROMETHEUS.md- documentation with example queries and alerting rules
Related
Extends the Prometheus exporter from !1087 (merged)
Closes #673 (closed)
Edited by Nikolay Samokhvalov