Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[-] fix Invalid command SET lock_timeout... error, fixes #507 #527

Merged
merged 3 commits into from
Nov 22, 2022

Conversation

IlyaTsoi
Copy link
Contributor

Fixed error "invalid command 'SET lock_timeout TO '100ms'" when connecting to pgbouncer DB type. #507.
It is possible to add pgbouncer tables with the same structure as "show stats" to collect metrics from them. I was add 'show pools' table in tis commit

Remove command "SET lock_timeout TO '100ms';" when connets to pgbouncer and pgpool DB types.
Added metrics gathering from the pgbouncer 'SHOW POOLS' table
Copy link
Collaborator

@pashagolub pashagolub left a comment

Choose a reason for hiding this comment

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

Hey, thanks a lot for your help.

It is usually a good idea to provide with pull requests only atomic changes. It's better here to have two separate PRs: one for bug fixing and one with a new functionality. For example, I'm not sure if we need pgbouncer_pool table but I'm strongly confident we want a bug fix.

Another advice is to use self descriptive commit messages. There is no need in Update pgwatch2.go string. We will see that from the commit itself.

It's a good idea to create a new branch in your forked repo and then creating pull request from it and not from master. Doing so you may allow authors of the target repo make changes. If you want to allow anyone with push access to the upstream repository to make changes to your pull request, select Allow edits from maintainers.

pgwatch2/pgwatch2.go Outdated Show resolved Hide resolved
Append 'SET lock_timeout TO '100ms' if DBType is postgres in sql query, else dont't

Co-authored-by: Pavlo Golub <pavlo.golub@gmail.com>
@IlyaTsoi
Copy link
Contributor Author

@pashagolub Thanks for the advice, I'll keep that in mind next time. I'm new to this ).

@pashagolub
Copy link
Collaborator

No problem. Good job! I'll merge it as it is since there are no huge changes anyway

@pashagolub pashagolub changed the title Fix for "Invalid command SET lock_timeout..." error, added "show pools" table to collect [-] fix Invalid command SET lock_timeout... error, fixes #507 Nov 22, 2022
@pashagolub pashagolub merged commit 29be01f into cybertec-postgresql:master Nov 22, 2022
@vitabaks
Copy link

Test

result: not passed

root@7cfb7d2bff54:~# /usr/bin/pgwatch2-daemon --version
cd2790d0f446946bb7bce5f3e063be1928c0d130 (2022-11-23T16:16:29+01:00)

Error:

2022/11/24 09:52:57 WARN main: Could not find PG version info for DB drm-pgnode01_pgbouncer_postgres, skipping shutdown check of metric worker process for pgbouncer_stats
...
2022/11/24 10:03:57 ERRO MetricGathererLoop: Total failed fetches for [drm-pgnode01_pgbouncer_postgres:pgbouncer_stats]: 12
2022/11/24 10:03:57 ERRO MetricGathererLoop: Failed to fetch metric data for [drm-pgnode01_pgbouncer_oms:pgbouncer_stats]: pq: invalid command '
', use SHOW HELP;

@vitabaks
Copy link

vitabaks commented Dec 8, 2022

@IlyaTsoi I'm sorry, but have you tested the collection of metrics with pgbouncer? It didn't work for me (see above).

@IlyaTsoi
Copy link
Contributor Author

IlyaTsoi commented Dec 8, 2022

@vitabaks of course! This works well for me. Maybe there is something wrong with the settings? More information required. This issue is discussed here https://github.com/cybertec-postgresql/pgwatch2/issues/550

pashagolub added a commit to cybertec-postgresql/pgwatch that referenced this pull request Feb 17, 2023
pashagolub added a commit to cybertec-postgresql/pgwatch that referenced this pull request Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

problem getting PgBouncer metrics because of "SET lock_timeout TO '100ms';"
3 participants