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

pb metric collection #1

Open
imatpro opened this issue Jun 30, 2017 · 4 comments
Open

pb metric collection #1

imatpro opened this issue Jun 30, 2017 · 4 comments

Comments

@imatpro
Copy link

imatpro commented Jun 30, 2017

Hi, thanks for this exporter

after compile, i launch this :
./pgbouncer_exporter -pgBouncer.connectionString "postgres://prometheus:XXXXXX@localhost:6432/pgbouncer?sslmode=disable"

INFO[0000] Starting scrape source="collector.go:285"
INFO[0000] Starting pgbouncer exporter version: (version=, branch=, revision=) source="pgbouncer_exporter.go:49"
INFO[0006] Starting scrape source="collector.go:285"

But, on the metric page, i have this :

An error has occurred during metrics collection:

80 error(s) occurred:

  • collected metric pgbouncer_pools_cl_active label:<name:"database" value:"symfony" > gauge:<value:0 > was collected before with the same name and label values

could you help me please?

@sdanbury
Copy link

I am also having the same problem. After running the exporter like so:

$ ./pgbouncer_exporter -pgBouncer.connectionString="postgres://xxxxx:xxxxx@localhost:6432/pgbouncer?sslmode=disable"
INFO[0000] Starting scrape                               source="collector.go:285"
INFO[0000] Starting pgbouncer exporter version:  (version=0.0.3, branch=master, revision=742aaec15aa7408e5e5467b1e1e56c812bbeea34)  source="pgbouncer_exporter.go:49"

I then try and access the metrics and get the following:

$ curl localhost:9127/metrics
An error has occurred during metrics collection:

8 error(s) occurred:
* collected metric pgbouncer_pools_cl_active label:<name:"database" value:"xxxxx" > gauge:<value:1 >  was collected before with the same name and label values
* collected metric pgbouncer_pools_cl_waiting label:<name:"database" value:"xxxxx" > gauge:<value:0 >  was collected before with the same name and label values
* collected metric pgbouncer_pools_sv_active label:<name:"database" value:"xxxxx" > gauge:<value:1 >  was collected before with the same name and label values
* collected metric pgbouncer_pools_sv_idle label:<name:"database" value:"xxxxx" > gauge:<value:0 >  was collected before with the same name and label values
* collected metric pgbouncer_pools_sv_used label:<name:"database" value:"xxxxx" > gauge:<value:0 >  was collected before with the same name and label values

Any help on the matter would be greatly appreciated. Thanks!

@imatpro
Copy link
Author

imatpro commented Oct 20, 2017

I use this now : http://git.cbaines.net/prometheus-pgbouncer-exporter/
and it's work :)

@miles-
Copy link

miles- commented Dec 21, 2017

I'm also running into this issue when I try to hit the /metrics endpoint.

@ferringb
Copy link

The cause here is that the code incorrectly assumes that there will only ever be a single user for a given db. So, for example, if you have a sentry web-write and web-read user for the same DB, the pool metrics fails because the code breaks cardinality via not exposing user. Same issue exists for pool_mode, although that's a fairly esoteric config.

ferringb referenced this issue in ferringb/pgbouncer_exporter Feb 23, 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.
ferringb referenced this issue in ferringb/pgbouncer_exporter 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)
ashokraj pushed a commit to ashokraj/pgbouncer_exporter that referenced this issue May 8, 2019
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

4 participants