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

Support configurable maximum of the limits parameter #1798

Conversation

adityacs
Copy link
Contributor

@adityacs adityacs commented Mar 12, 2020

What this PR does / why we need it:
Support configurable maximum of the limits parameter

Which issue(s) this PR fixes:
Fixes #1795

Checklist

  • Documentation added
  • Tests updated

pkg/querier/querier.go Outdated Show resolved Hide resolved
@adityacs adityacs force-pushed the 1795_Configurable_maximum_limits_parameter branch 6 times, most recently from 52ac0ca to 0f666de Compare March 13, 2020 12:43
pkg/querier/http.go Outdated Show resolved Hide resolved
pkg/querier/http.go Outdated Show resolved Hide resolved
@adityacs adityacs force-pushed the 1795_Configurable_maximum_limits_parameter branch 2 times, most recently from 812c003 to b0731c2 Compare March 17, 2020 10:41
pkg/querier/http.go Outdated Show resolved Hide resolved
@cyriltovena
Copy link
Contributor

cyriltovena commented Mar 19, 2020

This looks ready except for the zero case which I think you can quickly solve. Checking why the CI fails.

EDIT: you have a test failing !

@adityacs adityacs force-pushed the 1795_Configurable_maximum_limits_parameter branch 3 times, most recently from cda504c to f5d2508 Compare March 20, 2020 03:09
@adityacs
Copy link
Contributor Author

@cyriltovena Have made all the changes. I see that currently we don't have complete testing for the http handlers. Will try to add some tests and create a separate PR.

@codecov-io
Copy link

codecov-io commented Mar 20, 2020

Codecov Report

Merging #1798 into master will decrease coverage by 0.16%.
The diff coverage is 31.25%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1798      +/-   ##
==========================================
- Coverage   64.86%   64.69%   -0.17%     
==========================================
  Files         122      122              
  Lines        9239     9271      +32     
==========================================
+ Hits         5993     5998       +5     
- Misses       2833     2856      +23     
- Partials      413      417       +4     
Impacted Files Coverage Δ
pkg/querier/http.go 10.19% <0.00%> (-0.98%) ⬇️
pkg/querier/queryrange/limits.go 100.00% <ø> (ø)
pkg/querier/queryrange/roundtrip.go 79.62% <71.42%> (-1.23%) ⬇️
pkg/promtail/targets/filetarget.go 68.71% <0.00%> (-1.85%) ⬇️
pkg/logql/evaluator.go 91.22% <0.00%> (-0.59%) ⬇️

@@ -326,3 +337,17 @@ func writeError(err error, w http.ResponseWriter) {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
}

func (q *Querier) validateEntriesLimits(ctx context.Context, limit uint32) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

You need to validate this also for LogQueryHandler but only once we have verified it's a log request.

So after those lines:

	// short circuit metric queries
	if _, ok := expr.(logql.SampleExpr); ok {
		writeError(httpgrpc.Errorf(http.StatusBadRequest, "legacy endpoints only support %s result type", logql.ValueTypeStreams), w)
		return
	}

@adityacs adityacs force-pushed the 1795_Configurable_maximum_limits_parameter branch from f5d2508 to 5635f66 Compare March 24, 2020 14:38
Copy link
Contributor

@cyriltovena cyriltovena left a comment

Choose a reason for hiding this comment

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

LGTM.

@adityacs adityacs force-pushed the 1795_Configurable_maximum_limits_parameter branch from 1274006 to 68c0218 Compare March 26, 2020 04:19
@cyriltovena cyriltovena merged commit f412731 into grafana:master Mar 26, 2020
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 31.25000% with 22 lines in your changes missing coverage. Please review.

Project coverage is 64.69%. Comparing base (3dd2d51) to head (68c0218).

Files with missing lines Patch % Lines
pkg/querier/http.go 0.00% 18 Missing ⚠️
pkg/querier/queryrange/roundtrip.go 71.42% 2 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1798      +/-   ##
==========================================
- Coverage   64.86%   64.69%   -0.17%     
==========================================
  Files         122      122              
  Lines        9239     9271      +32     
==========================================
+ Hits         5993     5998       +5     
- Misses       2833     2856      +23     
- Partials      413      417       +4     
Files with missing lines Coverage Δ
pkg/querier/queryrange/limits.go 100.00% <ø> (ø)
pkg/querier/queryrange/roundtrip.go 79.62% <71.42%> (-1.23%) ⬇️
pkg/querier/http.go 10.19% <0.00%> (-0.98%) ⬇️

... and 2 files with indirect coverage changes

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.

Configurable maximum of the limits parameter.
4 participants