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

Querying labels that return no results when mixing regex and equality label matches returns results from other series #924

Closed
pdf opened this Issue Jul 23, 2015 · 5 comments

Comments

Projects
None yet
3 participants
@pdf
Copy link

pdf commented Jul 23, 2015

The following queries all return the expected results, when there are results to return, and no results when not all label queries match:

ALERTS{monitor=~"^validmonitor$"}
ALERTS{instance=~"^validinstance$", monitor=~"^validmonitor$"}
ALERTS{monitor="validmonitor"}
ALERTS{instance="validinstance", monitor="validmonitor"}
ALERTS{monitor=~"^invalidmonitor$"}
ALERTS{instance=~"^invalidinstance$", monitor=~"^invalidmonitor$"}
ALERTS{monitor="invalidmonitor"}
ALERTS{instance="invalidinstance", monitor="invalidmonitor"}
ALERTS{monitor=~"^invalidmonitor$"}
ALERTS{instance=~"^invalidinstance$", monitor=~"^validmonitor$"}
ALERTS{instance="invalidinstance", monitor="validmonitor"}
ALERTS{instance="validinstance" invalidlabel="blah"}
ALERTS{instance=~"validinstance" invalidlabel=~"blah"}
ALERTS{instance="invalidinstance" invalidlabel="blah"}
ALERTS{instance=~"invalidinstance" invalidlabel=~"blah"}

Where validinstance/validmonitor are values that return results, and invalidinstance/invalidmonitor are values that should not return results, and invalidlabel is a label that doesn't exist. The regex anchors are options, they have no bearing on the issue.

However, mixing regex and equality label matches as in the following queries returns results from completely different series when one of the labels would return results, but the other would not:

ALERTS{instance="invalidinstance", monitor=~"^validmonitor$"}
ALERTS{instance=~"^invalidinstance$", monitor="validmonitor"}
ALERTS{instance=~"validinstance" invalidlabel="blah"}

I may have missed some permutations above, but I think the scenario should be clear? I don't have test results with data right now, because I blew away my storage to make sure it was a query language problem rather than some sort of data storage corruption. This scenario does apply to querying any series though, so if you like I can provide some arbitrary results that illustrate the problem.

This was all tested on v0.15.0rc3

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Jul 23, 2015

Wow! I can definitely reproduce it with a Prometheus that just scrapes itself and this query:

up{job="invalidjob",instance=~"localhost"}

...it returns all kinds of time series. Will investigate ASAP, although I might not get to it today because we're on an offsite until Friday.

Thanks for reporting!

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Jul 23, 2015

Issue identified. Fix PR is out: #927

@fabxc

This comment has been minimized.

Copy link
Member

fabxc commented Jul 23, 2015

Thanks for reporting and fixing!

On Thu, Jul 23, 2015, 10:59 PM Julius Volz notifications@github.com wrote:

Issue identified. Fix PR is out: #927
#927


Reply to this email directly or view it on GitHub
#924 (comment)
.

juliusv added a commit that referenced this issue Jul 23, 2015

Only do regex lookups when there was no equality match.
For the label matching index-based preselection phase, don't do an OR
between equality and non-equality matchers. Execute only one of the two
(with equality matchers preferred when present).

Fixes #924
@pdf

This comment has been minimized.

Copy link
Author

pdf commented Jul 23, 2015

Thanks for sneaking in a look at this @juliusv

@juliusv juliusv closed this in #927 Jul 24, 2015

@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.