Skip to content

Commit

Permalink
Fixed replication pgReplicationSlotQuery - now it's working correctly…
Browse files Browse the repository at this point in the history
… for replica and primary

Signed-off-by: Vadim Voitenko <vadim.voitenko@exness.com>
  • Loading branch information
wwoytenko committed Jun 27, 2023
1 parent bf4e4fb commit 465d843
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions collector/pg_replication_slot.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,14 @@ var (

pgReplicationSlotQuery = `SELECT
slot_name,
pg_current_wal_lsn() - '0/0' AS current_wal_lsn,
coalesce(confirmed_flush_lsn, '0/0') - '0/0',
CASE WHEN pg_is_in_recovery() THEN
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
FROM
pg_replication_slots;`
FROM pg_replication_slots;`
)

func (PGReplicationSlotCollector) Update(ctx context.Context, instance *instance, ch chan<- prometheus.Metric) error {
Expand Down

0 comments on commit 465d843

Please sign in to comment.