Skip to content

search: attribute permit-wait latency to the blocking resource#6589

Draft
loutPhilipps wants to merge 1 commit into
lout.philipps/span-attributesfrom
lout.philipps/permit-wait
Draft

search: attribute permit-wait latency to the blocking resource#6589
loutPhilipps wants to merge 1 commit into
lout.philipps/span-attributesfrom
lout.philipps/permit-wait

Conversation

@loutPhilipps

Copy link
Copy Markdown

Summary

waiting_for_leaf_search_split_semaphore was a bare timer, so a long wait couldn't be attributed to the two things a split-search permit can block on: warmup/download slots or the memory budget.

The actor now tracks the resource blocking the head of the queue in a shared BlockReasonHandle (an atomic). Because permits are served in order, whatever blocks the head blocks every waiter, so this queue-level reason is correct for a waiter at any position. Each SearchPermitFuture reads the handle, and a drop guard (WaitBlockReasonRecorder) on the wait span records blocked_on when the wait ends — granted or cancelled — gated on the wait being long (≥1ms) so instant grants stay unlabeled. Attributing on the wait side (not from the granted permit) is what lets the long, deadline-cancelled waits — the ones we care about — carry a reason even though they never get a permit.

Stacked on #6588.

🤖 Generated with Claude Code

waiting_for_leaf_search_split_semaphore was a bare timer, so a long
wait couldn't be attributed to the two things a split-search permit
can block on: warmup/download slots or the memory budget.

The actor now tracks the resource blocking the head of the queue in a
shared BlockReasonHandle (an atomic). Because permits are served in
order, whatever blocks the head blocks every waiter, so this
queue-level reason is correct for a waiter at any position. Each
SearchPermitFuture reads the handle, and a drop guard
(WaitBlockReasonRecorder) on the wait span records blocked_on when the
wait ends -- granted or cancelled -- gated on the wait being long
(>=1ms) so instant grants stay unlabeled. Attributing on the wait side
(not from the granted permit) is what lets the long, deadline-cancelled
waits -- the ones we care about -- carry a reason even though they
never get a permit.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant