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

Optimize empty filter queries. #1810

Merged
merged 3 commits into from
Mar 17, 2020

Conversation

cyriltovena
Copy link
Contributor

Optimize filter queries such as {label="foo"} |~ "" |~ ".*" |= "" doesn't contains a filter.

The query is not really rewritten and the stringer func still returns the correct original query.
However the Filter func of the Expr returns nil which what is being checked when splitting queries in the frontend and also what is being used in the memchunk.

see https://github.com/grafana/loki/blob/master/pkg/querier/queryrange/roundtrip.go#L81 and https://github.com/grafana/loki/blob/master/pkg/chunkenc/memchunk.go#L614

Fixes #1792

Signed-off-by: Cyril Tovena cyril.tovena@gmail.com

…oesn't contains a filter.

The query is not really rewritten and the stringer func still returns the correct original query.
However the `Filter` func of the `Expr` returns nil which what is being checked when splitting queries in the frontend and also what is being used in the memchunk.

see https://github.com/grafana/loki/blob/master/pkg/querier/queryrange/roundtrip.go#L81 and https://github.com/grafana/loki/blob/master/pkg/chunkenc/memchunk.go#L614

Fixes grafana#1792

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
Copy link
Member

@owen-d owen-d left a comment

Choose a reason for hiding this comment

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

One bit that I think can be improved then lgtm

pkg/logql/filter.go Show resolved Hide resolved
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
@owen-d owen-d merged commit 3829b70 into grafana:master Mar 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optimize empty filter queries
2 participants