From c2d46a084efcbf1bc3b1b48f6ba306f5c1df8e7e Mon Sep 17 00:00:00 2001 From: Feike Steenbergen Date: Fri, 5 Feb 2016 09:22:38 +0100 Subject: [PATCH] Include timestamp of last replayed location in api call. --- patroni/api.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/patroni/api.py b/patroni/api.py index 2318fbf0..3137a829 100644 --- a/patroni/api.py +++ b/patroni/api.py @@ -229,6 +229,7 @@ class RestApiHandler(BaseHTTPRequestHandler): END, pg_xlog_location_diff(pg_last_xlog_receive_location(), '0/0')::bigint, pg_xlog_location_diff(pg_last_xlog_replay_location(), '0/0')::bigint, + to_char(pg_last_xact_replay_timestamp(), 'YYYY-MM-DD HH24:MI:SS.MS TZ'), pg_is_in_recovery() AND pg_is_xlog_replay_paused()""", retry=retry)[0] return { 'state': self.server.patroni.postgresql.state, @@ -238,7 +239,8 @@ class RestApiHandler(BaseHTTPRequestHandler): 'xlog': ({ 'received_location': row[3], 'replayed_location': row[4], - 'paused': row[5]} if row[1] else { + 'replayed_timestamp': row[5], + 'paused': row[6]} if row[1] else { 'location': row[2] }) }