delete nil fields in the metric maker.

closes #1771
This commit is contained in:
Cameron Sparr
2016-10-07 18:12:36 +01:00
parent 03b2984ac2
commit 8ca4a50c18
2 changed files with 31 additions and 2 deletions

View File

@@ -81,6 +81,9 @@ func makemetric(
// Validate uint64 and float64 fields
// convert all int & uint types to int64
switch val := v.(type) {
case nil:
// delete nil fields
delete(fields, k)
case uint:
fields[k] = int64(val)
continue
@@ -127,9 +130,9 @@ func makemetric(
delete(fields, k)
continue
}
default:
fields[k] = v
}
fields[k] = v
}
var m telegraf.Metric