Skip to content

Conversation

@NikolayS
Copy link
Contributor

@NikolayS NikolayS commented Dec 16, 2025

pgwatch sets lock_timeout to 100ms during metric collection, which causes the monitoring to report 100ms instead of the actual configured value. This fix queries reset_val from pg_settings for lock_timeout to get the genuine configuration value.

Closes #61


Note

Report the actual lock_timeout by using reset_val in the settings metric and add unit/integration tests to verify it.

  • Metrics config (config/pgwatch-prometheus/metrics.yml):
    • settings: Use reset_val instead of setting for lock_timeout (documented in description) and apply the same CASE logic for numeric_value.
  • Tests:
    • Add tests/settings/test_settings_metric.py with unit tests ensuring the SQL/description changes and an integration test validating lock_timeout returns the reset value despite session overrides.

Written by Cursor Bugbot for commit 7891edc. Configure here.

pgwatch sets lock_timeout to 100ms during metric collection, which
causes the monitoring to report 100ms instead of the actual configured
value. This fix queries reset_val from pg_settings for lock_timeout
to get the genuine configuration value.

Closes #61
@NikolayS NikolayS changed the title True lock_timeout Get true lock_timeout Dec 16, 2025
@NikolayS
Copy link
Contributor Author

@cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

case when setting ~ '^-?[0-9]+$' then setting::bigint else null end as numeric_value,
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,
case when source <> 'default' then 0 else 1 end as is_default,
1 as configured
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: is_default inconsistent with lock_timeout value

For lock_timeout, tag_setting_value now comes from reset_val while is_default is still derived from source (the session-overridden value). When pgwatch sets lock_timeout during collection, source becomes session, causing is_default to report non-default even if the configured reset_val equals the default, making the emitted fields contradictory.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants