You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The replication metrics request (taken from pg_replication.go) returns an actual replication state:
postgres=# 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
WHEN pg_is_in_recovery() THEN 1
ELSE 0
END as is_replica
;
lag | is_replica
-----+------------
0 | 1
While the exporter still outputs the maximum value from the past:
# curl -s http://10.6.251.206:9187/metrics | grep pg_replication_lag
# HELP pg_replication_lag_seconds Replication lag behind master in seconds
# TYPE pg_replication_lag_seconds gauge
pg_replication_lag_seconds 1.138475469918e+06
In this case the other metrics are updated properly.
How can I reset the output with an actual zero lag value?
The replication metrics request (taken from pg_replication.go) returns an actual replication state:
While the exporter still outputs the maximum value from the past:
In this case the other metrics are updated properly.
How can I reset the output with an actual zero lag value?
Environment
System information:
Linux 5.14.21-at154.2.2-default x86_64
postgres_exporter version:
0.13.2
postgres_exporter flags:
PostgreSQL version:
psql (PostgreSQL) 15.3
The text was updated successfully, but these errors were encountered: