Skip to content

[Bug]: pooler stats metrics disappear when PgBouncer adds a SHOW STATS column #11365

Description

@AdzerKI

The pooler stops exporting every cnpg_pgbouncer_stats_* metric and logs this on each scrape:

Error while executing SHOW STATS ... sql: expected 25 destination arguments in Scan, not 23

collectShowStats picks the scan layout from the number of columns (< 16, == 17, default 23). PgBouncer keeps adding columns — total_client_login_count and avg_client_login_count are the newest pair — so a build past the known counts falls into the default branch and the scan fails. It already happened once with 1.24 (#6566) and will happen again on the next column.

Pool metrics keep working, so the pooler looks healthy while its throughput and wait-time series are gone.

To reproduce: run a Pooler on a PgBouncer that reports 25 SHOW STATS columns and read /metrics on port 9127 — only cnpg_pgbouncer_pools_* are there.

Fix in #11366: bind the scan destinations to the column names from rows.Columns() and skip names the collector does not know.

Separately, ShowStatsMetrics.Reset resets TotalClientParseCount and TotalServerParseCount twice and never resets AvgClientParseCount and AvgServerParseCount, so a database that disappears keeps its last averages.

Activity

  1. added
    chore
    on Sep 8, 2026
  2. added theissue type on Sep 8, 2026
  3. added this to the Now milestone on Sep 8, 2026
  4. added a commit that references this issue on Sep 9, 2026
    590dccc
  5. added 3 commits that reference this issue on Sep 9, 2026
    0f24106
    59ba444
    2998cc7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    choreno-stale

    Type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions