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

SHOW POOLS fails to scrape if multiple databases with different users are present #7

Open
stanhu opened this issue May 1, 2018 · 1 comment

Comments

@stanhu
Copy link

stanhu commented May 1, 2018

I have multiple database with different users:

pgbouncer=# show pools;
          database           |      user      | cl_active | cl_waiting | sv_active | sv_idle | sv_used | sv_tested | sv_login | maxwait |  pool_mode  
-----------------------------+----------------+-----------+------------+-----------+---------+---------+-----------+----------+---------+-------------
 gitlabhq_production         | chatops        |         0 |          0 |         0 |       0 |       0 |         0 |        0 |       0 | transaction
 gitlabhq_production         | gitlab         |       363 |          0 |         1 |       4 |       0 |         0 |        0 |       0 | transaction
 gitlabhq_production         | gitlab_geo_fdw |        20 |          0 |         2 |       6 |       9 |         0 |        0 |       0 | transaction
 gitlabhq_production         | pgbouncer      |         0 |          0 |         0 |       1 |       0 |         0 |        0 |       0 | transaction
 gitlabhq_production_sidekiq | gitlab         |         0 |          0 |         0 |       0 |       0 |         0 |        0 |       0 | transaction
 gitlabhq_production_sidekiq | pgbouncer      |         0 |          0 |         0 |       0 |       0 |         0 |        0 |       0 | transaction
 gitlabhq_production_sidekiq | C              |         0 |          0 |         0 |       0 |       0 |         0 |        0 |       0 | transaction
 pgbouncer                   | pgbouncer      |         2 |          0 |         0 |       0 |       0 |         0 |        0 |       0 | statement
(8 rows)

This results in:

INFO[0036] Starting scrape                               source="collector.go:282"
An error has occurred during metrics collection:

40 error(s) occurred:
* collected metric pgbouncer_pools_client_active_connections label:<name:"database" value:"gitlabhq_production" > gauge:<value:434 >  was collected before with the same name and label values
@ferringb
Copy link

Dupe of #1

ferringb pushed a commit to ferringb/pgbouncer_exporter that referenced this issue Dec 17, 2018
If you're using auth_query mode + autodb for pgbouncer, you wind up having
multiple users for a single DB.  That output looks roughly like thus:

```
 database  |   user    | cl_active | cl_waiting | sv_active | sv_idle | sv_used | sv_tested | sv_login | maxwait | maxwait_us | pool_mode
-----------+-----------+-----------+------------+-----------+---------+---------+-----------+----------+---------+------------+-----------
 paste     | paste     |         0 |          0 |         0 |       2 |       0 |         0 |        0 |       0 |          0 | session
 paste     | pgbouncer |         0 |          0 |         0 |       2 |       0 |         0 |        0 |       0 |          0 | session
```

With how the code was written, this would break cardinality.  User *must* be
a label in this case.  As for pool_mode, it doesn't have to be a label- it's
just useful for exporting it.

This fixes ticket #1 and larseen#7 (same issue)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants