1
0
mirror of https://github.com/prometheus-community/postgres_exporter.git synced 2025-07-30 09:43:10 +03:00

615 Commits

Author SHA1 Message Date
77e1a0d65a Update mixin to latest changes from grafana/postgres_exporter (#1179)
* Update mixin to latest changes from grafana/postgres_exporter

Porting a bunch of PRs accumulated over time in grafana/postgres_exporter:

- https://github.com/grafana/postgres_exporter/pull/11 (@v-zhuravlev)
- https://github.com/grafana/postgres_exporter/pull/12 (@gaantunes)
- https://github.com/grafana/postgres_exporter/pull/13 (@gaantunes)
- https://github.com/grafana/postgres_exporter/pull/14 (@gaantunes)
- https://github.com/grafana/postgres_exporter/pull/15 (@gaantunes)
- https://github.com/grafana/postgres_exporter/pull/16 (@gaantunes)
- https://github.com/grafana/postgres_exporter/pull/17 (@gaantunes)
- https://github.com/grafana/postgres_exporter/pull/20 (@gaantunes)
- https://github.com/grafana/postgres_exporter/pull/21 (@mshahzeb)
- https://github.com/grafana/postgres_exporter/pull/22 (@mshahzeb)

Signed-off-by: Cristian Greco <cristian@regolo.cc>

* rename dashboard to old name

Signed-off-by: Cristian Greco <cristian@regolo.cc>

* remove custom selector

Signed-off-by: Cristian Greco <cristian@regolo.cc>

---------

Signed-off-by: Cristian Greco <cristian@regolo.cc>
Co-authored-by: Vitaly <v-zhuravlev@users.noreply.github.com>
2025-07-25 10:28:24 +02:00
06a553c816 Ensure database connections are always closed (#1177)
Signed-off-by: Sam DeHaan <sam.dehaan@grafana.com>
Signed-off-by: Sam DeHaan <dehaansa@gmail.com>
Co-authored-by: Sam DeHaan <sam.dehaan@grafana.com>
Co-authored-by: Sam DeHaan <dehaansa@gmail.com>
2025-07-18 14:53:45 -04:00
aa98bb30ef Replace another custom implementation of slices.Contains (#1180)
Followup of https://github.com/prometheus-community/postgres_exporter/pull/1176

Signed-off-by: Cristian Greco <cristian@regolo.cc>
2025-07-16 12:51:53 -04:00
cac5d5220d Update common Prometheus files (#1178)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2025-07-11 20:35:36 +02:00
dfde566f2a chore: fix a typo and use slices.Contains (#1176)
Minor fixes as I was skimming through:
- fix typo in `stat_statements`
- drop custom `sliceContains` in `database`

Signed-off-by: Cristian Greco <cristian@regolo.cc>
2025-07-11 09:31:12 +02:00
8c93ed018d Update common Prometheus files (#1174)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2025-07-10 18:46:03 +02:00
f50aac6d45 Bump github.com/prometheus/common from 0.64.0 to 0.65.0 (#1173)
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.64.0 to 0.65.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Changelog](https://github.com/prometheus/common/blob/main/RELEASE.md)
- [Commits](https://github.com/prometheus/common/compare/v0.64.0...v0.65.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-version: 0.65.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-09 11:55:58 +02:00
6d3078da35 Bump github.com/prometheus/common from 0.63.0 to 0.64.0 (#1163)
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.63.0 to 0.64.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Changelog](https://github.com/prometheus/common/blob/main/RELEASE.md)
- [Commits](https://github.com/prometheus/common/compare/v0.63.0...v0.64.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-version: 0.64.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-19 07:34:12 +02:00
f9a88f479b Update common Prometheus files (#1160)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2025-06-19 07:33:54 +02:00
d8ba628b1e Add a collector for pg_buffercache_summary. (#1165)
* Add a collector for pg_buffercache_summary()
* Requires PostgreSQL >= 16.
---------

Signed-off-by: Peter Nuttall <peter.nuttall@snowflake.com>
Co-authored-by: Ben Kochie <superq@gmail.com>
2025-06-19 07:33:22 +02:00
94e8399935 Feat: Improve Error Handling for Server.Scrape (#1158)
* Update querySettings Error Return in Scrape

If there are errors querying namespace mappings, the potential error from querySettings is obscured. Adding an immediate return if there are errors retreiving settings.

Signed-off-by: Jonathan Bowe <jonathan@bowedev.com>

* Improve Verbosity of queryNamespaceMappings Errors

Previously if any errors were encountered by queryNamespaceMappings, only a count of those errors was returned - making debugging those errors harder than it needs to be.

I'm changing this to immediately return nil if no errors are encountered, and otherwise an error will be formatted with each of the namespaces and what the error was for that namespace.

Signed-off-by: Jonathan Bowe <jonathan@bowedev.com>

* Simplify Error Message

Co-authored-by: Ben Kochie <superq@gmail.com>
Signed-off-by: Jonathan Bowe <bowejonathan99@gmail.com>

---------

Signed-off-by: Jonathan Bowe <jonathan@bowedev.com>
Signed-off-by: Jonathan Bowe <bowejonathan99@gmail.com>
Co-authored-by: Ben Kochie <superq@gmail.com>
2025-05-29 07:53:56 -04:00
d1a957f679 Update common Prometheus files (#1159)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2025-05-17 12:06:43 +02:00
de42ef7de8 Export query itself together with queryId in stat_statement metrics (#940)
* Export query itself together with queryId in stat_statement metrics
* The feature must be enabled via flag.
* Limit length of selected query.

The query is not added to every metrics, but instead of new metric stat_statement_query_id is introduced that contains mapping between queryId and query.

Fixes: #813

---------

Signed-off-by: Jakub Štiller <stiller@2n.cz>
Signed-off-by: Jakub Štiller <jakstiller@atlas.cz>
2025-05-16 10:50:19 +02:00
bd8a6135ec Bump github.com/prometheus/client_golang from 1.21.1 to 1.22.0 (#1154)
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.21.1 to 1.22.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.21.1...v1.22.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-version: 1.22.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-06 22:14:44 -04:00
5ade81cb9d Update common Prometheus files (#1155)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2025-05-06 21:54:01 -04:00
6526065fbc Bump golang.org/x/net from 0.36.0 to 0.38.0 (#1152)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.36.0 to 0.38.0.
- [Commits](https://github.com/golang/net/compare/v0.36.0...v0.38.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-version: 0.38.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-22 21:26:10 -04:00
5edc331876 Record table only size bytes as well in addition to the total size bytes (#1149)
* Record table only size bytes as well in addition to the total size bytes

Signed-off-by: Felix Yuan <felix.yuan@reddit.com>

* Update collector/pg_stat_user_tables.go

Co-authored-by: Ben Kochie <superq@gmail.com>
Signed-off-by: Felix Yuan <felix.yuan@reddit.com>

* Update collector/pg_stat_user_tables.go

Co-authored-by: Ben Kochie <superq@gmail.com>
Signed-off-by: Felix Yuan <felix.yuan@reddit.com>

* Finish renaming elements to index and table size

Signed-off-by: Felix Yuan <felix.yuan@reddit.com>

---------

Signed-off-by: Felix Yuan <felix.yuan@reddit.com>
Co-authored-by: Ben Kochie <superq@gmail.com>
2025-04-18 16:14:25 +02:00
f8b7139174 Bump github.com/prometheus/common from 0.62.0 to 0.63.0 (#1143)
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.62.0 to 0.63.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Changelog](https://github.com/prometheus/common/blob/main/RELEASE.md)
- [Commits](https://github.com/prometheus/common/compare/v0.62.0...v0.63.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-version: 0.63.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-03 18:18:17 +02:00
43576acc76 Bump github.com/prometheus/client_golang from 1.21.0 to 1.21.1 (#1144)
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.21.0 to 1.21.1.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.21.0...v1.21.1)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-version: 1.21.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-04-03 18:17:55 +02:00
8d5ec4b3ea Update Go (#1147)
* Update Go to 1.24.
* Update golangci-lint to v2.
* Fixup linting issues.

Signed-off-by: SuperQ <superq@gmail.com>
2025-04-03 17:23:40 +02:00
9e86f1ee38 Adds pg_stat_progress_vacuum collector (#1141)
Signed-off-by: Ian Bibby <ian.bibby@reddit.com>
Co-authored-by: Ben Kochie <superq@gmail.com>
2025-04-03 16:45:29 +02:00
fca2ad84cd Update common Prometheus files (#1142)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2025-03-30 14:49:06 -04:00
2ce65c324c Update common Prometheus files (#1140)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2025-03-23 16:54:21 +01:00
b0e61bf263 Bump golang.org/x/net from 0.33.0 to 0.36.0 (#1138)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.33.0 to 0.36.0.
- [Commits](https://github.com/golang/net/compare/v0.33.0...v0.36.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-16 22:34:30 +01:00
602302ffe2 Update common Prometheus files (#1137)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2025-03-08 15:00:54 +01:00
457b6fa8cd Bump github.com/prometheus/client_golang from 1.20.5 to 1.21.0 (#1133)
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.20.5 to 1.21.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.20.5...v1.21.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-03 18:26:29 +01:00
1e574cf4fd Release v0.17.1 (#1132)
* [BUGFIX] Fix: Handle incoming labels with invalid UTF-8 #1131

Signed-off-by: SuperQ <superq@gmail.com>
v0.17.1
2025-02-26 08:41:27 -05:00
2869087f3c Fix: Handle incoming labels with invalid UTF-8 (#1131)
It's possible that incoming labels will contain invalid UTF-8 characters. This results in a panic. This fix sanitizes the label's string to ensure only valid UTF-8 characters are included, by replacing invalid characters with � (REPLACEMENT CHARACTER)

Signed-off-by: Cooper Worobetz <cooper@worobetz.ca>
2025-02-26 14:21:39 +01:00
51006aba2f Prep for v0.17 (#1127)
Signed-off-by: Joe Adams <github@joeadams.io>
v0.17.0
2025-02-21 17:38:46 -05:00
8bb1a41abf Skip pg_stat_checkpointer collector if pg<17 (#1112)
* fix: skip collector if pg<17

Signed-off-by: Michael Todorovic <michael.todorovic@outlook.com>

* fix: better condition

Signed-off-by: Michael Todorovic <michael.todorovic@outlook.com>

* fix: fix PGStatCheckpointerCollector tests

Signed-off-by: Nicolas Rodriguez <nico@nicoladmin.fr>

---------

Signed-off-by: Michael Todorovic <michael.todorovic@outlook.com>
Signed-off-by: Nicolas Rodriguez <nico@nicoladmin.fr>
Co-authored-by: Michael Todorovic <michael.todorovic@outlook.com>
2025-02-19 21:49:11 -05:00
4c170ed564 Fix missing dsn sanitization for logging (#1104)
This log line was not sanitized previously which could result in logging sensitive information. I have scanned the rest of the files and I don't see anywhere else that DSN is used in a log line without this filter.

Resolves #1042

Signed-off-by: Joe Adams <github@joeadams.io>
2025-02-15 16:35:04 +01:00
99e1b5118c Bump github.com/prometheus/exporter-toolkit from 0.13.2 to 0.14.0 (#1126)
Bumps [github.com/prometheus/exporter-toolkit](https://github.com/prometheus/exporter-toolkit) from 0.13.2 to 0.14.0.
- [Release notes](https://github.com/prometheus/exporter-toolkit/releases)
- [Changelog](https://github.com/prometheus/exporter-toolkit/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prometheus/exporter-toolkit/compare/v0.13.2...v0.14.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/exporter-toolkit
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-15 10:01:47 -05:00
c3885e840a Export last replay age in replication collector (#1085)
The exported replication lag does not handle all failure modes, and can
report 0 for replicas that are out of sync and incapable of recovery.

A proper replacement for that metric would require a different approach
(see e.g. #1007), but for a lot of folks, simply exporting the age of
the last replay can provide a pretty strong signal for something being
amiss.

I think this solution might be preferable to #977, though the lag
metric needs to be fixed or abandoned eventually.

Signed-off-by: Conrad Hoffmann <ch@bitfehler.net>
2025-02-15 09:15:44 -05:00
2ee2a8fa7c feat: add wait/backend to pg_stat_activity (#1106)
Signed-off-by: Felipe Galindo Sanchez <felipe.galindo.sanchez@intel.com>
2025-02-15 09:08:24 -05:00
9e42fc0145 fix: handle pg_replication_slots on pg<13 (#1098)
* fix: handle pg_replication_slots on pg<13

Signed-off-by: Michael Todorovic <michael.todorovic@outlook.com>

* fix: tests

Signed-off-by: Michael Todorovic <michael.todorovic@outlook.com>

---------

Signed-off-by: Michael Todorovic <michael.todorovic@outlook.com>
2025-02-15 09:00:48 -05:00
072864d179 pg_stat_statements PG17 (#1114)
Signed-off-by: Nevermind <79126473+NevermindZ4@users.noreply.github.com>
2025-02-15 08:54:12 -05:00
d85a7710bf Update common Prometheus files (#1124)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2025-02-14 09:36:03 +01:00
3acc4793fc Bump github.com/prometheus/common from 0.61.0 to 0.62.0 (#1118)
Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.61.0 to 0.62.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Changelog](https://github.com/prometheus/common/blob/main/RELEASE.md)
- [Commits](https://github.com/prometheus/common/compare/v0.61.0...v0.62.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/common
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-13 03:35:38 +01:00
7d4c278221 Add Postgres 17 for CI test (#1105)
Signed-off-by: Khiem Doan <doankhiem.crazy@gmail.com>
2025-01-12 21:24:15 -05:00
9de4f19d43 Update common Prometheus files (#1110)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2025-01-07 21:20:19 +01:00
ecb5ec5dff Update common Prometheus files (#1090)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2025-01-07 09:28:42 +01:00
bea2609519 Checkpoint related columns in PG 17 have been moved from pg_stat_bgwriter to pg_stat_checkpointer (#1072)
* Checkpoint related columns in PG 17 have been moved from pg_stat_bgwriter to pg_stat_checkpointer

Fix https://github.com/prometheus-community/postgres_exporter/issues/1060

See: https://www.dbi-services.com/blog/postgresql-17-new-catalog-view-pg_stat_checkpointer/
Signed-off-by: Nicolas Rodriguez <nico@nicoladmin.fr>

* Add support for pg_stat_checkpointer

See: https://www.dbi-services.com/blog/postgresql-17-new-catalog-view-pg_stat_checkpointer/
Signed-off-by: Nicolas Rodriguez <nico@nicoladmin.fr>

* Run integration tests with Postgres 17

Signed-off-by: Nicolas Rodriguez <nico@nicoladmin.fr>

* Update date in file header

Signed-off-by: Nicolas Rodriguez <nico@nicoladmin.fr>

---------

Signed-off-by: Nicolas Rodriguez <nico@nicoladmin.fr>
2025-01-01 16:03:43 -05:00
5145620988 Bump github.com/prometheus/exporter-toolkit from 0.13.1 to 0.13.2 (#1108)
Bumps [github.com/prometheus/exporter-toolkit](https://github.com/prometheus/exporter-toolkit) from 0.13.1 to 0.13.2.
- [Release notes](https://github.com/prometheus/exporter-toolkit/releases)
- [Changelog](https://github.com/prometheus/exporter-toolkit/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prometheus/exporter-toolkit/compare/v0.13.1...v0.13.2)

---
updated-dependencies:
- dependency-name: github.com/prometheus/exporter-toolkit
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-01 18:36:32 +01:00
5bb1702321 Fix to replace dashes with underscore in the metric names (#1103)
* Fix to replace dashes with underscore in the metric names

Signed-off-by: aagarwalla-fx <arpit.agarwalla@falconx.io>

* Code style fix

Signed-off-by: aagarwalla-fx <arpit.agarwalla@falconx.io>

---------

Signed-off-by: aagarwalla-fx <arpit.agarwalla@falconx.io>
2024-12-22 16:14:19 -05:00
6f36adfadf Update pg_long_running_transactions.go (#1092)
To extract time in seconds for pg_long_running_transactions_oldest_timestamp_seconds query which currently return epoch time.

Signed-off-by: Jyothi Kiran Thammana <147131742+jyothikirant-sayukth@users.noreply.github.com>
2024-12-22 15:09:35 -05:00
a324fe37bc Fix version header in changelog (#1089)
Signed-off-by: Joe Adams <github@joeadams.io>
v0.16.0
2024-11-10 16:05:34 -05:00
4abdfa5bfd Update changelog and version for a v0.16.0 release (#1088)
Signed-off-by: Joe Adams <github@joeadams.io>
2024-11-10 15:55:46 -05:00
0045c4f93e Update common Prometheus files (#1087)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2024-11-08 19:51:27 +01:00
340a104d25 Bump github.com/prometheus/exporter-toolkit from 0.13.0 to 0.13.1 (#1081)
Bumps [github.com/prometheus/exporter-toolkit](https://github.com/prometheus/exporter-toolkit) from 0.13.0 to 0.13.1.
- [Release notes](https://github.com/prometheus/exporter-toolkit/releases)
- [Changelog](https://github.com/prometheus/exporter-toolkit/blob/master/CHANGELOG.md)
- [Commits](https://github.com/prometheus/exporter-toolkit/compare/v0.13.0...v0.13.1)

---
updated-dependencies:
- dependency-name: github.com/prometheus/exporter-toolkit
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-06 18:48:19 +01:00
c52405ab48 Update common Prometheus files (#1083)
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2024-11-06 18:47:57 +01:00