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

Implement multitarget pattern support #198

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

maikelpoot
Copy link

note: this is a follow-up to #182

Why this PR

We TCP load balance our connections over multiple (4+) pgbouncer instances/processes to increase stability and performance. We would like to switch from our own exporter to the prometheus-community exporter but would like to run only one exporter instance instead of an exporter per pgbouncer instance.

What does the PR do

This PR will add the option to export multiple pgbouncer instances with one exporter instance using the multitarget pattern defined by prometheus.
All the options are documented within the example config.yaml within this repo.
This config file also add the option to start the exporter even if the connection fails on startup when used in legacy mode (single-target).

Example

The probe endpoints accepts 2 parameters:

  • dsn: the postgresql connection string
  • cred: credential reference to credentials stored in the config file.

When cred is used the dsn will be updated with the credential values from the config file.
If the DSN and credentials config define the same parameter the latter takes precedence.
With the example below the exporter will scrape "postgres://username:password@localhost:6543/pgbouncer?sslmode=disable".

prometheus.yaml:

- job_name: pgbouncer-exporter
  metrics_path: /probe
  params:
    dsn: "postgres://localhost:6543/pgbouncer?sslmode=disable"
    cred: "monitoring"

config.yaml

credentials:
  - key: monitoring 
    username: username
    password: password

Signed-off-by: Maikel Poot <maikel.poot@topicus.nl>
Copy link
Contributor

@SuperQ SuperQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The metric_path and probe_path need to be removed from the configuration file.

Since these are not reloadable configurations, we want them to be command line arguments only.


## Turn on legacy mode, where the exporter scrapes a configured endpoint and exposes the metrics on the metrics_path
## Defaults to false when using config file
legacy_mode: false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be no "legacy mode". Both normal scrape and probe endpoints should be supported simultaneously.

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.

2 participants