Now that we have deprecated extended queries we can deprecate related
database features.
* Deprecate flags/functions around auto discover databases.
* Deprecate flags/functions for additional constant labels.
Signed-off-by: SuperQ <superq@gmail.com>
Adds support for the alternate postgres:// prefix in URLs. It's maybe
not the cleanest approach, but works. Hoping I can either get some
pointers on a more appropriate patch, or that we could use this in the
interim to unblock this use-case.
Signed-off-by: Jack Wink <57678801+mothershipper@users.noreply.github.com>
Since we support both multi-target and typical direct scrapes, either of these can fail and it is no longer an error.
Signed-off-by: Joe Adams <github@joeadams.io>
Updates the exporter-toolkit to the latest version
* Adds new landing page feature.
* Allow metrics path to be on `/`.
Signed-off-by: SuperQ <superq@gmail.com>
* Update Go to 1.20.
* Update golanci-lint.
* Bump modules.
* Update CI orb.
* Fix up use of deprecated ioutil.
Signed-off-by: SuperQ <superq@gmail.com>
The pg_database collector was not respecting the --exclude-databases flag and causing problems where databases were not accessible. This now respects the list of databases to exclude.
- Adjusts the Collector create func to take a config struct instead of a logger. This allows more changes like this in the future. I figured we would need to do this at some point but I wasn't sure if we could hold off.
- Split the database size collection to a separate query when database is not excluded.
- Comment some probe code that was not useful/accurate
Signed-off-by: Joe Adams <github@joeadams.io>
Update to the latest exporter-toolkit
* Enables multi-listener and systemd socket activation.
* Bump Go to 1.19.
* Remove `PG_EXPORTER_WEB_LISTEN_ADDRESS` env var because this is now a
repeatable flag.
Signed-off-by: SuperQ <superq@gmail.com>
It is necessary to be able to exclude backups from long-running
transaction alerts, as they are to be expected. With the current
pg_stat_activity metric there is no ability to filter out
specific users or application names.
Resolves#668
Signed-off-by: cezmunsta <github@incoming-email.co.uk>
- Moves new dsn type to config.DSN. This will prevent circular dependencies.
- Change DSN.query to be url.Values. This allows the multi-target functionality to merge values without re-parsing the query string
- Change NewProbeCollector to use the new config.DSN type
- Add DSN.GetConnectionString to return a string formatted for the sql driver to use during connection
Signed-off-by: Joe Adams <github@joeadams.io>
BREAKING CHANGES:
This release changes support for multiple postgres servers to use the
multi-target exporter pattern. This makes it much easier to monitor multiple
PostgreSQL servers from a single exporter by passing the target via URL
params. See the Multi-Target Support section of the README.
* [CHANGE] Add multi-target support #618
* [BUGFIX] Add dsn type for handling datasources #678
Signed-off-by: SuperQ <superq@gmail.com>
dsn is designed to replace the other uses of dsn as a string in the long term. dsn is designed to be safe to log, properly redacting passwords. The goal is eventually always parse datasource information into a dsn type object which can safely be passed around and logged without worrying about wrapping calls in a redaction function (today this function is loggableDSN().
This should solve the root issue in #648, #677, and #643, although the full fix will require more changes to update all code references over to use the dsn type.
Signed-off-by: Joe Adams <github@joeadams.io>
The config module supports adding configuration to the exporter via a config file. This supports adding authentication details in a config file so that /probe requests can specify authentication for endpoints
Signed-off-by: Joe Adams <github@joeadams.io>
* Update to Go 1.18.
* Update minimum Go version to 1.17.
* Update Go modules for 1.17 format.
* Bump Go modules
* Enable dependabot.
* Update Prometheus common files.
* Fixup yamllint.
Signed-off-by: SuperQ <superq@gmail.com>
This moves the metrics that are queried from pg_stat_bgwriter into a dedicated collector instead of dynamically generating queries and metrics from a map. It renames some metrics including adding the `_total` suffix on all of the counters to match prometheus standards. This implementation uses QueryRowContext to allow for later addition of context for cancellation. From the Postgres documentation, it states that there is one line per WAL sender process, but it is unclear how to differentiate between them in any meaningful way. When querying the table, there is no column to identify the row, only metrics about bgwriter.
Signed-off-by: Joe Adams <github@joeadams.io>
Converts the pg_database metrics from queries.yaml to a built in collector. This is enabled by default because it is not likely to be a performance problem and likely very useful data.
Signed-off-by: Joe Adams <github@joeadams.io>