mirror of
https://github.com/prometheus-community/postgres_exporter
synced 2025-04-10 19:21:25 +00:00
Parse strings to floats. fixes https://github.com/wrouesnel/postgres_exporter/issues/15
This commit is contained in:
parent
5085f2a137
commit
0830d3e098
@ -323,6 +323,13 @@ func dbToFloat64(t interface{}) (float64, bool) {
|
|||||||
return math.NaN(), false
|
return math.NaN(), false
|
||||||
}
|
}
|
||||||
return result, true
|
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:
|
case nil:
|
||||||
return math.NaN(), true
|
return math.NaN(), true
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user