Remove warning if parse empty content (#2500)

closes #2448
This commit is contained in:
jeremydenoun
2017-03-08 23:08:55 +01:00
committed by Daniel Nelson
parent 56aa89e5c8
commit ae6a5d2255
3 changed files with 33 additions and 0 deletions

View File

@@ -44,6 +44,9 @@ func Parse(buf []byte) ([]telegraf.Metric, error) {
}
func ParseWithDefaultTime(buf []byte, t time.Time) ([]telegraf.Metric, error) {
if len(buf) == 0 {
return []telegraf.Metric{}, nil
}
if len(buf) <= 6 {
return []telegraf.Metric{}, makeError("buffer too short", buf, 0)
}