Skip to content

fix: add support for PgBouncer 1.24 - #6630

Merged
mnencia merged 4 commits into
mainfrom
dev/6566
Jan 29, 2025
Merged

mnencia merged 4 commits into
mainfrom
dev/6566

Conversation

@sxd

@sxd sxd commented Jan 19, 2025 •

Copy link
Copy Markdown
Contributor

The new vlersion of PgBouncer 1.24 add new metrics, following the release notes: https://github.com/pgbouncer/pgbouncer/releases/tag/pgbouncer_1_24_0 we add support for:

  • total_bind_count
  • total_client_parse_count
  • total_server_parse_count
  • avg_bind_ount
  • avg_client_parse_count
  • avg_server_parse_count

Closes #6566

@sxd
sxd requested a review from a team January 19, 2025 20:27
@cnpg-bot cnpg-bot added backport-requested ◀️ This pull request should be backported to all supported releases release-1.22 labels Jan 19, 2025
@github-actions

Copy link
Copy Markdown
Contributor

❗ By default, the pull request is configured to backport to all release branches.

  • To stop backporting this pr, remove the label: backport-requested ◀️ or add the label 'do not backport'
  • To stop backporting this pr to a certain release branch, remove the specific branch label: release-x.y

@github-actions

Copy link
Copy Markdown
Contributor

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@sxd sxd added the do not merge 🙅 This PR cannot be merged (yet) label Jan 19, 2025
@sxd

sxd commented Jan 21, 2025

Copy link
Copy Markdown
Contributor Author

/test depth=push

@github-actions

Copy link
Copy Markdown
Contributor

@sxd

sxd commented Jan 22, 2025

Copy link
Copy Markdown
Contributor Author

/test depth=push

@github-actions

Copy link
Copy Markdown
Contributor

@cnpg-bot cnpg-bot added the ok to merge 👌 This PR can be merged label Jan 23, 2025
@sxd
sxd requested a review from jsilvela as a code owner January 24, 2025 14:36

@gabriele-wolfox gabriele-wolfox left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@sxd sxd removed the do not merge 🙅 This PR cannot be merged (yet) label Jan 25, 2025
sxd and others added 4 commits January 29, 2025 14:35
The new vlersion of PgBouncer 1.24 add new metrics, following the release
notes: https://github.com/pgbouncer/pgbouncer/releases/tag/pgbouncer_1_24_0
we add support for:
* total_bind_count
* total_client_parse_count
* total_server_parse_count
* avg_bind_ount
* avg_client_parse_count
* avg_server_parse_count

Closes #6566

Signed-off-by: Jonathan Gonzalez V. <[email protected]>
@mnencia
mnencia merged commit 762c282 into main Jan 29, 2025
@mnencia
mnencia deleted the dev/6566 branch January 29, 2025 14:12
cnpg-bot pushed a commit that referenced this pull request Jan 29, 2025
PgBouncer 1.24 introduces new metrics as per the release notes at https://github.com/pgbouncer/pgbouncer/releases/tag/pgbouncer_1_24_0

This commit adds support for the following metrics:

- `total_bind_count`
- `total_client_parse_count`
- `total_server_parse_count`
- `avg_bind_count` (corrected typo)
- `avg_client_parse_count`
- `avg_server_parse_count`

Closes #6566

Signed-off-by: Jonathan Gonzalez V. <[email protected]>
Signed-off-by: Armando Ruocco <[email protected]>
Co-authored-by: Armando Ruocco <[email protected]>
(cherry picked from commit 762c282)
cnpg-bot pushed a commit that referenced this pull request Jan 29, 2025
PgBouncer 1.24 introduces new metrics as per the release notes at https://github.com/pgbouncer/pgbouncer/releases/tag/pgbouncer_1_24_0

This commit adds support for the following metrics:

- `total_bind_count`
- `total_client_parse_count`
- `total_server_parse_count`
- `avg_bind_count` (corrected typo)
- `avg_client_parse_count`
- `avg_server_parse_count`

Closes #6566

Signed-off-by: Jonathan Gonzalez V. <[email protected]>
Signed-off-by: Armando Ruocco <[email protected]>
Co-authored-by: Armando Ruocco <[email protected]>
(cherry picked from commit 762c282)
cnpg-bot pushed a commit that referenced this pull request Jan 29, 2025
PgBouncer 1.24 introduces new metrics as per the release notes at https://github.com/pgbouncer/pgbouncer/releases/tag/pgbouncer_1_24_0

This commit adds support for the following metrics:

- `total_bind_count`
- `total_client_parse_count`
- `total_server_parse_count`
- `avg_bind_count` (corrected typo)
- `avg_client_parse_count`
- `avg_server_parse_count`

Closes #6566

Signed-off-by: Jonathan Gonzalez V. <[email protected]>
Signed-off-by: Armando Ruocco <[email protected]>
Co-authored-by: Armando Ruocco <[email protected]>
(cherry picked from commit 762c282)
@usernamedt

usernamedt commented Feb 10, 2025 •

Copy link
Copy Markdown
Contributor

Hi, everyone! After testing the PgBouncer 1.24 and CNPG 1.25 with this fix applied I see the following errors in the pooler logs:

{
  "level": "error",
  "ts": "2025-02-10T13:01:21.430417823Z",
  "msg": "Error while executing SHOW POOLS",
  "logger": "pgbouncer-manager",
  "error": "sql: Scan error on column index 16, name \"load_balance_hosts\": converting NULL to int is unsupported",
  "stacktrace": "github.com/cloudnative-pg/machinery/pkg/log.(*logger).Error\n\t/root/go/pkg/mod/github.com/cloudnative-pg/[email protected]/pkg/log/log.go:125\ngithub.com/cloudnative-pg/cloudnative-pg/pkg/management/pgbouncer/metricsserver.(*Exporter).collectShowPools\n\tpkg/management/pgbouncer/metricsserver/pools.go:301\ngithub.com/cloudnative-pg/cloudnative-pg/pkg/management/pgbouncer/metricsserver.(*Exporter).collectPgBouncerMetrics\n\tpkg/management/pgbouncer/metricsserver/pgbouncer_collector.go:143\ngithub.com/cloudnative-pg/cloudnative-pg/pkg/management/pgbouncer/metricsserver.(*Exporter).Collect\n\tpkg/management/pgbouncer/metricsserver/pgbouncer_collector.go:119\ngithub.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1\n\t/root/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:456"
}
pgbouncer=# show pools;
    database     |         user          | cl_active | cl_waiting | cl_active_cancel_req | cl_waiting_cancel_req | sv_active | sv_active_cancel | sv_being_canceled | sv_idle | sv_used | sv_tested | sv_login | maxwait | maxwait_us |  pool_mode  | load_balance_hosts
-----------------+-----------------------+-----------+------------+----------------------+-----------------------+-----------+------------------+-------------------+---------+---------+-----------+----------+---------+------------+-------------+--------------------
 test_cluster    | test_user             |        19 |          0 |                    0 |                     0 |         0 |                0 |                 0 |       3 |       5 |         0 |        0 |       0 |          0 | transaction |
 pgbouncer       | pgbouncer             |         1 |          0 |                    0 |                     0 |         0 |                0 |                 0 |       0 |       0 |         0 |        0 |       0 |          0 | statement   |
 postgres        | cnpg_pooler_pgbouncer |         0 |          0 |                    0 |                     0 |         0 |                0 |                 0 |       2 |       2 |         0 |        0 |       0 |          0 | transaction |
(3 rows)

Given the fact that I am using more or less standard setup, I am wondering why do we output an explicit error here? Maybe it is better to treat the unset setting in a more optimistic way?

gbartolini pushed a commit that referenced this pull request Feb 12, 2025
When using the `SHOW STATS` command to handle metrics for pgBouncer,
expect NULL as a result and ensure it is handled properly.
This issue was introduced in PR #6630.

Relates #6566

Signed-off-by: Daniil Zakhlystov <[email protected]>
Co-authored-by: Daniil Zakhlystov <[email protected]>
cnpg-bot pushed a commit that referenced this pull request Feb 17, 2025
When using the `SHOW STATS` command to handle metrics for pgBouncer,
expect NULL as a result and ensure it is handled properly.
This issue was introduced in PR #6630.

Relates #6566

Signed-off-by: Daniil Zakhlystov <[email protected]>
Co-authored-by: Daniil Zakhlystov <[email protected]>
(cherry picked from commit d0e8f5f)
cnpg-bot pushed a commit that referenced this pull request Feb 17, 2025
When using the `SHOW STATS` command to handle metrics for pgBouncer,
expect NULL as a result and ensure it is handled properly.
This issue was introduced in PR #6630.

Relates #6566

Signed-off-by: Daniil Zakhlystov <[email protected]>
Co-authored-by: Daniil Zakhlystov <[email protected]>
(cherry picked from commit d0e8f5f)
cnpg-bot pushed a commit that referenced this pull request Feb 17, 2025
When using the `SHOW STATS` command to handle metrics for pgBouncer,
expect NULL as a result and ensure it is handled properly.
This issue was introduced in PR #6630.

Relates #6566

Signed-off-by: Daniil Zakhlystov <[email protected]>
Co-authored-by: Daniil Zakhlystov <[email protected]>
(cherry picked from commit d0e8f5f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-requested ◀️ This pull request should be backported to all supported releases ok to merge 👌 This PR can be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Error Executing SHOW STATS in PgBouncer

6 participants