You've already forked postgres_exporter
mirror of
https://github.com/prometheus-community/postgres_exporter.git
synced 2025-06-16 04:40:57 +03:00
Parse strings to floats. fixes https://github.com/wrouesnel/postgres_exporter/issues/15
This commit is contained in:
@ -323,6 +323,13 @@ func dbToFloat64(t interface{}) (float64, bool) {
|
||||
return math.NaN(), false
|
||||
}
|
||||
return result, true
|
||||
case string:
|
||||
result, err := strconv.ParseFloat(v, 64)
|
||||
if err != nil {
|
||||
log.Println("Could not parse string:", err)
|
||||
return math.NaN(), false
|
||||
}
|
||||
return result, true
|
||||
case nil:
|
||||
return math.NaN(), true
|
||||
default:
|
||||
|
Reference in New Issue
Block a user