From 131f67340684807f8b1457e8b40e16f6d070c664 Mon Sep 17 00:00:00 2001 From: Garrett Thornburg Date: Fri, 13 Nov 2020 09:22:23 -0800 Subject: [PATCH 1/2] Switch receive lsn to replay lsn for queryable byte lag --- data_source.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/data_source.go b/data_source.go index 97adf40..057ed30 100644 --- a/data_source.go +++ b/data_source.go @@ -229,9 +229,9 @@ FROM log.Fatalln("Error getting pg_current_wal_lsn:", err) } - pgLastWalLsn, err := ds.getPgLastWalReceiveLsn() + pgLastWalLsn, err := ds.getPgLastWalReplayLsn() if err != nil { - log.Fatalln("Error getting pg_last_wal_lsn:", err) + log.Fatalln("Error getting pg_last_wal_replay_lsn:", err) } // Skip the byte lag checks if the last wal lsn is empty if pgLastWalLsn == "" { @@ -304,9 +304,9 @@ func (ds *pgDataSource) getPgCurrentWalLsn(role string) (string, error) { } } -func (ds *pgDataSource) getPgLastWalReceiveLsn() (string, error) { +func (ds *pgDataSource) getPgLastWalReplayLsn() (string, error) { pgLastWalLsn := null.String{} - err := ds.DB.Get(&pgLastWalLsn, "select pg_last_wal_receive_lsn()") + err := ds.DB.Get(&pgLastWalLsn, "select pg_last_wal_replay_lsn()") if err != nil { return "", err } From 2df684ae88086aa2fb9cf17bc306aa680018cffc Mon Sep 17 00:00:00 2001 From: Garrett Thornburg Date: Fri, 13 Nov 2020 09:23:02 -0800 Subject: [PATCH 2/2] Bump minor version because byte lag metric is replay now --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index f173b2a..9fa3639 100644 --- a/main.go +++ b/main.go @@ -73,7 +73,7 @@ func main() { flag.Parse() if *versionPtr { - fmt.Println("1.1.2") + fmt.Println("1.2.0") return }