Use valid measurement names in csv parser (#5577)

If an empty column is present in parsed csv data, a `recordFields` is
set to the key of "". If no `MeasurementColumn` is defined, this empty
value was being used as the measurement name. By only setting the
measurementName if the value is not empty, we avoid this error.

Since an empty column is a valid column, skip values must account for
them.
This commit is contained in:
Greg 2019-03-12 20:49:19 -06:00 committed by Daniel Nelson
parent 2a0ae10940
commit 45b1247d9b
1 changed files with 1 additions and 1 deletions

View File

@ -204,7 +204,7 @@ outer:
// will default to plugin name
measurementName := p.MetricName
if recordFields[p.MeasurementColumn] != nil {
if recordFields[p.MeasurementColumn] != nil && recordFields[p.MeasurementColumn] != "" {
measurementName = fmt.Sprintf("%v", recordFields[p.MeasurementColumn])
}