app/vminsert/influx: properly handle the case when certain labels with empty values are removed by ApplyRelabeling() call

Previously this could lead to `out of range` panic
This commit is contained in:
Aliaksandr Valialkin 2020-07-17 00:05:08 +03:00
parent e4e1cd1de2
commit 8c14ca93fa

View file

@ -105,7 +105,7 @@ func insertRows(db string, rows []parser.Row) error {
} }
labels := ic.Labels labels := ic.Labels
if !hasRelabeling { if !hasRelabeling {
labels = labels[labelsLen : labelsLen+1] labels = labels[len(labels)-1:]
} }
ic.WriteDataPoint(ctx.metricNameBuf, labels, r.Timestamp, f.Value) ic.WriteDataPoint(ctx.metricNameBuf, labels, r.Timestamp, f.Value)
} }