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

Expose config metrics #93

Conversation

kenneth-duffel
Copy link
Contributor

Config metrics are not currently not exposed
by the exporter. These metrics are used in some
existing dashboards.

Config metrics being exposed:

  • max_client_conn: pgbouncer_config_max_client_conn
  • max_user_connections: pgbouncer_config_max_user_connections

Signed-off-by: kenneth-duffel 93927344+kenneth-duffel@users.noreply.github.com

@kenneth-duffel
Copy link
Contributor Author

@stanhu and @SuperQ 👋
Can I get a review on this addition please 🙏 .
My team recently started using this exporter and we thought it would be good to add this so some of our dashboards are complete.

README.md Outdated Show resolved Hide resolved
kenneth-duffel and others added 2 commits January 20, 2023 09:47
Config metrics are not currently not exposed
by the exporter. These metrics are used in some
existing dashboards.

Config metrics being exposed:
- max_client_conn: pgbouncer_config_max_client_conn
- max_user_connections: pgbouncer_config_max_user_connections

Signed-off-by: kenneth-duffel <93927344+kenneth-duffel@users.noreply.github.com>
Signed-off-by: kenneth-duffel <kenneth@duffel.com>
Following a PR comment, this updates the metric name
to a preferred name.

Signed-off-by: kenneth-duffel <kenneth@duffel.com>
@kenneth-duffel kenneth-duffel force-pushed the kenneth-duffel/expose-config-metrics branch from 451819f to f579834 Compare January 20, 2023 09:56
@kenneth-duffel
Copy link
Contributor Author

@SuperQ and @stanhu I have updated the name as per your recommendations. Please review 🙏

@kenneth-duffel kenneth-duffel requested review from stanhu, SuperQ and waltfy and removed request for stanhu, SuperQ and waltfy January 20, 2023 10:52
@SuperQ SuperQ requested a review from stanhu January 24, 2023 12:26
@kenneth-duffel
Copy link
Contributor Author

Thanks you

@SuperQ SuperQ requested review from sysadmind and removed request for sysadmind January 26, 2023 15:19
@SuperQ SuperQ merged commit b72ab16 into prometheus-community:master Jan 26, 2023
@alex1989hu
Copy link

alex1989hu commented Jan 26, 2023

Dear @SuperQ and @kenneth-duffel I have been using pgbouncer_exporter for ages. I have just rebuilt it from master branch and I see in the logs:

{"caller":"collector.go:474","err":"error retrieving columns list from SHOW CONFIG:  <nil>\n","level":"error","msg":"error getting SHOW CONFIG","ts":"2023-01-26T18:51:11.176Z"}

I have PgBouncer 1.17.0 where I have more than 3 colums:

pgbouncer=# SHOW CONFIG;
            key            |                         value                         |                        default                         | changeable
---------------------------+-------------------------------------------------------+--------------------------------------------------------+------------

It should be at least 3, or do I miss something?

columnNames, err := rows.Columns()
if err != nil || len(columnNames) != 3 {
return errors.New(fmt.Sprintln("error retrieving columns list from SHOW CONFIG: ", err))
}

UPDATE: I found it, so the code expects these 3 columns in this order but I have default column as well before the changeabl value

var key string
var values sql.RawBytes
var changeable string

Based on the documentation (https://www.pgbouncer.org/usage.html) there are 4 columns:

SHOW CONFIG
Show the current configuration settings, one per row, with the following columns:

key
  Configuration variable name
value
  Configuration value
default
  Configuration default value
changeable
  Either yes or no, shows if the variable can be changed while running. If no, the variable can be changed only at boot time. 
Use SET to change a variable at run time.

SuperQ added a commit that referenced this pull request Jan 27, 2023
* [FEATURE] Add config metrics #93
* [FEATURE] Add TLS and Basic auth to the metrics endpoint #101

Signed-off-by: SuperQ <superq@gmail.com>
@SuperQ SuperQ mentioned this pull request Jan 27, 2023
SuperQ added a commit that referenced this pull request Jan 30, 2023
* [FEATURE] Add config metrics #93
* [FEATURE] Add TLS and Basic auth to the metrics endpoint #101

Signed-off-by: SuperQ <superq@gmail.com>
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

Successfully merging this pull request may close these issues.

5 participants