avoid error when prometheus gives scientific notation (#76)

This commit is contained in:
Thibault "bui" Koechlin 2020-06-16 17:53:10 +02:00 committed by GitHub
parent 8651a1aefc
commit d6987ae8f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -62,10 +62,11 @@ func ShowPrometheus(url string) {
log.Debugf("no source in Metric")
}
value := m.(prom2json.Metric).Value
ival, err := strconv.Atoi(value)
fval, err := strconv.ParseFloat(value, 32)
if err != nil {
log.Errorf("Unexpected int value %s : %s", value, err)
}
ival := int(fval)
switch fam.Name {
/*buckets*/
case "cs_bucket_create":