Commit Graph

123 Commits

Author SHA1 Message Date
Joe Adams
30d7d25a7e
Add error log when probe collector creation fails (#918)
Signed-off-by: Joe Adams <github@joeadams.io>
2023-09-21 07:13:14 -04:00
Eric Tyrrell
e3eaa91c0b
Adds 1kB and 2kB units (#915)
Signed-off-by: Eric tyrrell <eric.tyrrell18+github@gmail.com>
2023-09-19 21:40:29 -04:00
Ben Kochie
1a4e8993f6
Migrate pg_locks to collector package (#817)
Migrate the `pg_locks_count` query from `main` to the `collector`
package.

Signed-off-by: SuperQ <superq@gmail.com>
2023-06-27 15:59:30 +02:00
Alex Tymchuk
b070e45349
chore: fix a few typos
Signed-off-by: Alex Tymchuk <alexander.tymchuk@percona.com>
2023-06-23 16:42:59 +03:00
SuperQ
c71d395bf6
Deprecate additional database features
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>
2023-06-19 13:05:57 +02:00
Ben Kochie
7dcf1dc7b6
Deprecate extend queries feature (#811)
Mark the extend queries feature as deprecated in favor of recommending
the sql_exporter.

Signed-off-by: SuperQ <superq@gmail.com>
2023-06-13 17:39:39 +02:00
Joe Adams
4d41f89f0c
Merge pull request #685 from sysadmind/pg-stat-database
Convert pg_stat_database to new collector model
2023-06-12 19:25:46 -04:00
SuperQ
fab8e625a8
Update linting
* Move errcheck exclude list to config file.
* Enable revive linter
* Fix up revive linting issues.

Signed-off-by: SuperQ <superq@gmail.com>
2023-06-03 09:28:17 +02:00
Jack Wink
0c04fc1d1e
Supports alternate postgres:// prefix in URLs
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>
2023-04-24 09:17:05 -07:00
Khaled Khalifa
20b1b75e64
Fix pg_setting different help values
Signed-off-by: GitHub <noreply@github.com>
2023-04-16 11:29:12 +00:00
Joe Adams
ac05e0bdce
Adjust log level for collector startup
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>
2023-03-29 20:15:41 -04:00
SuperQ
de1c3cc5e7
Update exporter-toolkit
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>
2023-03-21 08:23:23 +01:00
SuperQ
0e654d8f83
Update build
* 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>
2023-03-05 22:20:50 +01:00
Joe Adams
55263868e0
Remove more dead code
Signed-off-by: Joe Adams <github@joeadams.io>
2023-03-05 15:30:18 -05:00
Joe Adams
8d6ce0558c Remove commented code
Signed-off-by: Joe Adams <github@joeadams.io>
2023-03-05 15:18:23 -05:00
Joe Adams
799f3e15b2 Fix exclude-databases for collector package
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>
2023-03-05 15:13:00 -05:00
Joe Adams
36773e06dc
Merge pull request #673 from cezmunsta/pg_stat_activity-enhancements
Capture usename and application_name for pg_stat_activity
2023-02-12 15:08:39 -05:00
Joe Adams
94a89b0166
Merge pull request #734 from kjbass/master
Close DB connection after probe completes.
2023-02-12 14:52:50 -05:00
Ben Kochie
0e4506e3f4
Merge pull request #746 from prometheus-community/bjk/exporter-toolkit-bump
Update exporter-toolkit
2023-01-25 09:31:55 +01:00
SuperQ
b1e72a981b
go fmt
Signed-off-by: SuperQ <superq@gmail.com>
2023-01-24 18:18:17 +01:00
SuperQ
fc264d0ab0
Update exporter-toolkit
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>
2023-01-24 17:57:31 +01:00
Oleksandr Mysyura
8ff0e5aa70 New unit value 64kB
Signed-off-by: Oleksandr Mysyura <olexandr.mysyura@pragmaticplay.com>
2023-01-04 12:14:29 +02:00
Kurtis Bass
76223cdda8 probe: clean-up database connection after probe to prevent connection leak
Signed-off-by: Kurtis Bass <kurtis.bass@hinge.co>
2022-12-14 14:30:13 -05:00
Julien Pivotto
5fcceb4105 Set gauge to 1 when collector is successful
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
2022-11-24 14:02:37 +01:00
Joe Adams
34d3605788
Merge pull request #683 from preved911/fix/extend_probe_path_metrics
Extending /probe path metrics
2022-10-31 20:51:30 -04:00
Sergey Morozov
14c9d0370f
4kB size added for postgres with 4kB block_size
Signed-off-by: Sergey Morozov <38383507+ken3122@users.noreply.github.com>
2022-10-09 01:50:45 +06:00
cezmunsta
d9ac4be429
Fixed formatting
Signed-off-by: cezmunsta <github@incoming-email.co.uk>
2022-10-04 13:18:22 +01:00
cezmunsta
6937685907
Capture usename and application_name for pg_stat_activity
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>
2022-10-04 13:18:22 +01:00
Ildar Valiullin
ad8b5608f8 extended /probe path metrics
Signed-off-by: Ildar Valiullin <preved.911@gmail.com>
2022-09-03 14:33:13 +03:00
Joe Adams
73b0b42c8d
Convert pg_stat_database to new collector model
Signed-off-by: Joe Adams <github@joeadams.io>
2022-09-02 12:24:25 -04:00
Joe Adams
7ffba684de
Update multi-target handler to use new DSN type
- 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>
2022-09-02 10:32:44 -04:00
Yoan Blanc
9ae347519b
fix: typo
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2022-08-30 06:48:06 +02:00
SuperQ
d86dd06ffe
Release 0.12.0-rc.0
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>
2022-08-26 16:49:54 +02:00
Joe Adams
de9d21df6a
Add dsn type for handling datasources
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>
2022-08-24 22:07:37 -04:00
Joe Adams
72430f8d2a Update cmd/postgres_exporter/main.go
Signed-off-by: Joe Adams <github@joeadams.io>
2022-07-28 10:21:02 -04:00
Joe Adams
8f8d2208f5 cleanup and README
Signed-off-by: Joe Adams <github@joeadams.io>

Co-authored-by: Ben Kochie <superq@gmail.com>
2022-07-28 10:19:32 -04:00
Joe Adams
cc751b7966 Add config module
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>
2022-07-28 10:19:32 -04:00
Joe Adams
713461df98 WIP: Add prelim multi-target support
- Remove multi server support from new collector package
- Add http handler for multi-target support

Signed-off-by: Joe Adams <github@joeadams.io>
2022-07-28 10:19:32 -04:00
SuperQ
81c4933986
Update build
* 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>
2022-05-25 11:27:42 +02:00
Angus Dippenaar
be30859417 Remove unit from setting because of Aurora
Signed-off-by: Angus Dippenaar <angusdippenaar@gmail.com>
2022-03-03 15:55:35 +01:00
Joe Adams
9704b9fb2e
Clean up autoDiscoverDatabases in the new collector
Signed-off-by: Joe Adams <github@joeadams.io>
2022-02-25 08:11:22 -05:00
Joe Adams
27d23d02ef
refactor pg_stat_bgwriter metrics into standalone collector
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>
2022-02-22 21:46:43 -05:00
Joe Adams
c3b0206369
Add collector interface
Uses node_exporter style collector registration

Signed-off-by: Joe Adams <github@joeadams.io>
2022-02-14 21:12:27 -05:00
Joe Adams
21a19ed252
Add pg_database collector
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>
2022-02-09 21:28:40 -05:00
Joe Adams
3880df4f64
Merge pull request #587 from credativ/azure-ff-fix
Avoid parsing error from bogus Azure Flexible Server custom GUC
2022-02-09 15:30:32 -05:00
pitan
adaa0b5e32
Merge branch 'prometheus-community:master' into fix/pg_stat_archiver-version 2022-01-17 17:04:00 +09:00
Daniel Swarbrick
99f0b4c63c
Fix misspelling of PostgreSQL
Signed-off-by: Daniel Swarbrick <daniel.swarbrick@gmail.com>
2022-01-16 19:55:11 +01:00
SuperQ
fcb2535aff
Release 0.10.1
* [BUGFIX] Fix broken log-level for values other than debug. #560

Signed-off-by: SuperQ <superq@gmail.com>
2022-01-14 17:27:06 +01:00
t-inoue
21c9b0d80d change version for pg_stat_archiver
Signed-off-by: t-inoue <t-inoue@sakura.ad.jp>
2022-01-11 13:48:48 +09:00
Michael Banck
5d6e42935d Avoid parsing error from bogus Azure Flexible Server custom GUC
Signed-off-by: Michael Banck <michael.banck@credativ.de>
2021-11-20 19:37:29 +01:00