question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[core] PGBouncer stats for version latest fails due to extra columns

See original GitHub issue

Output of the info page

    pgbouncer (5.14.1)
    ------------------
      - instance #0 [ERROR]: ''
        Traceback (most recent call last):
          File "/opt/datadog-agent/agent/checks/__init__.py", line 795, in run
            self.check(copy.deepcopy(instance))
          File "/opt/datadog-agent/agent/checks.d/pgbouncer.py", line 221, in check
            self._collect_stats(db, tags)
          File "/opt/datadog-agent/agent/checks.d/pgbouncer.py", line 115, in _collect_stats
            assert len(row) == len(cols) + len(desc)
        AssertionError
        
      - Collected 8 metrics, 0 events & 0 service checks

Additional environment details (Operating System, Cloud provider, etc): PGBouncer latest (Will try to use version 1.7.2 to check this as well)

Steps to reproduce the issue:

  1. Install latest version for PGBouncer
  2. Configure to use the check

Describe the results you received: Failed to receive stats for PGBouncer

Describe the results you expected: Receive stats for PGBouncer

Additional information you deem important (e.g. issue happens only occasionally): Results for SHOW STATS and SHOW POOLS for latest version o PGBouncer

pgbouncer=# SHOW POOLS;
 database  |   user    | cl_active | cl_waiting | sv_active | sv_idle | sv_used | sv_tested | sv_login | maxwait | maxwait_us | pool_mode 
-----------+-----------+-----------+------------+-----------+---------+---------+-----------+----------+---------+------------+-----------
 mydb      | user      |         1 |          0 |         1 |       0 |       4 |         0 |        0 |       0 |          0 | session
 pgbouncer | pgbouncer |         2 |          0 |         0 |       0 |       0 |         0 |        0 |       0 |          0 | statement
(2 rows)

pgbouncer=# SHOW STATS;
 database  | total_requests | total_received | total_sent | total_query_time | avg_req | avg_recv | avg_sent | avg_query 
-----------+----------------+----------------+------------+------------------+---------+----------+----------+-----------
 mydb      |          76375 |       12603991 |  697447723 |        312246284 |       0 |        0 |        0 |         0
 pgbouncer |              4 |              0 |          0 |                0 |       0 |        0 |        0 |         0
(2 rows)

Checking the pgbouncer/check.py it only checks up to maxwait and accepts an extra column. But PGBouncer SHOW POOLS also returns maxwait_us and pool_mode

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
rgacotecommented, Jan 16, 2018

I note that you’re using psycopg2 for access to pgbouncer.

Instead of trying to extract data positionally from the SHOW commands, I’d recommend you switch to using the psycopg2 Dict mode that allows you to reference the row columns by name, vs. trying to manage positional integrity: http://initd.org/psycopg/docs/extras.html psycopg2.connect(dsn, cursor_factory=DictCursor)

0reactions
mascicommented, May 4, 2018

Seems to be fixed, closing…

Read more comments on GitHub >

github_iconTop Results From Across the Web

PgBouncer changelog
Send statistics columns as numeric instead of bigint . This avoids some client libraries failing on values that overflow the bigint range.
Read more >
ERROR: unsupported pkt type: 80 when issuing query "SHOW ...
When trying to issue "SHOW POOLS" or any stats query command on pgbouncer database via JDBC, facing the below exception.
Read more >
Using the PgBouncer Connection Pooler
The PgBouncer utility manages connection pools for PostgreSQL and Greenplum Database connections. The following topics describe how to set up and use ...
Read more >
Getting started with PGBouncer in PostgreSQL - MyDBOPS
PGBouncer Configuration: First I had installed the PostgreSQL server(version 12.1) in the testing instance with the specification of Centos 7 OS ...
Read more >
A Lightweight Connection Pooler for PostgreSQL PgBouncer
uses and binary packaging (if a sufficiently new version is available). ... cl_active Client connections that are linked to server connection and can....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found