Skip to content

Commit

Permalink
SECCOMP-27660: Fix vulnerabilities with upstream repo changes (#95)
Browse files Browse the repository at this point in the history
* Dashboard linting improvements for mixin

Signed-off-by: Ryan J. Geyer <me@ryangeyer.com>

* Convert pg_stat_database to new collector model

Signed-off-by: Joe Adams <github@joeadams.io>

* 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 prometheus-community#668

Signed-off-by: cezmunsta <github@incoming-email.co.uk>

* Fixed formatting

Signed-off-by: cezmunsta <github@incoming-email.co.uk>

* Update common Prometheus files

Signed-off-by: prombot <prometheus-team@googlegroups.com>

* probe: clean-up database connection after probe to prevent connection leak

Signed-off-by: Kurtis Bass <kurtis.bass@hinge.co>

* Set gauge to 1 when collector is successful

Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
Signed-off-by: Khiem Doan <doankhiem.crazy@gmail.com>

* Add postgres 15 for CI test

Signed-off-by: Khiem Doan <doankhiem.crazy@gmail.com>

* Add postgres 15 for CI test

Signed-off-by: Khiem Doan <doankhiem.crazy@gmail.com>

* New unit value 64kB

Signed-off-by: Oleksandr Mysyura <olexandr.mysyura@pragmaticplay.com>

* Update common Prometheus files

Signed-off-by: prombot <prometheus-team@googlegroups.com>

* 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>

* go fmt

Signed-off-by: SuperQ <superq@gmail.com>

* adding codified functionality for logical replication metrics

Signed-off-by: Zachary Caldarola <zachary.caldarola@reddit.com>

* Bump github.com/prometheus/client_golang from 1.13.0 to 1.14.0

Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.13.0 to 1.14.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](prometheus/client_golang@v1.13.0...v1.14.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>

* Bump github.com/prometheus/common from 0.37.0 to 0.39.0

Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.37.0 to 0.39.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](prometheus/common@v0.37.0...v0.39.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>

* addressing comments

Signed-off-by: Zachary Caldarola <zachary.caldarola@reddit.com>

* more comments

Signed-off-by: Zachary Caldarola <zmc2005@gmail.com>

* fmt

Signed-off-by: Zachary Caldarola <zmc2005@gmail.com>

* typing

Signed-off-by: Zachary Caldarola <zmc2005@gmail.com>

* fmt

Signed-off-by: Zachary Caldarola <zmc2005@gmail.com>

* send stdout/stderr to syslog

Signed-off-by: Mike <gavrikster@gmail.com>

* Update common Prometheus files

Signed-off-by: prombot <prometheus-team@googlegroups.com>

* 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>

* Remove commented code

Signed-off-by: Joe Adams <github@joeadams.io>

* Remove more dead code

Signed-off-by: Joe Adams <github@joeadams.io>

* 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>

* Reduce cardinality of pg_stat_statements

Make the example queries.yaml `pg_stat_statements` query safer.
* Select the top 10% of queries by total query time.
* Only expose the top 100 queries by total query time.
* Keep only the most useful metrics.
* Comment out the example by default.

Fixes: prometheus-community#549

Signed-off-by: SuperQ <superq@gmail.com>

* Update changelog and version for v0.12.0 release

Signed-off-by: Joe Adams <github@joeadams.io>

* 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>

* Update common Prometheus files

Signed-off-by: prombot <prometheus-team@googlegroups.com>

* Fix column type for pg_replication_slots

Change the data type of `active` from int64 to bool. The documentation confirms that this is a boolean field.
https://www.postgresql.org/docs/current/view-pg-replication-slots.html

fixes prometheus-community#769

Signed-off-by: Joe Adams <github@joeadams.io>

* Update versions listed in the README

Update the supported versions based on what we actually test in CI.

Signed-off-by: SuperQ <superq@gmail.com>

* Update README cli flags

These have not been kept up to date.

Signed-off-by: Joe Adams <github@joeadams.io>

* 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>

* Fix pg_setting different help values

Signed-off-by: GitHub <noreply@github.com>

* 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>

* Bump github.com/lib/pq from 1.10.7 to 1.10.9

Bumps [github.com/lib/pq](https://github.com/lib/pq) from 1.10.7 to 1.10.9.
- [Release notes](https://github.com/lib/pq/releases)
- [Commits](lib/pq@v1.10.7...v1.10.9)

---
updated-dependencies:
- dependency-name: github.com/lib/pq
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Refactor collector descriptors

Use individual collector metric descriptor vars to help avoid
miss-mapped or unused metrics.

Signed-off-by: SuperQ <superq@gmail.com>

* Bump github.com/prometheus/common from 0.42.0 to 0.44.0

Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.42.0 to 0.44.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](prometheus/common@v0.42.0...v0.44.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>

* Update linting

* Move errcheck exclude list to config file.
* Enable revive linter
* Fix up revive linting issues.

Signed-off-by: SuperQ <superq@gmail.com>

* Bump github.com/prometheus/exporter-toolkit from 0.9.1 to 0.10.0

Bumps [github.com/prometheus/exporter-toolkit](https://github.com/prometheus/exporter-toolkit) from 0.9.1 to 0.10.0.
- [Release notes](https://github.com/prometheus/exporter-toolkit/releases)
- [Changelog](https://github.com/prometheus/exporter-toolkit/blob/master/CHANGELOG.md)
- [Commits](prometheus/exporter-toolkit@v0.9.1...v0.10.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>

* Move queries from queries.yaml to collectors (prometheus-community#801)

Signed-off-by: Ben Kochie <superq@gmail.com>

* Fix pg_stat_database collector

The signature for creating a collector changed and CI didn't retrigger. Move metrics out of map and into individual vars.

Signed-off-by: Joe Adams <github@joeadams.io>

* Fix up collector registration (prometheus-community#812)

Use const definitions to make collector registration consistent.
* Use collector subsystem name consistently.
* Fix up replication metric name unit.

Signed-off-by: SuperQ <superq@gmail.com>

* Update release info for v0.12.1

Signed-off-by: Joe Adams <github@joeadams.io>

* Deprecate extend queries feature (prometheus-community#811)

Mark the extend queries feature as deprecated in favor of recommending
the sql_exporter.

Signed-off-by: SuperQ <superq@gmail.com>

* Update common Prometheus files

Signed-off-by: prombot <prometheus-team@googlegroups.com>

* 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>

* Release v0.13.0

BREAKING CHANGES:

Please note, the following features are deprecated and may be removed in a future release:
- `auto-discover-databases`
- `extend.query-path`
- `constantLabels`
- `exclude-databases`
- `include-databases`

This exporter is meant to monitor PostgresSQL servers, not the user data/databases. If
you need a generic SQL report exporter https://github.com/burningalchemist/sql_exporter
is recommended.

* [CHANGE] Adjust log level for collector startup prometheus-community#784
* [CHANGE] Move queries from queries.yaml to collectors prometheus-community#801
* [CHANGE] Deprecate extend queries feature prometheus-community#811
* [CHANGE] Deprecate additional database features prometheus-community#815
* [CHANGE] Convert pg_stat_database to new collector prometheus-community#685
* [ENHANCEMENT] Supports alternate postgres:// prefix in URLs prometheus-community#787
* [BUGFIX] Fix pg_setting different help values prometheus-community#771
* [BUGFIX] Fix column type for pg_replication_slots prometheus-community#777
* [BUGFIX] Fix pg_stat_database collector prometheus-community#809

Signed-off-by: SuperQ <superq@gmail.com>

* Add the instance struct to handle connections

The intent is to use the instance struct to hold the connection to the database as well as metadata about the instance. Currently this metadata only includes the version of postgres for the instance which can be used in the collectors to decide what query to run. In the future this could hold more metadata but for now it keeps the Collector interface arguments to a reasonable number.

Signed-off-by: Joe Adams <github@joeadams.io>

* chore: fix a few typos

Signed-off-by: Alex Tymchuk <alexander.tymchuk@percona.com>

* Bug fix: Make collector not fail on null values (prometheus-community#823)

* Make all values nullable

---------

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

* Release 0.13.1 (prometheus-community#824)

* [BUGFIX] Make collectors not fail on null values prometheus-community#823

Signed-off-by: SuperQ <superq@gmail.com>

* Fixed replication pgReplicationSlotQuery - now it's working correctly for replica and primary (prometheus-community#825)

Signed-off-by: Vadim Voitenko <vadim.voitenko@exness.com>
Co-authored-by: Vadim Voitenko <vadim.voitenko@exness.com>

* Migrate pg_locks to collector package (prometheus-community#817)

Migrate the `pg_locks_count` query from `main` to the `collector`
package.

Signed-off-by: SuperQ <superq@gmail.com>

* Cleanup collectors (prometheus-community#826)

Fix up `replication` and `process_idle` Update input params to match
the rest of the collectors.

Signed-off-by: SuperQ <superq@gmail.com>

* Bug Fix: Fix lingering type issues (prometheus-community#828)

* Fix postmaster type issue
* Disable postmaster collector by default

---------

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

* Update common Prometheus files (prometheus-community#829)

Signed-off-by: prombot <prometheus-team@googlegroups.com>

* Fix replication collector

Signed-off-by: Tom Hughes <tom@compton.nu>

* Add some more escapes to the query sanitizer

Signed-off-by: Tom Hughes <tom@compton.nu>

* Add a collector to gather metrics on WAL size

Signed-off-by: Tom Hughes <tom@compton.nu>

* Bump github.com/prometheus/client_golang from 1.15.1 to 1.16.0 (prometheus-community#853)

Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.15.1 to 1.16.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](prometheus/client_golang@v1.15.1...v1.16.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>

* Fix untyped integer overflows on 32-bit archs (prometheus-community#857)

go-sqlmock's Rows.AddRow() takes values which have a type alias of
"any", and appear to default to untyped ints if not explicitly cast.
When large values are passed which would overflow int32, tests fail.

Signed-off-by: Daniel Swarbrick <daniel.swarbrick@gmail.com>

* Bump github.com/smartystreets/goconvey from 1.8.0 to 1.8.1 (prometheus-community#852)

Bumps [github.com/smartystreets/goconvey](https://github.com/smartystreets/goconvey) from 1.8.0 to 1.8.1.
- [Release notes](https://github.com/smartystreets/goconvey/releases)
- [Commits](smartystreets/goconvey@v1.8.0...v1.8.1)

---
updated-dependencies:
- dependency-name: github.com/smartystreets/goconvey
  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>

* Unpack postgres arrays for process idle times correctly (prometheus-community#855)

Signed-off-by: Ben Kochie <superq@gmail.com>

* Include all idle processes in the process idle metrics

Signed-off-by: Tom Hughes <tom@compton.nu>

* Improve linting (prometheus-community#861)

* Disable unused-parameter check due to false positives on Collect()
  calls.
* Enable misspell.
* Simplify error returns.

Signed-off-by: SuperQ <superq@gmail.com>

* Update common Prometheus files (prometheus-community#860)

Signed-off-by: prombot <prometheus-team@googlegroups.com>
Co-authored-by: Ben Kochie <superq@gmail.com>

* Update common Prometheus files

Signed-off-by: prombot <prometheus-team@googlegroups.com>

* Gitlab collector: Database wraparound collector and test (prometheus-community#834)

* Database wraparound collector and test

---------

Signed-off-by: Felix Yuan <felix.yuan@reddit.com>
Co-authored-by: Joe Adams <github@joeadams.io>

* Add a logger to stat_database collector to get better handle on error
(also clean up some metric validity checks)

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

* Update changelog for release 0.13.2 (prometheus-community#872)

Signed-off-by: Joe Adams <github@joeadams.io>

* Gitlab Collector: Autovacuum collector and test (prometheus-community#840)

* Autovacuum collector and test

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

* Update collector/pg_stat_activity_autovacuum.go

Co-authored-by: Joe Adams <github@joeadams.io>
Signed-off-by: Felix Yuan <felix.yuan@reddit.com>

* Update collector/pg_stat_activity_autovacuum.go

Co-authored-by: Joe Adams <github@joeadams.io>
Signed-off-by: Felix Yuan <felix.yuan@reddit.com>

* Use timestamp seconds

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

* query formating

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

* SQL format

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

* Loosen autovacuum query

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

---------

Signed-off-by: Felix Yuan <felix.yuan@reddit.com>
Co-authored-by: Joe Adams <github@joeadams.io>

* Gitlab Collector: Wal Receiver Collector and Test (prometheus-community#844)

* Wal Receiver Collector and Test

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

* Add more escapes

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

* Corrections to wal_receiver

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

* Continue on null labels

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

* Skip nulls and log a message

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

* Redundant breaks

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

* Fix up walreceiver

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

* Remove extra label

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

* Update collector/pg_stat_walreceiver.go

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

* Clean up the extra assignments

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

* Update collector/pg_stat_walreceiver.go

Co-authored-by: Joe Adams <github@joeadams.io>
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>
Co-authored-by: Joe Adams <github@joeadams.io>

* Gitlab collector: Xlog location collector and test (prometheus-community#849)

* Xlog location collector and test

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

* Add more escapes

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

* Change to Gauge

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

---------

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

* Handle new pg_stat_statements column names (prometheus-community#874)

Update pg_stat_statements collector to handle the new column names in
PostgreSQL 13.

Fixes: prometheus-community#502

Signed-off-by: SuperQ <superq@gmail.com>

* Fixup new pg_stats_statements query (prometheus-community#876)

Fix all renames of `total_time` to `total_exec_time`.

Fixes: prometheus-community#502

Signed-off-by: SuperQ <superq@gmail.com>

* Add a multi-target example config (prometheus-community#890)

Add an example Prometheus scrape config, similar to the
blackbox_exporter's example config.

Fixes: prometheus-community#888

Signed-off-by: SuperQ <superq@gmail.com>

* Delay database connection until scrape (prometheus-community#882)

This no longer returns an error when creating a collector.instance when the database cannot be reached for the version query. This will resolve the entire postgresCollector not being registered for metrics collection when a database is not available. If the version query fails, the scrape will fail.

Resolves prometheus-community#880

Signed-off-by: Joe Adams <github@joeadams.io>

* Bugfix: Make statsreset nullable (prometheus-community#877)

* Stats_reset as null seems to actually be legitimate for new databases,
so don't fail for it

---------

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

* Gitlab Collector: User Index io stats collector and test (prometheus-community#845)

* User Index io stats collector and test

---------

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

* Update README to reflect changes made in prometheus-community#828 (prometheus-community#894)

Signed-off-by: Mathis Raguin <mathis.raguin@gitguardian.com>

* Gitlab Collector: Long running transactions collector and test (prometheus-community#836)

* Long running transactions collector and test

---------

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

* Update common Prometheus files (prometheus-community#900)

Signed-off-by: prombot <prometheus-team@googlegroups.com>

* Fix a connection leak (prometheus-community#902)

The leak was introduced in PR#882

Signed-off-by: Christian Albrecht <cal@albix.de>
Co-authored-by: Christian Albrecht <christian.albrecht@akquinet.de>

* Fix cross-compilation command in README.md (prometheus-community#903)

Signed-off-by: David Cook <dcook@divviup.org>

* fix pg_replication_lag_seconds (prometheus-community#895)

Signed-off-by: Vladimir Luksha <waldemarluksha@gmail.com>
Co-authored-by: Vladimir Luksha <luksha@limcore.io>

* stat_user_tables: Add total size metric (prometheus-community#904)

Signed-off-by: David Cook <dcook@divviup.org>

* Fix bugs mentioned in prometheus-community#908 (prometheus-community#910)

* Fix bugs mentioned in prometheus-community#908

These collectors are disabled by default, so unless enabled, they are not tested regularly.

Signed-off-by: Joe Adams <github@joeadams.io>

---------

Signed-off-by: Joe Adams <github@joeadams.io>

* Update common Prometheus files (prometheus-community#913)

Signed-off-by: prombot <prometheus-team@googlegroups.com>

* Add changelog for v0.14 (prometheus-community#906)

* Add changelog for v0.14

- Add changelog entries since v0.13.2
- Update README with new options
- Bump version file

Signed-off-by: Joe Adams <github@joeadams.io>

* Add changelog entry for prometheus-community#904

Signed-off-by: Joe Adams <github@joeadams.io>

---------

Signed-off-by: Joe Adams <github@joeadams.io>

* Adds 1kB and 2kB units (prometheus-community#915)

Signed-off-by: Eric tyrrell <eric.tyrrell18+github@gmail.com>

* Add error log when probe collector creation fails (prometheus-community#918)

Signed-off-by: Joe Adams <github@joeadams.io>

* Fix test build failures on 32-bit arch again (prometheus-community#919)

Another case of untyped integer overflows on 32-bit arch.

Signed-off-by: Daniel Swarbrick <daniel.swarbrick@gmail.com>

* Add 32-bit testing to CI (prometheus-community#920)

Run Go tests with 32-bit to validate value overflow.

Signed-off-by: SuperQ <superq@gmail.com>

* Bump github.com/prometheus/client_golang from 1.16.0 to 1.17.0 (prometheus-community#925)

* Bump github.com/prometheus/client_golang from 1.16.0 to 1.17.0

Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](prometheus/client_golang@v1.16.0...v1.17.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>

* Update tests for latest client_golang.

Signed-off-by: SuperQ <superq@gmail.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: SuperQ <superq@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: SuperQ <superq@gmail.com>

* Update common Prometheus files (prometheus-community#926)

Signed-off-by: prombot <prometheus-team@googlegroups.com>

* Adjust collector to use separate connection per scrape (prometheus-community#931)

Fixes prometheus-community#921

Signed-off-by: Joe Adams <github@joeadams.io>

* Bump golang.org/x/net from 0.10.0 to 0.17.0 (prometheus-community#936)

Bumps [golang.org/x/net](https://github.com/golang/net) from 0.10.0 to 0.17.0.
- [Commits](golang/net@v0.10.0...v0.17.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>

* Release v0.15.0 (prometheus-community#944)

* [ENHANCEMENT] Add 1kB and 2kB units prometheus-community#915
* [BUGFIX] Add error log when probe collector creation fails prometheus-community#918
* [BUGFIX] Fix test build failures on 32-bit arch prometheus-community#919
* [BUGFIX] Adjust collector to use separate connection per scrape prometheus-community#936

Signed-off-by: SuperQ <superq@gmail.com>

* Update common Prometheus files (prometheus-community#951)

Signed-off-by: prombot <prometheus-team@googlegroups.com>

* Update common Prometheus files (prometheus-community#963)

Signed-off-by: prombot <prometheus-team@googlegroups.com>

* pg_replication_slot: add slot type label (prometheus-community#960)

Signed-off-by: Alex Simenduev <shamil.si@gmail.com>

* Bump github.com/prometheus/common from 0.44.0 to 0.45.0 (prometheus-community#948)

Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.44.0 to 0.45.0.
- [Release notes](https://github.com/prometheus/common/releases)
- [Commits](prometheus/common@v0.44.0...v0.45.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>

* Bump github.com/prometheus/client_model (prometheus-community#949)

Bumps [github.com/prometheus/client_model](https://github.com/prometheus/client_model) from 0.4.1-0.20230718164431-9a2bf3000d16 to 0.5.0.
- [Release notes](https://github.com/prometheus/client_model/releases)
- [Commits](https://github.com/prometheus/client_model/commits/v0.5.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_model
  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>

* pg_stat_database: added support for `active_time` counter (prometheus-community#961)

* feat(pg_stat_database): active time metric

---------

Signed-off-by: Jiri Sveceny <jiri.sveceny@icloud.com>

* Bump golang.org/x/crypto from 0.14.0 to 0.17.0 (prometheus-community#988)

Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.14.0 to 0.17.0.
- [Commits](golang/crypto@v0.14.0...v0.17.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump github.com/prometheus/client_golang from 1.17.0 to 1.18.0 (prometheus-community#993)

Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.17.0 to 1.18.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](prometheus/client_golang@v1.17.0...v1.18.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>

* use Info level for excluded databases log message (prometheus-community#1003)

This is the only log message which didn't specify a level in the
postgres_exporter. I am unsure if this log message should be info or
debug, but leaning towards the more important since previously it would
just always log.

The way I validated this was the only non-leveled logger was via grep.
Both of these only returned this callsite previously:

  git grep 'logger\.Log'
  git grep '\.Log(' | grep -v level

Signed-off-by: Keegan Carruthers-Smith <keegan.csmith@gmail.com>

---------

Signed-off-by: Ryan J. Geyer <me@ryangeyer.com>
Signed-off-by: Joe Adams <github@joeadams.io>
Signed-off-by: cezmunsta <github@incoming-email.co.uk>
Signed-off-by: prombot <prometheus-team@googlegroups.com>
Signed-off-by: Kurtis Bass <kurtis.bass@hinge.co>
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
Signed-off-by: Khiem Doan <doankhiem.crazy@gmail.com>
Signed-off-by: Oleksandr Mysyura <olexandr.mysyura@pragmaticplay.com>
Signed-off-by: SuperQ <superq@gmail.com>
Signed-off-by: Zachary Caldarola <zachary.caldarola@reddit.com>
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Zachary Caldarola <zmc2005@gmail.com>
Signed-off-by: Mike <gavrikster@gmail.com>
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Jack Wink <57678801+mothershipper@users.noreply.github.com>
Signed-off-by: Ben Kochie <superq@gmail.com>
Signed-off-by: Alex Tymchuk <alexander.tymchuk@percona.com>
Signed-off-by: Felix Yuan <felix.yuan@reddit.com>
Signed-off-by: Vadim Voitenko <vadim.voitenko@exness.com>
Signed-off-by: Tom Hughes <tom@compton.nu>
Signed-off-by: Daniel Swarbrick <daniel.swarbrick@gmail.com>
Signed-off-by: Mathis Raguin <mathis.raguin@gitguardian.com>
Signed-off-by: Christian Albrecht <cal@albix.de>
Signed-off-by: David Cook <dcook@divviup.org>
Signed-off-by: Vladimir Luksha <waldemarluksha@gmail.com>
Signed-off-by: Eric tyrrell <eric.tyrrell18+github@gmail.com>
Signed-off-by: Alex Simenduev <shamil.si@gmail.com>
Signed-off-by: Jiri Sveceny <jiri.sveceny@icloud.com>
Signed-off-by: Keegan Carruthers-Smith <keegan.csmith@gmail.com>
Co-authored-by: Ryan J. Geyer <me@ryangeyer.com>
Co-authored-by: Joe Adams <github@joeadams.io>
Co-authored-by: cezmunsta <github@incoming-email.co.uk>
Co-authored-by: prombot <prometheus-team@googlegroups.com>
Co-authored-by: Kurtis Bass <kurtis.bass@hinge.co>
Co-authored-by: Julien Pivotto <roidelapluie@o11y.eu>
Co-authored-by: Khiem Doan <doankhiem.crazy@gmail.com>
Co-authored-by: Oleksandr Mysyura <olexandr.mysyura@pragmaticplay.com>
Co-authored-by: Ben Kochie <superq@gmail.com>
Co-authored-by: Zachary Caldarola <zachary.caldarola@reddit.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Zachary Caldarola <zmc2005@gmail.com>
Co-authored-by: Mike <gavrikster@gmail.com>
Co-authored-by: Khaled Khalifa <33331600+khkhalifa@users.noreply.github.com>
Co-authored-by: Jack Wink <57678801+mothershipper@users.noreply.github.com>
Co-authored-by: Felix Yuan <felix.yuan@reddit.com>
Co-authored-by: Alex Tymchuk <alexander.tymchuk@percona.com>
Co-authored-by: Vadim Voitenko <74241416+wwoytenko@users.noreply.github.com>
Co-authored-by: Vadim Voitenko <vadim.voitenko@exness.com>
Co-authored-by: Tom Hughes <tom@compton.nu>
Co-authored-by: Daniel Swarbrick <daniel.swarbrick@gmail.com>
Co-authored-by: Mathis Raguin <evaelis.market@gmail.com>
Co-authored-by: Christian Albrecht <cal@albix.de>
Co-authored-by: Christian Albrecht <christian.albrecht@akquinet.de>
Co-authored-by: David Cook <divergentdave@gmail.com>
Co-authored-by: Vladimir Luksha <waldemarluksha@gmail.com>
Co-authored-by: Vladimir Luksha <luksha@limcore.io>
Co-authored-by: David Cook <dcook@divviup.org>
Co-authored-by: Eric Tyrrell <58529434+Eric-Tyrrell22@users.noreply.github.com>
Co-authored-by: Alex Simenduev <shamil.si@gmail.com>
Co-authored-by: Jiri Sveceny <jiri.sveceny@icloud.com>
Co-authored-by: Keegan Carruthers-Smith <keegan.csmith@gmail.com>
  • Loading branch information
1 parent 257176f commit 1bd39e8
Show file tree
Hide file tree
Showing 66 changed files with 6,041 additions and 1,185 deletions.
12 changes: 7 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,28 @@
version: 2.1

orbs:
prometheus: prometheus/prometheus@0.16.0
prometheus: prometheus/prometheus@0.17.1

executors:
# This must match .promu.yml.
golang:
docker:
- image: cimg/go:1.18
- image: cimg/go:1.21

jobs:
test:
executor: golang

steps:
- prometheus/setup_environment
- run: GOHOSTARCH=386 GOARCH=386 make test
- run: make
- prometheus/store_artifact:
file: postgres_exporter

integration:
docker:
- image: cimg/go:1.18
- image: cimg/go:1.20
- image: << parameters.postgres_image >>
environment:
POSTGRES_DB: circle_test
Expand Down Expand Up @@ -56,11 +57,12 @@ workflows:
matrix:
parameters:
postgres_image:
- circleci/postgres:10
- circleci/postgres:11
- circleci/postgres:12
- circleci/postgres:13
- cimg/postgres:14.1
- cimg/postgres:14.9
- cimg/postgres:15.4
- cimg/postgres:16.0
- prometheus/build:
name: build
parallelism: 3
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
# This action is synced from https://github.com/prometheus/prometheus
name: golangci-lint
on:
push:
Expand All @@ -16,15 +18,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: install Go
uses: actions/setup-go@v4
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
with:
go-version: 1.18.x
go-version: 1.21.x
- name: Install snmp_exporter/generator dependencies
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
if: github.repository == 'prometheus/snmp_exporter'
- name: Lint
uses: golangci/golangci-lint-action@v3.4.0
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
with:
version: v1.52.2
version: v1.54.2
15 changes: 14 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
---
linters:
enable:
- misspell
- revive

issues:
exclude-rules:
- path: _test.go
Expand All @@ -7,4 +12,12 @@ issues:

linters-settings:
errcheck:
exclude: scripts/errcheck_excludes.txt
exclude-functions:
# Never check for logger errors.
- (github.com/go-kit/log.Logger).Log
revive:
rules:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter
- name: unused-parameter
severity: warning
disabled: true
3 changes: 1 addition & 2 deletions .promu.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
go:
# This must match .circle/config.yml.
version: 1.18
version: 1.21
repository:
path: github.com/prometheus-community/postgres_exporter
build:
binaries:
- name: postgres_exporter
path: ./cmd/postgres_exporter
flags: -a -tags 'netgo static_build'
ldflags: |
-X github.com/prometheus/common/version.Version={{.Version}}
-X github.com/prometheus/common/version.Revision={{.Revision}}
Expand Down
7 changes: 1 addition & 6 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,4 @@ rules:
config/testdata/section_key_dup.bad.yml
line-length: disable
truthy:
ignore: |
.github/workflows/codeql-analysis.yml
.github/workflows/funcbench.yml
.github/workflows/fuzzing.yml
.github/workflows/prombench.yml
.github/workflows/golangci-lint.yml
check-keys: false
68 changes: 66 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,66 @@
## master / unreleased
## 0.15.0 / 2023-10-27

## 0.12.0-rc.0 / 2022-08-26
* [ENHANCEMENT] Add 1kB and 2kB units #915
* [BUGFIX] Add error log when probe collector creation fails #918
* [BUGFIX] Fix test build failures on 32-bit arch #919
* [BUGFIX] Adjust collector to use separate connection per scrape #936

## 0.14.0 / 2023-09-11

* [CHANGE] Add `state` label to pg_process_idle_seconds #862
* [CHANGE] Change database connections to one per scrape #882 #902
* [ENHANCEMENT] Add wal collector #858
* [ENHANCEMENT] Add database_wraparound collector #834
* [ENHANCEMENT] Add stat_activity_autovacuum collector #840
* [ENHANCEMENT] Add stat_wal_receiver collector #844
* [ENHANCEMENT] Add xlog_location collector #849
* [ENHANCEMENT] Add statio_user_indexes collector #845
* [ENHANCEMENT] Add long_running_transactions collector #836
* [ENHANCEMENT] Add pg_stat_user_tables_size_bytes metric #904
* [BUGFIX] Fix tests on 32-bit systems #857
* [BUGFIX] Fix pg_stat_statements metrics on Postgres 13+ #874 #876
* [BUGFIX] Fix pg_stat_database metrics for NULL stats_reset #877
* [BUGFIX] Fix pg_replication_lag_seconds on Postgres 10+ when master is idle #895

## 0.13.2 / 2023-07-21

* [BUGFIX] Fix type issues on pg_postmaster metrics #828
* [BUGFIX] Fix pg_replication collector instantiation #854
* [BUGFIX] Fix pg_process_idle metrics #855

## 0.13.1 / 2023-06-27

* [BUGFIX] Make collectors not fail on null values #823

## 0.13.0 / 2023-06-21

BREAKING CHANGES:

Please note, the following features are deprecated and may be removed in a future release:
- `auto-discover-databases`
- `extend.query-path`
- `constantLabels`
- `exclude-databases`
- `include-databases`

This exporter is meant to monitor PostgresSQL servers, not the user data/databases. If
you need a generic SQL report exporter https://github.com/burningalchemist/sql_exporter
is recommended.

* [CHANGE] Adjust log level for collector startup #784
* [CHANGE] Move queries from queries.yaml to collectors #801
* [CHANGE] Deprecate extend queries feature #811
* [CHANGE] Deprecate additional database features #815
* [CHANGE] Convert pg_stat_database to new collector #685
* [ENHANCEMENT] Supports alternate postgres:// prefix in URLs #787
* [BUGFIX] Fix pg_setting different help values #771
* [BUGFIX] Fix column type for pg_replication_slots #777
* [BUGFIX] Fix pg_stat_database collector #809

## 0.12.1 / 2023-06-12
* [BUGFIX] Fix column type for pg_replication_slots #777

## 0.12.0 / 2023-03-21

BREAKING CHANGES:

Expand All @@ -10,7 +70,11 @@ 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
* [CHANGE] Add usename and application_name to pg_stat_activity metrics #673
* [FEATURE] Add replication metrics from pg_replication_slots #747
* [BUGFIX] Add dsn type for handling datasources #678
* [BUGFIX] Add 64kB unit for postgres 15 #740
* [BUGFIX] Add 4kB unit for postgres compiled with small blocks #699

## 0.11.1 / 2022-08-01

Expand Down
22 changes: 12 additions & 10 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,19 @@ endif
GOTEST := $(GO) test
GOTEST_DIR :=
ifneq ($(CIRCLE_JOB),)
ifneq ($(shell which gotestsum),)
ifneq ($(shell command -v gotestsum > /dev/null),)
GOTEST_DIR := test-results
GOTEST := gotestsum --junitfile $(GOTEST_DIR)/unit-tests.xml --
endif
endif

PROMU_VERSION ?= 0.13.0
PROMU_VERSION ?= 0.15.0
PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz

SKIP_GOLANGCI_LINT :=
GOLANGCI_LINT :=
GOLANGCI_LINT_OPTS ?=
GOLANGCI_LINT_VERSION ?= v1.49.0
GOLANGCI_LINT_VERSION ?= v1.54.2
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64.
# windows isn't included here because of the path separator being different.
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
Expand Down Expand Up @@ -91,6 +91,8 @@ BUILD_DOCKER_ARCHS = $(addprefix common-docker-,$(DOCKER_ARCHS))
PUBLISH_DOCKER_ARCHS = $(addprefix common-docker-publish-,$(DOCKER_ARCHS))
TAG_DOCKER_ARCHS = $(addprefix common-docker-tag-latest-,$(DOCKER_ARCHS))

SANITIZED_DOCKER_IMAGE_TAG := $(subst +,-,$(DOCKER_IMAGE_TAG))

ifeq ($(GOHOSTARCH),amd64)
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux freebsd darwin windows))
# Only supported on amd64
Expand Down Expand Up @@ -176,7 +178,7 @@ endif
.PHONY: common-yamllint
common-yamllint:
@echo ">> running yamllint on all YAML files in the repository"
ifeq (, $(shell which yamllint))
ifeq (, $(shell command -v yamllint > /dev/null))
@echo "yamllint not installed so skipping"
else
yamllint .
Expand Down Expand Up @@ -205,7 +207,7 @@ common-tarball: promu
.PHONY: common-docker $(BUILD_DOCKER_ARCHS)
common-docker: $(BUILD_DOCKER_ARCHS)
$(BUILD_DOCKER_ARCHS): common-docker-%:
docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" \
docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)" \
-f $(DOCKERFILE_PATH) \
--build-arg ARCH="$*" \
--build-arg OS="linux" \
Expand All @@ -214,19 +216,19 @@ $(BUILD_DOCKER_ARCHS): common-docker-%:
.PHONY: common-docker-publish $(PUBLISH_DOCKER_ARCHS)
common-docker-publish: $(PUBLISH_DOCKER_ARCHS)
$(PUBLISH_DOCKER_ARCHS): common-docker-publish-%:
docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)"
docker push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)"

DOCKER_MAJOR_VERSION_TAG = $(firstword $(subst ., ,$(shell cat VERSION)))
.PHONY: common-docker-tag-latest $(TAG_DOCKER_ARCHS)
common-docker-tag-latest: $(TAG_DOCKER_ARCHS)
$(TAG_DOCKER_ARCHS): common-docker-tag-latest-%:
docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:latest"
docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:v$(DOCKER_MAJOR_VERSION_TAG)"
docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:latest"
docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(SANITIZED_DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:v$(DOCKER_MAJOR_VERSION_TAG)"

.PHONY: common-docker-manifest
common-docker-manifest:
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create -a "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" $(foreach ARCH,$(DOCKER_ARCHS),$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$(ARCH):$(DOCKER_IMAGE_TAG))
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)"
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create -a "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(SANITIZED_DOCKER_IMAGE_TAG)" $(foreach ARCH,$(DOCKER_ARCHS),$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$(ARCH):$(SANITIZED_DOCKER_IMAGE_TAG))
DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(SANITIZED_DOCKER_IMAGE_TAG)"

.PHONY: promu
promu: $(PROMU)
Expand Down
Loading

0 comments on commit 1bd39e8

Please sign in to comment.