Commit Graph

300 Commits

Author SHA1 Message Date
Joe Adams
d9eb99555b
Adjust comment to WARNING
Signed-off-by: Joe Adams <github@joeadams.io>
2021-07-15 21:54:39 -04:00
Joe Adams
cd98cf7c33
Add a warning for pg_stat_statements
This metric can be very expensive to store in prometheus and has the potential to create an unreasonably large cardinality set of metrics so warn the user.

Signed-off-by: Joe Adams <github@joeadams.io>
2021-07-15 21:51:25 -04:00
Ben Kochie
57719ba53c
Merge pull request #555 from sysadmind/release-v0.10.0
Release v0.10.0
2021-07-09 13:37:56 +02:00
Joe Adams
820c05b747
Revert go version change
Signed-off-by: Joe Adams <github@joeadams.io>
2021-07-08 09:31:06 -04:00
Joe Adams
7fdb019811
Bump date for release
Signed-off-by: Joe Adams <github@joeadams.io>
2021-07-08 09:16:57 -04:00
Joe Adams
c6632ab1e4
Rollback lib/pq to v1.10.1 for illumos compatability
Signed-off-by: Joe Adams <github@joeadams.io>
2021-07-07 16:54:36 -04:00
Joe Adams
08fd458df0
Update dependencies and fix tests
Signed-off-by: Joe Adams <github@joeadams.io>
2021-07-07 09:52:56 -04:00
Joe Adams
59623d5709
Release v0.10.0
Signed-off-by: Joe Adams <github@joeadams.io>
2021-07-06 21:36:32 -04:00
Ben Kochie
df461c2f9a
Merge pull request #552 from sysadmind/refactor-files
Refactor code into logical files
2021-07-04 18:03:31 +02:00
Joe Adams
bc981e66c3 Refactor code into logical files
Moves code into more manageable, logical files to group behavior together. This should help improve a developer's ability to navigate the code.

Signed-off-by: Joe Adams <github@joeadams.io>
2021-07-01 16:49:08 -04:00
Ben Kochie
134e908885
Merge pull request #537 from halvaborsch/halvaborsch-replication-slot-patch-1
Fix replication_slot query all supported versions
2021-06-10 11:27:16 +02:00
Dmitry F
29f6fa1891 Fix replication_slot query all supported versions
Signed-off-by: Филатов Дмитрий <d.filatov@2gis.ru>
2021-06-01 18:59:35 +07:00
Ben Kochie
e43b9767f9
Merge pull request #525 from desaintmartin/master
fix examples queries: change idle process metric name in order not to override built-in pg_stat_activity.
2021-05-10 09:01:02 +02:00
Cédric de Saint Martin
9804c6069c fix examples queries: change idle process metric name in order not to override built-in pg_stat_activity.
Signed-off-by: Cédric de Saint Martin <cdesaintmartin@wiremind.fr>
2021-04-28 13:32:36 +02:00
Ben Kochie
677d38bc5d
Merge pull request #521 from pvanderlinden/fix-auto-discovery
fix parsing include databases
2021-04-19 15:34:53 +02:00
Paul van der Linden
bc97291103 basic integration test
Signed-off-by: Paul van der Linden <mail@paultjuh.org>
2021-04-19 15:20:53 +02:00
Paul van der Linden
ffa6782e41 fix parsing include databases
Signed-off-by: Paul van der Linden <mail@paultjuh.org>
2021-04-17 12:05:28 +02:00
Ben Kochie
cbc6ae3c59
Merge pull request #519 from prometheus-community/superq/issue_template
Add GitHub issue templates
2021-04-15 20:57:17 +02:00
Ben Kochie
6549456a5e
Merge pull request #520 from prometheus-community/repo_sync
Synchronize common files from prometheus/prometheus
2021-04-15 09:12:07 +02:00
prombot
230d762ee6 Update common Prometheus files
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2021-04-15 00:02:11 +00:00
Ben Kochie
ef5851b80f
Add GitHub issue templates
Add templates to point users towards the community support channels.

Signed-off-by: Ben Kochie <superq@gmail.com>
2021-04-12 09:31:34 +02:00
Ben Kochie
1dc210476e
Merge pull request #506 from prometheus-community/repo_sync
Synchronize common files from prometheus/prometheus
2021-03-25 17:19:18 +01:00
Ben Kochie
64f0e9c654
Add NOTICE file with copyright information.
Signed-off-by: Ben Kochie <superq@gmail.com>
2021-03-25 10:49:50 +01:00
prombot
c1d8a8454b
Update common Prometheus files
Signed-off-by: prombot <prometheus-team@googlegroups.com>
2021-03-25 10:46:14 +01:00
Ben Kochie
bf920d4f7c
Merge pull request #507 from prometheus-community/superq/update_build
Update build
2021-03-25 10:45:38 +01:00
Ben Kochie
0ea46e882b
Update build
* Add MAINTAINERS.md file.
* Bump to Go 1.16.
* Update promu version.

Signed-off-by: Ben Kochie <superq@gmail.com>
2021-03-25 10:25:36 +01:00
Ben Kochie
c51a28f5f0
Merge pull request #499 from weastur/allow_databases_param
Add ability to set allow DBs list
2021-03-11 15:37:56 +01:00
Pavel Sapezhko
2850ac800a
Add ability to set allow DBs list
Signed-off-by: Pavel Sapezhko <me@weastur.com>
2021-03-11 16:43:13 +03:00
Ben Kochie
5c660bac37
Merge pull request #494 from prometheus-community/superq/version_info
Fix version flag
2021-03-03 18:01:46 +01:00
Ben Kochie
283a2a3de7
Merge pull request #449 from kavirajk/grafana_mixin
feat(mixin): Add grafana mixins support for postgres exporter
2021-03-03 15:33:00 +01:00
Ben Kochie
a7e88ab430
Fix version flag
Use Prometheus common/version to print --version output.
* Add `-h` short help flag.

Fixes: https://github.com/prometheus-community/postgres_exporter/issues/492

Signed-off-by: Ben Kochie <superq@gmail.com>
2021-03-03 13:51:44 +01:00
Ben Kochie
f86ccd6cf1
Merge pull request #491 from roidelapluie/switch-to-go-kit
Switch to go-kit log and enable TLS/Basic auth
2021-03-03 13:19:38 +01:00
Julien Pivotto
be790e12ff Switch to go-kit log and enable TLS/basic auth
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-03-02 15:31:55 +01:00
Kaviraj
2d6996bc31 Add templating for job, instance and datasource
Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
2021-03-02 13:52:42 +01:00
Kaviraj
51225e1733 feat(mixin): Add grafana mixins support for postgres exporter
Signed-off-by: Kaviraj <kavirajkanagaraj@gmail.com>
2021-03-02 13:18:59 +01:00
Ben Kochie
21f27a8e03
Merge pull request #489 from prometheus-community/superq/remove_v
Remove v from changelog tags
2021-03-01 13:49:33 +01:00
Ben Kochie
2e8928828c
Remove v from changelog tags
Attempt 2 to fixup CHANGELOG for promu release.

Signed-off-by: Ben Kochie <superq@gmail.com>
2021-03-01 13:48:14 +01:00
Ben Kochie
5c386e31aa
Merge pull request #488 from prometheus-community/superq/fix_changelog_dates
Add dates to changelog entries
2021-03-01 13:26:33 +01:00
Ben Kochie
b0b1d7c8ba
Add dates to changelog entries
Fixes release publishing.

```bash
list=$(git tag | grep '^v' | sort -rV)
for v in $list ; do
  ts=$(git rev-list -n 1 --pretty --date=format:'%Y-%m-%d' $v | awk '$1 == "Date:" {print $2}')
  echo "## $v / $ts"
done
```

Signed-off-by: Ben Kochie <superq@gmail.com>
2021-03-01 12:07:55 +01:00
Ben Kochie
fc0202159c
Merge pull request #485 from prometheus-community/superq/0.9.0
Release 0.9.0
2021-03-01 11:16:14 +01:00
Ben Kochie
41b2fcd17f
Release 0.9.0
* Add CHANGELOG from existing tags.

First release under the Prometheus Community organisation.

* [CHANGE] Update build to use standard Prometheus promu/Dockerfile
* [ENHANCEMENT] Remove duplicate column in queries.yml #433
* [ENHANCEMENT] Add query for 'pg_replication_slots' #465
* [ENHANCEMENT] Allow a custom prefix for metric namespace #387
* [ENHANCEMENT] Improve PostgreSQL replication lag detection #395
* [ENHANCEMENT] Support connstring syntax when discovering databases #473
* [ENHANCEMENT] Detect SIReadLock locks in the pg_locks metric #421
* [BUGFIX] Fix pg_database_size_bytes metric in queries.yaml #357
* [BUGFIX] Don't ignore errors in parseUserQueries #362
* [BUGFIX] Fix queries.yaml for AWS RDS #370
* [BUGFIX] Recover when connection cannot be established at startup #415
* [BUGFIX] Don't retry if an error occurs #426
* [BUGFIX] Do not panic on incorrect env #457

Signed-off-by: Ben Kochie <superq@gmail.com>
2021-03-01 10:24:26 +01:00
Ben Kochie
f26ca65a80
Merge pull request #486 from prometheus-community/bjk/integration_tests
Add integration tests
2021-03-01 10:23:16 +01:00
Ben Kochie
33e61f3277
Add integration tests
Setup integration test matrix in CircleCI.
* Update README integration testing list.

Signed-off-by: Ben Kochie <superq@gmail.com>
2021-02-28 14:26:51 +01:00
Ben Kochie
c1ddbee8a5
Merge pull request #480 from prometheus-community/superq/community
Update for Prometheus Community
2021-02-26 14:59:00 +01:00
Ben Kochie
b67b69acd3
Update for Prometheus Community
Add standard Prometheus build setup
* CircleCI config
* Makefile
* Go modules
* Golang-CI Lint
* promu config
* Remove /vendor
* Remove mage build
* Update READMEs

https://github.com/prometheus-community/postgres_exporter/issues/478

Signed-off-by: Ben Kochie <superq@gmail.com>
2021-02-23 10:51:33 +01:00
Neel Patel
8531abac46
User defined configuration to run the query for different database server version from single yml file (#428)
* Run the query for specific database version if provided from yml file.
By default query will run on all the databases if "runonserver" is not provided.

If user want the query to be run on multiple database versions, use below string.
  runonserver: "9.5, 9.6"

Example yml file as below. ( e.g. below query will run only on database version 9.5 )

pg_replication:
  query: "SELECT EXTRACT(EPOCH FROM (now() - pg_last_xact_replay_timestamp())) as lag"
  master: true
  runonserver: "9.5"
  metrics:
    - lag:
        usage: "GAUGE"
        description: "Replication lag behind master in seconds"

* Fixed the below review comments given by Ashesh Vashi

    Instead of having db version string from yml file, user can define the range of
    database server version where query is to be executed.

    If user want to run the query on database version greater than 10.0.0, use below format.
      runonserver: ">=10.0.0"

      Below are the example of db version range user can defined in yml file.
            <=10.1.0
            >=12.1.0
            =11.0.0
            <9.6.0 || >=11.0.0

* Remove the call from unused places where 'runOnServer' is not required.
Only Server type hold that value.

* Fix compilation issues.

* Fix the issue with Debugln to print the database server version
2021-02-18 01:04:12 +11:00
Ollie Charles
301976c218
Detect SIReadLock locks in the pg_locks metric (#421)
Co-authored-by: Will Rouesnel <wrouesnel@wrouesnel.com>
2021-01-31 22:22:18 +11:00
Ivan Shapovalov
1ba1100a72
Support connstring syntax when discovering databases (#473)
* Support connstring syntax when discovering databases

Support connstring DSNs (`host=... user=... password=... dbname=...`) in
addition to URIs (`postgresql://user:pass@host/dbname`) for purposes of
database discovery.

Connstring syntax is needed to support accessing PostgreSQL via Unix
domain sockets (`host=/run/postgres`), which is not really possible with
URI syntax.

* Appease gometalinter, don't shadow namespace
2021-01-31 22:21:38 +11:00
Yann Soubeyrand
aea6fae7d6
Recover when connection cannot be established straight at startup (#415)
When the connection to the PostgreSQL instance cannot be established straight
at startup, a race condition can happen when autoDiscoverDatabases is true. If
discoverDatabaseDSNs fails, no dsn is set as the master database, and, if
scrapeDSN succeeds, checkMapVersions will have omitted the default metrics in
the server metric map. The metric map won't be updated unless the version
returned by the PostgreSQL instance changes. With this patch, scrapeDSN won't
be run unless discoverDatabaseDSNs succeeded and thus the race condition is
eliminated.

Signed-off-by: Yann Soubeyrand <yann.soubeyrand@camptocamp.com>
2020-12-25 02:41:05 +11:00
Jakov Sosic
f188bdef53
Improve PostgreSQL replication lag detection (#395)
In some cases master can show pg_last_xact_replay_timestamp() from past,
which can cause the exporter to show ever-growing value for the lag.

By checking if the instance is in recovery we can avoid reporting some
huge number for master instance.
2020-12-25 02:39:43 +11:00