Skip to content

Update prometheus for subqueries support in ruler.#1790

Merged
bwplotka merged 2 commits intomasterfrom
update-prometheus
Nov 26, 2019
Merged

Update prometheus for subqueries support in ruler.#1790
bwplotka merged 2 commits intomasterfrom
update-prometheus

Conversation

@bwplotka
Copy link
Member

@bwplotka bwplotka commented Nov 26, 2019

Fixes #1779

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

cc @bjakubski @simonpasquier

…f0fee9fc0) for subqueries support in ruler.

Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
Copy link
Member

@squat squat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I have some questions, but maybe it’s nothing


case storepb.LabelMatcher_RE:
return labels.NewRegexpMatcher(m.Name, "^(?:"+m.Value+")$")
return labels.NewMatcher(labels.MatchRegexp, m.Name, m.Value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don’t need the regular expression here anymore?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not need as this is done already in NewMatcher:

// NewMatcher returns a matcher object.
func NewMatcher(t MatchType, n, v string) (*Matcher, error) {
	m := &Matcher{
		Type:  t,
		Name:  n,
		Value: v,
	}
	if t == MatchRegexp || t == MatchNotRegexp {
		re, err := regexp.Compile("^(?:" + v + ")$")
		if err != nil {
			return nil, err
		}
		m.re = re
	}
	return m, nil
}

(:

return nil, err
}
return labels.Not(m), nil
return labels.NewMatcher(labels.MatchNotRegexp, m.Name, m.Value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same answer (:

@bwplotka bwplotka merged commit 7e11afe into master Nov 26, 2019
@bwplotka bwplotka deleted the update-prometheus branch November 26, 2019 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ruler: silently mangles rules read from config (subqueries)

2 participants