Skip to content

Commit 0e8d9e3

Browse files
author
Pierre SOUCHAY
committed
document the new variable PG_EXPORTER_COLLECTION_TIMEOUT in the README.md
Signed-off-by: Pierre SOUCHAY <pierre.souchay@pelico.io>
1 parent f588ca8 commit 0e8d9e3

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,13 @@ The following environment variables configure the exporter:
255255
* `DATA_SOURCE_PASS_FILE`
256256
The same as above but reads the password from a file.
257257

258+
* `PG_EXPORTER_COLLECTION_TIMEOUT`
259+
Timeout duration to use when collecting the statistics, default to `1m`.
260+
When the timeout is reached, the database connection will be dropped.
261+
It avoids connections stacking when the database answers too slowly
262+
(for instance if the database creates/drop a huge table and locks the tables)
263+
and will avoid exhausting the pool of connections of the database.
264+
258265
* `PG_EXPORTER_WEB_TELEMETRY_PATH`
259266
Path under which to expose metrics. Default is `/metrics`.
260267

cmd/postgres_exporter/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ var (
5050
excludeDatabases = kingpin.Flag("exclude-databases", "A list of databases to remove when autoDiscoverDatabases is enabled (DEPRECATED)").Default("").Envar("PG_EXPORTER_EXCLUDE_DATABASES").String()
5151
includeDatabases = kingpin.Flag("include-databases", "A list of databases to include when autoDiscoverDatabases is enabled (DEPRECATED)").Default("").Envar("PG_EXPORTER_INCLUDE_DATABASES").String()
5252
metricPrefix = kingpin.Flag("metric-prefix", "A metric prefix can be used to have non-default (not \"pg\") prefixes for each of the metrics").Default("pg").Envar("PG_EXPORTER_METRIC_PREFIX").String()
53-
collectionTimeout = kingpin.Flag("collection-timeout", "Maximum duration of collection").Default("1m").Envar("PG_EXPORTER_COLLECTION_TIMEOUT").String()
53+
collectionTimeout = kingpin.Flag("collection-timeout", "Timeout for collecting the statistics when the database is slow").Default("1m").Envar("PG_EXPORTER_COLLECTION_TIMEOUT").String()
5454
logger = promslog.NewNopLogger()
5555
)
5656

0 commit comments

Comments
 (0)