bugfix: duplicate recoding rule metric name (#1186)

This commit is contained in:
zheng 2022-10-12 18:36:04 +08:00 committed by GitHub
parent 0d05ad85f2
commit 40bbbfd475
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -96,6 +96,9 @@ func labelsToLabelsProto(labels model.Metric, rule *models.RecordingRule) (resul
} }
result = append(result, nameLs) result = append(result, nameLs)
for k, v := range labels { for k, v := range labels {
if k == LabelName {
continue
}
if model.LabelNameRE.MatchString(string(k)) { if model.LabelNameRE.MatchString(string(k)) {
result = append(result, &prompb.Label{ result = append(result, &prompb.Label{
Name: string(k), Name: string(k),