diff --git a/injectproxy/rules.go b/injectproxy/rules.go index 30ac5148..e85f7e45 100644 --- a/injectproxy/rules.go +++ b/injectproxy/rules.go @@ -207,11 +207,8 @@ func (r *routes) filterRules(lvalues []string, resp *apiResponse) (interface{}, for _, rg := range rgs.RuleGroups { var rules []rule for _, rule := range rg.Rules { - for _, lbl := range rule.Labels() { - if lbl.Name == r.label && slices.Contains(lvalues, lbl.Value) { - rules = append(rules, rule) - break - } + if rule.Labels().Has(r.label) && slices.Contains(lvalues, rule.Labels().Get(r.label)) { + rules = append(rules, rule) } } if len(rules) > 0 { @@ -231,11 +228,8 @@ func (r *routes) filterAlerts(lvalues []string, resp *apiResponse) (interface{}, filtered := []*alert{} for _, alert := range data.Alerts { - for _, lbl := range alert.Labels { - if lbl.Name == r.label && slices.Contains(lvalues, lbl.Value) { - filtered = append(filtered, alert) - break - } + if alert.Labels.Has(r.label) && slices.Contains(lvalues, alert.Labels.Get(r.label)) { + filtered = append(filtered, alert) } }