Add support for optional namespace caching. (#319)

In the user queries.yml file, the created namespaces can now be optionally
cached by setting cache_seconds, which will prevent the query being re-run
within that timeframe if previous results are available.

Supercedes #211, credit to @SamSaffron for the original PR.
This commit is contained in:
Will Rouesnel
2019-11-01 00:17:31 +11:00
committed by GitHub
parent 1385b4f658
commit 34fdb69ee2
4 changed files with 198 additions and 122 deletions

View File

@@ -114,7 +114,8 @@ pg_statio_user_tables:
description: "Number of buffer hits in this table's TOAST table indexes (if any)"
pg_database:
query: " SELECT pg_database.datname, pg_database_size(pg_database.datname) as size FROM pg_database"
query: "SELECT pg_database.datname, pg_database_size(pg_database.datname) as size FROM pg_database"
cache_seconds: 30
metrics:
- datname:
usage: "LABEL"