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

Figure out approach to regex anchoring #996

Closed
brian-brazil opened this Issue Aug 16, 2015 · 7 comments

Comments

Projects
None yet
2 participants
@brian-brazil
Copy link
Member

brian-brazil commented Aug 16, 2015

We've got regexes in a few places, we should ensure we're happy they're all anchored in a way that's consistent and doesn't cause surprises. I believe they're all currently unanchored, which I'm not sure makes sense for selectors at least.

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Aug 17, 2015

Agreed. Full string matches would be more useful than substring matches in most cases, and people are already using it wrong. I'm even considering breaking that for selectors, although it will be painful :-/

@brian-brazil

This comment has been minimized.

Copy link
Member Author

brian-brazil commented Aug 20, 2015

👍 on full anchoring

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Sep 1, 2015

We have the following unanchored regex usages in the Prometheus server:

  • reReplaceAll template function
  • match template function
  • label_replace function
  • regex label selectors
  • relabeling (including labelmap matching)

@brian-brazil Do any of them make sense to stay unanchored, like the reReplaceAll function?

/cc @fabxc

@brian-brazil

This comment has been minimized.

Copy link
Member Author

brian-brazil commented Sep 1, 2015

The template functions should remain as-is, as they're straight calls to the relevant Go functions. reReplaceAll must be unanchored to be useful.

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Sep 1, 2015

@brian-brazil That's what I suspected. Ok, so I'll anchor all but the template functions then.

juliusv added a commit that referenced this issue Sep 1, 2015

Change config regexes to full-string matches.
This anchors all regular expressions entered via the config to match a
full string vs. a substring.

THIS IS A BREAKING CHANGE!

Fixes part of #996

juliusv added a commit that referenced this issue Sep 1, 2015

Change relabel_replace() to do full-string matches.
THIS IS A BREAKING CHANGE.

Fixes part of #996
@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Sep 1, 2015

All points addressed by the referenced PRs. Closing.

@juliusv juliusv closed this Sep 1, 2015

fabxc added a commit that referenced this issue Jan 11, 2016

Change config regexes to full-string matches.
This anchors all regular expressions entered via the config to match a
full string vs. a substring.

THIS IS A BREAKING CHANGE!

Fixes part of #996

fabxc added a commit that referenced this issue Jan 11, 2016

Change relabel_replace() to do full-string matches.
THIS IS A BREAKING CHANGE.

Fixes part of #996

gouthamve pushed a commit to gouthamve/promql that referenced this issue Mar 28, 2018

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 24, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.