Commit Graph

17 Commits

Author SHA1 Message Date
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
Corin Lawson
3fd1c2c0eb Introduce histogram support (#435)
* Introduce histogram support

Prior to this change, the custom queries were restricted to counters and
gauges.

This change introduces a new ColumnUsage, namely HISTOGRAM, that expects
the column to contain an array of upper inclusive bounds for each
observation bucket in the emitted metric.  It also expects three more
columns to be present with the suffixes:
- `_bucket`, containing an array of cumulative counters for the
  observation buckets;
- `_sum`, the total sum of all observed values; and
- `_count`, the count of events that have been observed.

A flag has been added to the MetricMap struct to easily identify metrics
that should emit a histogram and the construction of a histogram metric
is aided by the pg.Array function and a new helper dbToUint64 function.

Finally, and example of usage is given in queries.yaml.

fixes #402

Signed-off-by: Corin Lawson <corin@responsight.com>

* Introduces tests for histogram support

Prior to this change, the histogram support was untested.

This change introduces a new integration test that reads a user query
containing a number of histogram metrics.  Also, additional checks have
been added to TestBooleanConversionToValueAndString to test dbToUint64.

Signed-off-by: Corin Lawson <corin@responsight.com>
2020-12-25 02:34:26 +11:00
Ben Kochie
3864bbc9cd Update queries.yml (#433)
Update query for pg_stat_user_tables:
* Split up to multi-line format to make it easier to read.
* Remove duplicate of column `COALESCE(last_vacuum, '1970-01-01Z')`.

Signed-off-by: Ben Kochie <superq@gmail.com>
2020-12-25 02:26:58 +11:00
Mike
e2df41f43e Fix queries for awsrds (#370)
* excluding rolname 'rdsadmin' in pg_stat_statements

* notes on using postgres-exporter with AWS:RDS
2020-04-10 01:16:22 +10:00
Daniel Binkhuysen
81f9c78d61 fix pg_database_size_bytes metric in queries.yaml (#357)
Co-authored-by: Will Rouesnel <wrouesnel@wrouesnel.com>
2020-02-25 22:57:22 +11:00
sfalkon
deac1c37db fix master database behavior 2019-11-20 10:18:20 +11:00
Will Rouesnel
bb0870c562 Rename pg_database_size to pg_database_size_bytes 2019-11-01 00:29:32 +11:00
Will Rouesnel
698fdb7873 Add pg_stat_statements to sample queries.yml file. 2019-11-01 00:29:32 +11:00
Will Rouesnel
34fdb69ee2 Add support for optional namespace caching. (#319)
In the user queries.yml file, the created namespaces can now be optionally
cached by setting cache_seconds, which will prevent the query being re-run
within that timeframe if previous results are available.

Supercedes #211, credit to @SamSaffron for the original PR.
2019-11-01 00:17:31 +11:00
Wolfgang Schnerring
b33c2f9349 Provide more helpful default values for tables that have never been vacuumed (#310)
Returning a (long gone) timestamp does the right thing for alerting
PromQL queries ("alert if older than"), while `NaN` is rather intractable.
2019-10-30 14:55:48 +11:00
Rick van Hattem
486345d8fd No need to truncate replication lag to integers 2019-07-01 08:44:04 +10:00
Daniel Bäurer
42f9de480a Added pg_statio_user_tables 2018-09-22 15:48:36 +10:00
Giancarlo Rubio
1afbd62ab1 Sample for database size (#76) 2017-07-26 22:53:16 +10:00
Adam Sunderland
1fa394d488 Remove pg_settings query examples
These fields are now automatically scraped so they will conflict if they are accidentally specified.
2017-04-24 00:01:39 -10:00
Nick Cabatoff
511ef0eacd fix a bug in the query to fetch shared_buffers setting 2016-09-07 16:55:41 -04:00
Nick Cabatoff
64f5d9ac0f Document -extend.query-path in README. Add more examples to queries.yaml. 2016-09-07 15:15:52 -04:00
Reda NOUSHI
1d383291eb Add sample queries file 2016-06-28 23:57:13 +00:00