diff --git a/app/vmagent/influx/request_handler.go b/app/vmagent/influx/request_handler.go index b39d365f3..9da1be933 100644 --- a/app/vmagent/influx/request_handler.go +++ b/app/vmagent/influx/request_handler.go @@ -96,7 +96,8 @@ func insertRows(db string, rows []parser.Row, extraLabels []prompbmarshal.Label) if !*skipMeasurement { ctx.metricGroupBuf = append(ctx.metricGroupBuf, r.Measurement...) } - skipFieldKey := len(r.Fields) == 1 && *skipSingleField + // See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1139 + skipFieldKey := len(r.Measurement) > 0 && len(r.Fields) == 1 && *skipSingleField if len(ctx.metricGroupBuf) > 0 && !skipFieldKey { ctx.metricGroupBuf = append(ctx.metricGroupBuf, *measurementFieldSeparator...) } diff --git a/app/vminsert/influx/request_handler.go b/app/vminsert/influx/request_handler.go index 4e4e17c28..784c2c3ec 100644 --- a/app/vminsert/influx/request_handler.go +++ b/app/vminsert/influx/request_handler.go @@ -96,7 +96,8 @@ func insertRows(db string, rows []parser.Row, extraLabels []prompbmarshal.Label) if !*skipMeasurement { ctx.metricGroupBuf = append(ctx.metricGroupBuf, r.Measurement...) } - skipFieldKey := len(r.Fields) == 1 && *skipSingleField + // See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1139 + skipFieldKey := len(r.Measurement) > 0 && len(r.Fields) == 1 && *skipSingleField if len(ctx.metricGroupBuf) > 0 && !skipFieldKey { ctx.metricGroupBuf = append(ctx.metricGroupBuf, *measurementFieldSeparator...) }