Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update prometheus for subqueries support in ruler. #1790

Merged
merged 2 commits into from
Nov 26, 2019
Merged

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