MCPcopy Create free account
hub / github.com/cortexproject/cortex / parseMatchersParam

Function parseMatchersParam

pkg/ruler/ruler.go:1653–1673  ·  view source on GitHub ↗
(matchers []string)

Source from the content-addressed store, hash-verified

1651}
1652
1653func parseMatchersParam(matchers []string) ([][]*labels.Matcher, error) {
1654 var matcherSets [][]*labels.Matcher
1655 for _, s := range matchers {
1656 matchers, err := parser.ParseMetricSelector(s)
1657 if err != nil {
1658 return nil, err
1659 }
1660 matcherSets = append(matcherSets, matchers)
1661 }
1662
1663OUTER:
1664 for _, ms := range matcherSets {
1665 for _, lm := range ms {
1666 if lm != nil && !lm.Matches("") {
1667 continue OUTER
1668 }
1669 }
1670 return nil, errors.New("match[] must contain at least one non-empty matcher")
1671 }
1672 return matcherSets, nil
1673}
1674
1675func matches(l labels.Labels, matchers ...*labels.Matcher) bool {
1676 for _, m := range matchers {

Callers 2

getLocalRulesMethod · 0.85
PrometheusRulesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected