From d89652473d678aa0013c7d6a2569a0fa3d8b4c4f Mon Sep 17 00:00:00 2001 From: Vladimir Luksha Date: Mon, 28 Aug 2023 18:18:05 +0300 Subject: [PATCH] fix pg_replication_lag_seconds Signed-off-by: Vladimir Luksha --- collector/pg_replication.go | 1 + 1 file changed, 1 insertion(+) diff --git a/collector/pg_replication.go b/collector/pg_replication.go index 790f85329..6067cc9b1 100644 --- a/collector/pg_replication.go +++ b/collector/pg_replication.go @@ -55,6 +55,7 @@ var ( pgReplicationQuery = `SELECT CASE WHEN NOT pg_is_in_recovery() THEN 0 + WHEN pg_last_wal_receive_lsn () = pg_last_wal_replay_lsn () THEN 0 ELSE GREATEST (0, EXTRACT(EPOCH FROM (now() - pg_last_xact_replay_timestamp()))) END AS lag, CASE