1
0
mirror of https://github.com/prometheus-community/postgres_exporter.git synced 2025-08-09 15:42:47 +03:00

Merge pull request #17 from jinty/string-to-flaot

Parse strings to floats
This commit is contained in:
Will Rouesnel
2016-07-30 11:44:17 +10:00
committed by GitHub

View File

@@ -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: