lib/promscrape: add missing label sorting for autogenerated metrics

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/592
This commit is contained in:
Aliaksandr Valialkin 2020-06-29 22:35:54 +03:00
parent 1cd01b5359
commit 586c5be404

View file

@ -248,6 +248,7 @@ func (sw *scrapeWork) addRowToTimeseries(r *parser.Row, timestamp int64, needRel
sw.labels = promrelabel.ApplyRelabelConfigs(sw.labels, labelsLen, sw.Config.MetricRelabelConfigs, true) sw.labels = promrelabel.ApplyRelabelConfigs(sw.labels, labelsLen, sw.Config.MetricRelabelConfigs, true)
} else { } else {
sw.labels = promrelabel.FinalizeLabels(sw.labels[:labelsLen], sw.labels[labelsLen:]) sw.labels = promrelabel.FinalizeLabels(sw.labels[:labelsLen], sw.labels[labelsLen:])
promrelabel.SortLabels(sw.labels[labelsLen:])
} }
if len(sw.labels) == labelsLen { if len(sw.labels) == labelsLen {
// Skip row without labels. // Skip row without labels.