From 2a8bef52350736e7fc854a3b495e6702b6d43f3f Mon Sep 17 00:00:00 2001 From: Marcus Martins Date: Thu, 5 May 2016 18:07:27 -0700 Subject: [PATCH] Handle `pg_runtime_variable` return values When querying postgres `pg_runtime_variable`, postgres might return -1 for `max_standby_archive_delay` and `max_standby_streaming_delay` --- postgres_exporter.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/postgres_exporter.go b/postgres_exporter.go index 8d2db15c..b78abad7 100644 --- a/postgres_exporter.go +++ b/postgres_exporter.go @@ -286,6 +286,10 @@ func makeDescMap(metricMaps map[string]map[string]ColumnMapping) map[string]Metr return math.NaN(), false } + if durationString == "-1" { + return math.NaN(), false + } + d, err := time.ParseDuration(durationString) if err != nil { log.Errorln("Failed converting result to metric:", columnName, in, err)