Skip to content

Commit 7878a8c

Browse files
committed
Move query reject to before query priority
Signed-off-by: Essam Eldaly <[email protected]>
1 parent 4254d40 commit 7878a8c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

pkg/querier/tripperware/query_attribute_matcher.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ func rejectQueryOrSetPriority(r *http.Request, now time.Time, lookbackDelta time
5656
reqStats.SetPriority(queryPriority.DefaultPriority)
5757
}
5858
} else {
59+
if queryReject := limits.QueryRejection(userStr); queryReject.Enabled && (op == "series" || op == "labels" || op == "label_values") {
60+
for _, attribute := range queryReject.QueryAttributes {
61+
if matchAttributeForMetadataQuery(attribute, op, r, now) {
62+
rejectedQueriesPerTenant.WithLabelValues(op, userStr).Inc()
63+
return httpgrpc.Errorf(http.StatusUnprocessableEntity, QueryRejectErrorMessage)
64+
}
65+
}
66+
}
67+
5968
if queryPriority := limits.QueryPriority(userStr); queryPriority.Enabled && len(queryPriority.Priorities) != 0 {
6069
for _, priority := range queryPriority.Priorities {
6170
for _, attribute := range priority.QueryAttributes {
@@ -67,15 +76,6 @@ func rejectQueryOrSetPriority(r *http.Request, now time.Time, lookbackDelta time
6776
}
6877
}
6978

70-
if queryReject := limits.QueryRejection(userStr); queryReject.Enabled && (op == "series" || op == "labels" || op == "label_values") {
71-
for _, attribute := range queryReject.QueryAttributes {
72-
if matchAttributeForMetadataQuery(attribute, op, r, now) {
73-
rejectedQueriesPerTenant.WithLabelValues(op, userStr).Inc()
74-
return httpgrpc.Errorf(http.StatusUnprocessableEntity, QueryRejectErrorMessage)
75-
}
76-
}
77-
}
78-
7979
return nil
8080
}
8181

0 commit comments

Comments
 (0)