You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Also use reset_val for statement_timeout in settings metric
pgwatch sets statement_timeout per-metric during collection, which
would mask the actual configured value. Apply the same reset_val
fix as lock_timeout.
Copy file name to clipboardExpand all lines: config/pgwatch-prometheus/metrics.yml
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -362,23 +362,23 @@ metrics:
362
362
This metric collects various PostgreSQL server settings and configurations.
363
363
It provides insights into the server's configuration, including version, memory settings, and other important parameters.
364
364
This metric is useful for monitoring server settings and ensuring optimal performance.
365
-
Note: For lock_timeout, we use reset_val instead of setting because pgwatch sets
366
-
lock_timeout to 100ms during metric collection, which would mask the actual configured value.
365
+
Note: For lock_timeout and statement_timeout, we use reset_val instead of setting because
366
+
pgwatch overrides these during metric collection, which would mask the actual configured values.
367
367
sqls:
368
368
11: |-
369
369
select /* pgwatch_generated */
370
370
(extract(epoch from now()) * 1e9)::int8 as epoch_ns,
371
371
current_database() as tag_datname,
372
372
name as tag_setting_name,
373
-
-- Use reset_val for lock_timeout because pgwatch sets it to 100ms during collection,
374
-
-- which would mask the actual configured value. reset_val shows the true server config.
375
-
case when name = 'lock_timeout' then reset_val else setting end as tag_setting_value,
373
+
-- Use reset_val for lock_timeout/statement_timeout because pgwatch overrides them during
374
+
-- collection (lock_timeout=100ms, statement_timeout per-metric), masking actual config.
375
+
case when name in ('lock_timeout', 'statement_timeout') then reset_val else setting end as tag_setting_value,
376
376
unit as tag_unit,
377
377
category as tag_category,
378
378
vartype as tag_vartype,
379
-
case when (case when name = 'lock_timeout'then reset_val else setting end) ~ '^-?[0-9]+$' then (case when name = 'lock_timeout' then reset_val else setting end)::bigint else null end as numeric_value,
380
-
-- For lock_timeout, compare reset_val with boot_val since source becomes 'session' during collection
381
-
case when name = 'lock_timeout' then (case when reset_val = boot_val then 1 else 0 end) else (case when source <> 'default' then 0 else 1 end) end as is_default,
379
+
case when (case when name in ('lock_timeout', 'statement_timeout') then reset_val else setting end) ~ '^-?[0-9]+$' then (case when name in ('lock_timeout', 'statement_timeout') then reset_val else setting end)::bigint else null end as numeric_value,
380
+
-- For these settings, compare reset_val with boot_val since source becomes 'session' during collection
381
+
case when name in ('lock_timeout', 'statement_timeout') then (case when reset_val = boot_val then 1 else 0 end) else (case when source <> 'default' then 0 else 1 end) end as is_default,
0 commit comments