Skip to content

Commit

Permalink
Merge 0753717 into 0f3eb04
Browse files Browse the repository at this point in the history
  • Loading branch information
mpasternacki committed Jul 5, 2018
2 parents 0f3eb04 + 0753717 commit f04915a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/collectors/postgres/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ def _translate_datname(self, datname):
return datname

def fetch(self, pg_version):
if float(pg_version) >= 9.6 and hasattr(self, 'post_96_query'):
if float(pg_version) >= 10.0 and hasattr(self, 'post_100_query'):
q = self.post_100_query
elif float(pg_version) >= 9.6 and hasattr(self, 'post_96_query'):
q = self.post_96_query
elif float(pg_version) >= 9.2 and hasattr(self, 'post_92_query'):
q = self.post_92_query
Expand Down Expand Up @@ -496,6 +498,11 @@ class BackgroundWriterStats(QueryStats):
class WalSegmentStats(QueryStats):
path = "wals.%(metric)s"
multi_db = False
post_100_query = """
SELECT count(*) AS segments
FROM pg_ls_dir('pg_wal') t(fn)
WHERE fn ~ '^[0-9A-Z]{24}$'
"""
query = """
SELECT count(*) AS segments
FROM pg_ls_dir('pg_xlog') t(fn)
Expand Down

0 comments on commit f04915a

Please sign in to comment.