Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
* [BUGFIX] Ring: Fix `DoBatch` counting a key more than once when more replicas than the quorum succeed, which in rare cases could hide a write error from a key that did not reach quorum. A distributor push now always waits until every series reaches quorum, so it returns the error of a series that misses quorum, and takes as long as its slowest series to reach quorum. #7975
* [BUGFIX] Compactor: Stop downloading the parquet files and the `parquet-converter-mark.json` and `parquet-no-convert-mark.json` markers written by the parquet converter under a block's prefix. Compaction never reads them, so they only used local disk and bandwidth until the compaction job ended. #7972
* [BUGFIX] Ring: Fix shuffle-sharding subrings treating instances with a stale heartbeat as healthy when using the DynamoDB KV store. #7976
* [BUGFIX] Query Frontend: Apply the tenant's `default_priority` to metadata queries. `/api/v1/labels`, `/api/v1/series` and `/api/v1/label/<name>/values` were left with no priority assigned when none of the configured query attributes matched, so the frontend's own queue ordered them at a hardcoded 0 instead of the configured default, the `priority` label of `cortex_query_frontend_queue_length` reported 0 for them, and the query stats log omitted the field. A metadata query that does match an attribute now takes the first matching priority rather than the last. #7942

## 1.22.0 2026-11-19

Expand Down
3 changes: 2 additions & 1 deletion pkg/querier/tripperware/query_attribute_matcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,11 @@ func rejectQueryOrSetPriority(r *http.Request, now time.Time, lookbackDelta time
for _, attribute := range priority.QueryAttributes {
if matchAttributeForMetadataQuery(attribute, op, r, now) {
reqStats.SetPriority(priority.Priority)
break
return nil
}
}
}
reqStats.SetPriority(queryPriority.DefaultPriority)
}
}

Expand Down
36 changes: 36 additions & 0 deletions pkg/querier/tripperware/query_attribute_matcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -816,3 +816,39 @@ func Test_rejectQueryOrSetPriorityShouldMatchOnApiType(t *testing.T) {
})
}
}

func Test_rejectQueryOrSetPriorityShouldSetDefaultPriorityWhenNoAttributeMatches(t *testing.T) {
// A single priority that only ever matches query_range, so neither request below matches it.
limits := mockLimits{queryPriority: validation.QueryPriority{
Enabled: true,
DefaultPriority: 5,
Priorities: []validation.PriorityDef{
{
Priority: 1,
QueryAttributes: []validation.QueryAttribute{
{ApiType: "query_range"},
},
},
},
}}

for name, path := range map[string]string{
"instant query": "/api/v1/query?time=1536716898&query=up",
"label names": "/api/v1/labels",
"series": "/api/v1/series?match%5B%5D=up",
"label values": "/api/v1/label/foo/values",
} {
t.Run(name, func(t *testing.T) {
req, err := http.NewRequest("GET", path, http.NoBody)
require.NoError(t, err)
reqStats, ctx := stats.ContextWithEmptyStats(context.Background())
req = req.WithContext(ctx)

require.NoError(t, rejectQueryOrSetPriority(req, time.Now(), time.Duration(1), limits, "", rejectedQueriesPerTenant))

priority, assigned := reqStats.LoadPriority()
assert.True(t, assigned, "priority should have been assigned")
assert.Equal(t, int64(5), priority)
})
}
}