File tree Expand file tree Collapse file tree 6 files changed +25
-19
lines changed
Expand file tree Collapse file tree 6 files changed +25
-19
lines changed Original file line number Diff line number Diff line change @@ -364,16 +364,20 @@ files:
364364 - name : collect_wal_metrics
365365 description : |
366366 Collect metrics about WAL file age.
367- NOTE:
368- For Postgres 9.6 and below, you must run the check local to your database if you want to enable this option.
369- Starting Postgres 10, WAL file metrics are enabled by default using `pg_ls_waldir` and don't need local access.
367+
368+ When unset, this defaults to `true` for Postgres 10+ (uses `pg_ls_waldir` via SQL) and `false` for
369+ Postgres 9.6 and below (requires local filesystem access to the WAL directory).
370+
371+ Set to `true` explicitly for Postgres 9.6 and below only if the Agent runs on the same host as the
372+ database and has read access to the WAL directory. You must also configure `data_directory`.
370373 value :
371374 type : boolean
372375 example : true
376+ display_default : null
373377 - name : data_directory
374378 description : |
375- The data directory of your postgres installation
376- Required when collecting WAL metrics on Postgres 9.6.
379+ The data directory of your postgres installation.
380+ Only used when `collect_wal_metrics` is explicitly set to `true` on Postgres 9.6 and below .
377381 value :
378382 type : string
379383 example : /usr/local/pgsql/data
Original file line number Diff line number Diff line change 1+ Fixes collect_wal_metrics config default on 9.6 and below to correctly default to disabled
Original file line number Diff line number Diff line change @@ -52,10 +52,6 @@ def instance_collect_function_metrics():
5252 return False
5353
5454
55- def instance_collect_wal_metrics ():
56- return True
57-
58-
5955def instance_data_directory ():
6056 return '/usr/local/pgsql/data'
6157
Original file line number Diff line number Diff line change @@ -271,17 +271,20 @@ instances:
271271 #
272272 collect_bloat_metrics: false
273273
274- ## @param collect_wal_metrics - boolean - optional - default: true
274+ ## @param collect_wal_metrics - boolean - optional
275275 ## Collect metrics about WAL file age.
276- ## NOTE:
277- ## For Postgres 9.6 and below, you must run the check local to your database if you want to enable this option.
278- ## Starting Postgres 10, WAL file metrics are enabled by default using `pg_ls_waldir` and don't need local access.
276+ ##
277+ ## When unset, this defaults to `true` for Postgres 10+ (uses `pg_ls_waldir` via SQL) and `false` for
278+ ## Postgres 9.6 and below (requires local filesystem access to the WAL directory).
279+ ##
280+ ## Set to `true` explicitly for Postgres 9.6 and below only if the Agent runs on the same host as the
281+ ## database and has read access to the WAL directory. You must also configure `data_directory`.
279282 #
280283 # collect_wal_metrics: true
281284
282285 ## @param data_directory - string - optional - default: /usr/local/pgsql/data
283- ## The data directory of your postgres installation
284- ## Required when collecting WAL metrics on Postgres 9.6.
286+ ## The data directory of your postgres installation.
287+ ## Only used when `collect_wal_metrics` is explicitly set to `true` on Postgres 9.6 and below .
285288 #
286289 # data_directory: /usr/local/pgsql/data
287290
Original file line number Diff line number Diff line change @@ -397,7 +397,8 @@ def dynamic_queries(self):
397397 if self .is_aurora is False :
398398 queries .append (QUERY_PG_STAT_WAL_RECEIVER )
399399 if self ._config .collect_wal_metrics is not False :
400- # collect wal metrics for pg >= 10 only if the user has not explicitly disabled it
400+ # collect wal metrics for pg >= 10 by default (uses pg_ls_waldir via SQL)
401+ # unless the user has explicitly disabled it
401402 queries .append (WAL_FILE_METRICS )
402403 if self ._config .collect_buffercache_metrics :
403404 queries .append (BUFFERCACHE_METRICS )
@@ -1137,8 +1138,9 @@ def check(self, _):
11371138 self .statement_metrics .run_job_loop (tags )
11381139 self .statement_samples .run_job_loop (tags )
11391140 self .metadata_samples .run_job_loop (tags )
1140- if self ._config .collect_wal_metrics :
1141- # collect wal metrics for pg < 10, disabled by enabled
1141+ if self ._config .collect_wal_metrics is True :
1142+ # collect wal metrics for pg < 10 only when explicitly enabled
1143+ # (requires local filesystem access to the WAL directory)
11421144 self ._collect_wal_metrics ()
11431145
11441146 if self ._query_manager .queries :
Original file line number Diff line number Diff line change 5050 'collect_database_size_metrics' : True ,
5151 'collect_default_database' : True ,
5252 'collect_bloat_metrics' : False ,
53- 'collect_wal_metrics' : True ,
53+ 'collect_wal_metrics' : None , # Version-aware: defaults to True for PG 10+, False for PG 9.6 and below
5454 'tag_replication_role' : True ,
5555 'table_count_limit' : 200 ,
5656 'max_relations' : 300 ,
You can’t perform that action at this time.
0 commit comments