mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
app/vmselect/promql: make sure that label_replace() doesn't create an empty dst_label if the src_label doesn't match regex
This commit is contained in:
parent
31886aef3d
commit
d3de110070
1 changed files with 1 additions and 1 deletions
|
@ -1873,12 +1873,12 @@ func labelReplace(tss []*timeseries, srcLabel string, r *regexp.Regexp, dstLabel
|
|||
replacementBytes := []byte(replacement)
|
||||
for _, ts := range tss {
|
||||
mn := &ts.MetricName
|
||||
dstValue := getDstValue(mn, dstLabel)
|
||||
srcValue := mn.GetTagValue(srcLabel)
|
||||
if !r.Match(srcValue) {
|
||||
continue
|
||||
}
|
||||
b := r.ReplaceAll(srcValue, replacementBytes)
|
||||
dstValue := getDstValue(mn, dstLabel)
|
||||
*dstValue = append((*dstValue)[:0], b...)
|
||||
if len(b) == 0 {
|
||||
mn.RemoveTag(dstLabel)
|
||||
|
|
Loading…
Reference in a new issue