Rename per-request query limits. (#9011)

**What this PR does / why we need it**:
`maxQueryTime` is more in line with the other per-request limits we
have.

**Checklist**
- [ ] Reviewed the
[`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md)
guide (**required**)
- [ ] Documentation added
- [x] Tests updated
- [ ] `CHANGELOG.md` updated
- [ ] Changes that require user attention or interaction to upgrade are
documented in `docs/sources/upgrading/_index.md`
pull/9022/head
Karsten Jeschkies 2 years ago committed by GitHub
parent 4fc51ccdd7
commit de2b0c6e9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      integration/loki_micro_services_test.go
  2. 2
      pkg/util/querylimits/propagation.go
  3. 4
      pkg/util/querylimits/propagation_test.go

@ -10,6 +10,7 @@ import (
"github.com/grafana/loki/integration/client"
"github.com/grafana/loki/integration/cluster"
"github.com/grafana/loki/pkg/util/querylimits"
)

@ -26,7 +26,7 @@ type QueryLimits struct {
MaxQueryRange model.Duration `json:"maxQueryInterval,omitempty"`
MaxQueryLookback model.Duration `json:"maxQueryLookback,omitempty"`
MaxEntriesLimitPerQuery int `json:"maxEntriesLimitPerQuery,omitempty"`
QueryTimeout model.Duration `json:"queryTimeout,omitempty"`
QueryTimeout model.Duration `json:"maxQueryTime,omitempty"`
RequiredLabels []string `json:"requiredLabels,omitempty"`
RequiredNumberLabels int `json:"minimumLabelsNumber,omitempty"`
MaxQueryBytesRead flagext.ByteSize `json:"maxQueryBytesRead,omitempty"`

@ -25,7 +25,7 @@ func TestInjectAndExtractQueryLimits(t *testing.T) {
func TestDeserializingQueryLimits(t *testing.T) {
// full limits
payload := `{"maxEntriesLimitPerQuery": 100, "maxQueryLength": "2d", "maxQueryLookback": "2w", "queryTimeout": "5s", "maxQueryBytesRead": "1MB", "maxQuerierBytesRead": "1MB"}`
payload := `{"maxEntriesLimitPerQuery": 100, "maxQueryLength": "2d", "maxQueryLookback": "2w", "maxQueryTime": "5s", "maxQueryBytesRead": "1MB", "maxQuerierBytesRead": "1MB"}`
limits, err := UnmarshalQueryLimits([]byte(payload))
require.NoError(t, err)
require.Equal(t, model.Duration(2*24*time.Hour), limits.MaxQueryLength)
@ -55,7 +55,7 @@ func TestSerializingQueryLimits(t *testing.T) {
actual, err := MarshalQueryLimits(&limits)
require.NoError(t, err)
expected := `{"maxEntriesLimitPerQuery": 100, "maxQueryLength": "2d", "maxQueryLookback": "2w", "queryTimeout": "5s", "maxQueryBytesRead": "1MB"}`
expected := `{"maxEntriesLimitPerQuery": 100, "maxQueryLength": "2d", "maxQueryLookback": "2w", "maxQueryTime": "5s", "maxQueryBytesRead": "1MB"}`
require.JSONEq(t, expected, string(actual))
// some limits are empty

Loading…
Cancel
Save