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
Copy file name to clipboardExpand all lines: cmd/postgres_exporter/postgres_exporter.go
+7-7
Original file line number
Diff line number
Diff line change
@@ -403,26 +403,26 @@ var queryOverrides = map[string][]OverrideQuery{
403
403
semver.MustParseRange(">=10.0.0"),
404
404
`
405
405
SELECT *,
406
-
(case pg_is_in_recovery() when 't' then null else pg_current_wal_lsn() end) AS pg_current_wal_lsn,
407
-
(case pg_is_in_recovery() when 't' then null else pg_wal_lsn_diff(pg_current_wal_lsn(), pg_lsn('0/0'))::float end) AS pg_current_wal_lsn_bytes,
408
-
(case pg_is_in_recovery() when 't' then null else pg_wal_lsn_diff(pg_current_wal_lsn(), replay_lsn)::float end) AS pg_wal_lsn_diff
406
+
(case pg_is_in_recovery() when 't' then pg_last_wal_receive_lsn() else pg_current_wal_lsn() end) AS pg_current_wal_lsn,
407
+
(case pg_is_in_recovery() when 't' then pg_wal_lsn_diff(pg_last_wal_receive_lsn(), pg_lsn('0/0'))::float else pg_wal_lsn_diff(pg_current_wal_lsn(), pg_lsn('0/0'))::float end) AS pg_current_wal_lsn_bytes,
408
+
(case pg_is_in_recovery() when 't' then pg_wal_lsn_diff(pg_last_wal_receive_lsn(), replay_lsn)::float else pg_wal_lsn_diff(pg_current_wal_lsn(), replay_lsn)::float end) AS pg_wal_lsn_diff
409
409
FROM pg_stat_replication
410
410
`,
411
411
},
412
412
{
413
413
semver.MustParseRange(">=9.2.0 <10.0.0"),
414
414
`
415
415
SELECT *,
416
-
(case pg_is_in_recovery() when 't' then null else pg_current_xlog_location() end) AS pg_current_xlog_location,
417
-
(case pg_is_in_recovery() when 't' then null else pg_xlog_location_diff(pg_current_xlog_location(), replay_location)::float end) AS pg_xlog_location_diff
416
+
(case pg_is_in_recovery() when 't' then pg_last_xlog_receive_location() else pg_current_xlog_location() end) AS pg_current_xlog_location,
417
+
(case pg_is_in_recovery() when 't' then pg_xlog_location_diff(pg_last_xlog_receive_location(), replay_location)::float else pg_xlog_location_diff(pg_current_xlog_location(), replay_location)::float end) AS pg_xlog_location_diff
418
418
FROM pg_stat_replication
419
419
`,
420
420
},
421
421
{
422
422
semver.MustParseRange("<9.2.0"),
423
423
`
424
424
SELECT *,
425
-
(case pg_is_in_recovery() when 't' then null else pg_current_xlog_location() end) AS pg_current_xlog_location
425
+
(case pg_is_in_recovery() when 't' then pg_last_xlog_receive_location() else pg_current_xlog_location() end) AS pg_current_xlog_location
426
426
FROM pg_stat_replication
427
427
`,
428
428
},
@@ -433,7 +433,7 @@ var queryOverrides = map[string][]OverrideQuery{
433
433
semver.MustParseRange(">=9.4.0 <10.0.0"),
434
434
`
435
435
SELECT slot_name, database, active,
436
-
(case pg_is_in_recovery() when 't' then pg_xlog_location_diff(pg_current_xlog_location(), restart_lsn) else pg_xlog_location_diff(pg_last_xlog_receive_location(), restart_lsn) as pg_xlog_location_diff
436
+
(case pg_is_in_recovery() when 't' then pg_xlog_location_diff(pg_last_xlog_receive_location(), restart_lsn) else pg_xlog_location_diff(pg_current_xlog_location(), restart_lsn) end) as pg_xlog_location_diff
0 commit comments