Repository navigation
Query Frontend: apply default_priority to metadata queries - #7942
Open
arpitjain099 wants to merge 1 commit into
Open
arpitjain099 wants to merge 1 commit into
arpitjain099 wants to merge 1 commit into
Conversation
The metadata branch of rejectQueryOrSetPriority never fell back to the tenant's default priority, so /api/v1/labels, /series and /label/*/values were enqueued at a hardcoded 0. Its break also left only the inner loop, so the last matching priority won where the expression branch takes the first. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does:
rejectQueryOrSetPrioritysplits on operation. The expression branch takes the first matching priority and then falls back toqueryPriority.DefaultPriority. The metadata branch does neither: there is no fallback after the loop, and itsbreakleaves only the inner loop, so a later matching priority overwrites an earlier one.SetPriorityis what flipsPriorityAssigned, and bothschedulerRequest.Priority()andrequest.Priority()return a hardcoded 0 whenLoadPriorityreports false. So/api/v1/labels,/api/v1/seriesand/api/v1/label/<name>/valuesare enqueued at 0 rather than at the tenant'sdefault_priority. Withdefault_priority: -1and apriority: 0class holdingreserved_queriers, they land in the reserved class. Theprioritylabel ofcortex_query_scheduler_queue_lengthreports 0 for them as well, and the query log drops the field.#7128 extended query priority to operations beyond
queryandquery_range, and the default fallback did not come across with it. This mirrors the expression branch:return nilon a match,SetPriority(DefaultPriority)after the loop. The branch also covers/api/v1/metadataand any other non-query path, so those pick up the default too.Testing:
Test_rejectQueryOrSetPriorityShouldSetDefaultPriorityWhenNoAttributeMatchesconfigures a singlequery_rangepriority that none of its four probes match, and asserts each one receivesdefault_priority: 5. The three metadata cases fail on master withactual: 0. The instant-query case passes either way and is there as a control. The package goes from 166 passing with 4 failures to 170 passing, andtripperware,schedulerandfrontendare green with the change, built withnetgo slicelabels.Which issue(s) this PR fixes:
N/A
Checklist
CHANGELOG.mdupdateddocs/configuration/v1-guarantees.mdupdated if this PR introduces experimental flags (no new flags)Prepared with the assistance of generative AI, reviewed and tested by me.