Skip to content

Commit 3e36d7a

Browse files
committed
query rejection
small fixes. Signed-off-by: Erlan Zholdubai uulu <[email protected]>
1 parent 375b60a commit 3e36d7a

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

pkg/querier/tripperware/query_attribute_matcher.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"github.com/cortexproject/cortex/pkg/util/validation"
1616
)
1717

18-
const queryRejectErrorMessage = "Query was rejected by operator. Please contact the support for further questions"
18+
const queryRejectErrorMessage = "This query has been rejected by the service operator. Please contact customer support for more information."
1919

2020
func rejectQueryOrSetPriority(r *http.Request, now time.Time, lookbackDelta time.Duration, limits Limits, userStr string, rejectedQueriesPerTenant *prometheus.CounterVec) error {
2121
if limits == nil || !(limits.QueryPriority(userStr).Enabled || limits.QueryRejection(userStr).Enabled) {
@@ -162,14 +162,14 @@ func isWithinQueryStepLimit(queryStepLimit validation.QueryStepLimit, r *http.Re
162162
}
163163

164164
step, err := util.ParseDurationMs(r.FormValue("step"))
165-
if err == nil {
166-
if queryStepLimit.Min != 0 && time.Duration(queryStepLimit.Min).Milliseconds() > step {
167-
return false
168-
}
169-
170-
if queryStepLimit.Max != 0 && time.Duration(queryStepLimit.Max).Milliseconds() < step {
171-
return false
172-
}
165+
if err != nil {
166+
return false
167+
}
168+
if queryStepLimit.Min != 0 && time.Duration(queryStepLimit.Min).Milliseconds() > step {
169+
return false
170+
}
171+
if queryStepLimit.Max != 0 && time.Duration(queryStepLimit.Max).Milliseconds() < step {
172+
return false
173173
}
174174

175175
var subQueryStep time.Duration

pkg/querier/tripperware/query_attribute_matcher_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,11 +240,10 @@ func Test_isWithinQueryStepLimit(t *testing.T) {
240240
step: "15s",
241241
expectedResult: true,
242242
},
243-
"query should be considered within the step limit if query doesn't have steps": {
243+
"query should be considered outside of the step limit if query doesn't have steps": {
244244
queryString: "count(sum(up))",
245245
step: "not_parseable",
246246
queryStepLimit: queryStepLimit,
247-
expectedResult: true,
248247
},
249248
"should match if step limit set and step is within the range": {
250249
step: "15s",

0 commit comments

Comments
 (0)