File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed
Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -261,6 +261,7 @@ The following environment variables configure the exporter:
261261 It avoids connections stacking when the database answers too slowly
262262 (for instance if the database creates/drop a huge table and locks the tables)
263263 and will avoid exhausting the pool of connections of the database.
264+ Value of `0` or less than `1ms` is considered invalid and will report an error.
264265
265266* `PG_EXPORTER_WEB_TELEMETRY_PATH`
266267 Path under which to expose metrics. Default is `/metrics`.
Original file line number Diff line number Diff line change @@ -165,6 +165,9 @@ func WithCollectionTimeout(s string) Option {
165165 if err != nil {
166166 return err
167167 }
168+ if duration < 1 * time .Millisecond {
169+ return errors .New ("timeout must be greater than 1ms" )
170+ }
168171 e .CollectionTimeout = duration
169172 return nil
170173 }
@@ -192,6 +195,7 @@ func (p PostgresCollector) Collect(ch chan<- prometheus.Metric) {
192195}
193196
194197func (p PostgresCollector ) collectFromConnection (inst * instance , ch chan <- prometheus.Metric ) {
198+ // Eventually, connect this to the http scraping context
195199 ctx , cancel := context .WithTimeout (context .Background (), p .CollectionTimeout )
196200 defer cancel ()
197201
You can’t perform that action at this time.
0 commit comments