@@ -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