You've already forked postgres_exporter
mirror of
https://github.com/prometheus-community/postgres_exporter.git
synced 2025-08-09 15:42:47 +03:00
Fixed replication pgReplicationSlotQuery - now it's working correctly for replica and primary (#825)
Signed-off-by: Vadim Voitenko <vadim.voitenko@exness.com> Co-authored-by: Vadim Voitenko <vadim.voitenko@exness.com>
This commit is contained in:
@@ -66,11 +66,14 @@ var (
|
|||||||
|
|
||||||
pgReplicationSlotQuery = `SELECT
|
pgReplicationSlotQuery = `SELECT
|
||||||
slot_name,
|
slot_name,
|
||||||
pg_current_wal_lsn() - '0/0' AS current_wal_lsn,
|
CASE WHEN pg_is_in_recovery() THEN
|
||||||
coalesce(confirmed_flush_lsn, '0/0') - '0/0',
|
pg_last_wal_receive_lsn() - '0/0'
|
||||||
|
ELSE
|
||||||
|
pg_current_wal_lsn() - '0/0'
|
||||||
|
END AS current_wal_lsn,
|
||||||
|
COALESCE(confirmed_flush_lsn, '0/0') - '0/0',
|
||||||
active
|
active
|
||||||
FROM
|
FROM pg_replication_slots;`
|
||||||
pg_replication_slots;`
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (PGReplicationSlotCollector) Update(ctx context.Context, instance *instance, ch chan<- prometheus.Metric) error {
|
func (PGReplicationSlotCollector) Update(ctx context.Context, instance *instance, ch chan<- prometheus.Metric) error {
|
||||||
|
Reference in New Issue
Block a user