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

Fixing problem on FilteredSelector when applying filter in series without filtered labels #163

Merged
merged 6 commits into from
Jan 31, 2023

Conversation

pedro-stanaka
Copy link
Contributor

Summary

This PR fixes a problem where a label matcher would match a series if the label did not exist in the series.

So, for example:

metric{}

Would not match the selector {foo~=".*"}, where it should to be compatible with Prometheus.

See this added test case for more details.

pedro-stanaka and others added 5 commits January 27, 2023 16:44
…hout filtered labels

Signed-off-by: Pedro Tanaka <[email protected]>
Co-authored-by: Filip Petkovski <[email protected]>
Signed-off-by: Pedro Tanaka <[email protected]>
Co-authored-by: Filip Petkovski <[email protected]>
Signed-off-by: Pedro Tanaka <[email protected]>
Co-authored-by: Filip Petkovski <[email protected]>
Signed-off-by: Pedro Tanaka <[email protected]>
Co-authored-by: Filip Petkovski <[email protected]>
Signed-off-by: Pedro Tanaka <[email protected]>
Copy link
Collaborator

@fpetkovski fpetkovski left a comment

Choose a reason for hiding this comment

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

Thanks!

label := series.Labels().Get(name)
if !m.Matches(label) {
hasMatch = false
break
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we can return false immediately here.

Signed-off-by: Pedro Tanaka <[email protected]>
@fpetkovski fpetkovski mentioned this pull request Jan 30, 2023
2 tasks
@GiedriusS GiedriusS merged commit f2b627b into thanos-io:main Jan 31, 2023
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.

3 participants