From 45b1247d9b24cc8760d56ae914492ff7c9247005 Mon Sep 17 00:00:00 2001 From: Greg <2653109+glinton@users.noreply.github.com> Date: Tue, 12 Mar 2019 20:49:19 -0600 Subject: [PATCH] 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. --- plugins/parsers/csv/parser.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/parsers/csv/parser.go b/plugins/parsers/csv/parser.go index 5f4fcc640..f8bf93e70 100644 --- a/plugins/parsers/csv/parser.go +++ b/plugins/parsers/csv/parser.go @@ -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]) }