Implement multitarget pattern support #198
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 stringcred
: 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
:config.yaml