Repository navigation
Description
Is there an existing issue already for this bug?
- I have searched for an existing issue, and could not find anything. I believe this is a new bug.
I have read the troubleshooting guide
- I have read the troubleshooting guide and I think this is a new bug.
I am running a supported version of CloudNativePG
- I have read the troubleshooting guide and I think this is a new bug.
Contact Details
Version
1.25 (latest patch)
What version of Kubernetes are you using?
1.29
What is your Kubernetes environment?
Cloud: Other
How did you install the operator?
YAML manifest
What happened?
After updating PgBouncer to the new version (1.24.0) using the image ghcr.io/cloudnative-pg/pgbouncer:1.24.0, I have encountered several errors related to metrics.
{"level":"error","ts":"2025-01-11T10:28:58.707682986Z","msg":"Error while executing SHOW STATS","logger":"pgbouncer-manager"
,"error":"sql: expected 23 destination arguments in Scan, not 17","stacktrace":"github.com/cloudnative-pg/machinery/pkg/log.(*logger).
Error\n\tpkg/mod/github.com/cloudnative-pg/[email protected]/pkg/log/log.go:125\ngithub.com/cloudnative-pg/
cloudnative-pg/pkg/management/pgbouncer/metricsserver.(*Exporter).collectShowStats\n\tpkg/management/pgbouncer/metricsserver/stats.go:
285\ngithub.com/cloudnative-pg/cloudnative-pg/pkg/management/pgbouncer/metricsserver.(*Exporter).collectPgBouncerMetrics\n\tpkg/manage
ment/pgbouncer/metricsserver/pgbouncer_collector.go:144\ngithub.com/cloudnative-pg/cloudnative-pg/pkg/management/pgbouncer/metricsserv
er.(*Exporter).Collect\n\tpkg/management/pgbouncer/metricsserver/pgbouncer_collector.go:119\ngithub.com/prometheus/client_golang/prome
theus.(*Registry).Gather.func1\n\tpkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:456"}When executing the SHOW STATS command in PgBouncer, an error occurs indicating a mismatch between the expected number of columns and the actual output. The error message is as follows:
Error while executing SHOW STATS: sql: expected 23 destination arguments in Scan, not 17
This suggests that the code responsible for processing the results of the SHOW STATS command is not aligned with the actual structure of the output.
The same issue occurs when executing the SHOW POOLS command.
Details
The SHOW STATS command currently returns a set of statistics that includes various metrics about database connections and queries. However, it appears that the implementation in the codebase at stats.go is expecting a different number of columns than what is being returned.
The output from the SHOW STATS command is as follows:
-[ RECORD 1 ]-----------------+----------
database | my_database
total_server_assignment_count | 26
total_xact_count | 7180
total_query_count | 7180
total_received | 1458529
total_sent | 8538725
total_xact_time | 2190046
total_query_time | 2190046
total_wait_time | 282832
total_client_parse_count | 0
total_server_parse_count | 0
total_bind_count | 0
avg_server_assignment_count | 0
avg_xact_count | 0
avg_query_count | 0
avg_recv | 0
avg_sent | 0
avg_xact_time | 0
avg_query_time | 0
avg_wait_time | 0
avg_client_parse_count | 0
avg_server_parse_count | 0
avg_bind_count | 0
Expected Behavior
The code should correctly handle and parse all columns returned by the SHOW STATS command without throwing an error. The discrepancy indicates that either the PgBouncer version has changed the output format or there is an oversight in the metrics server's implementation.
Cluster resource
Relevant log output
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
sxd commentedon Jan 11, 2025
Hi @akirill0v
Thanks for reporting this, we're waiting for the tests to run about these to get a full result, but your report seems fair and related to this new feature in the version 1.24.0 pgbouncer/pgbouncer#1192 this may need a patch to support the version before merging.
Regards,
fix: add support for PgBouncer 1.24
fix: add support for PgBouncer 1.24
fix: add support for PgBouncer 1.24
fix: add support for PgBouncer 1.24
fix: add support for PgBouncer 1.24 (#6630)
fix: add support for PgBouncer 1.24 (#6630)
fix: add support for PgBouncer 1.24 (#6630)
fix: add support for PgBouncer 1.24 (cloudnative-pg#6630)
fix(pgbouncer): handle `load_balance_hosts` null value (#6810)
fix(pgbouncer): handle `load_balance_hosts` null value (#6810)
fix(pgbouncer): handle `load_balance_hosts` null value (#6810)
fix(pgbouncer): handle `load_balance_hosts` null value (#6810)