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

Optimizes SampleExpr to remove unnecessary line_format. #3065

Merged

Conversation

cyriltovena
Copy link
Contributor

When doing count_over_time and rate(), it doesn't make sense to have a line_format since you're counting line, you don't really care about what the line contains.

At the same time this set the foundation of for further optimization, like parsing only required labels during label parsing.

I've also found a bug where topk by(foo) (1... where not correctly parsed.

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

When doing count_over_time and rate(), it doesn't make sense to have a line_format since you're counting line, you don't really care about what the line contains.

At the same time this set the foundation of for further optimization, like parsing only required labels during label parsing.

I've also found a bug where `topk by(foo) (1...` where not correctly parsed.

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

I think it's actually for all range vector operation, will make a change to support them all

@codecov-io
Copy link

Codecov Report

Merging #3065 (5a874a4) into master (3f99a07) will increase coverage by 0.02%.
The diff coverage is 87.69%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3065      +/-   ##
==========================================
+ Coverage   62.88%   62.91%   +0.02%     
==========================================
  Files         186      187       +1     
  Lines       15949    16014      +65     
==========================================
+ Hits        10030    10075      +45     
- Misses       4987     5007      +20     
  Partials      932      932              
Impacted Files Coverage Δ
pkg/logql/engine.go 86.16% <33.33%> (-1.02%) ⬇️
pkg/logql/optimize.go 90.32% <90.32%> (ø)
pkg/promtail/positions/positions.go 46.80% <0.00%> (-11.71%) ⬇️
pkg/ingester/checkpoint.go 67.40% <0.00%> (-0.89%) ⬇️
pkg/canary/comparator/comparator.go 77.72% <0.00%> (-0.46%) ⬇️
pkg/querier/queryrange/limits.go 95.83% <0.00%> (+4.16%) ⬆️

Except for bytes one which count bytes in lines.

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.

nit then lgtm

pkg/logql/optimize_test.go Show resolved Hide resolved
Co-authored-by: Owen Diehl <ow.diehl@gmail.com>
@cyriltovena cyriltovena merged commit c971e8e into grafana:master Jan 6, 2021
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.

None yet

3 participants