prometheus-community / postgres_exporter

A PostgreSQL metric exporter for Prometheus
Apache License 2.0
2.83k stars 745 forks source link

pg exporter will occur error when backup #1091

Open tunbb opened 2 weeks ago

tunbb commented 2 weeks ago

postgres exporter catch metric pg_pg_replication_lag_seconds,the sql SELECT CASE WHEN NOT pg_is_in_recovery() THEN 0 ELSE GREATEST (0, EXTRACT(EPOCH FROM (now() - pg_last_xact_replay_timestamp()))) END AS lag

occurs an error every time when backup, pg_exporter_last_scrape_error = 1

pg_last_xact_replay_timestamp cannot use when backup,so every day we receive an alert