Repository navigation
feat(hotblocks): time query tasks in the pool queue and on a worker - #116
Merged
Merged
Conversation
active_queries counts a task from admission to its end, so a slower stream at a flat request rate could be either tasks queued behind a parallel scan or tasks that run longer, and nothing exported told the two apart. Closes #114 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Closes #114.
hotblocks_active_queriescounts a query task from admission to its end, so it mixes tasks that wait in the query pool's queue with tasks that run. A slower stream at a flat request rate can mean either, and nothing exported told the two apart.What
QuerySlot::runtakes astep(firstopens a stream,nextfills each later data pack) and records:hotblocks_query_task_queue_seconds{step}: spawn → the task starts on a workerhotblocks_query_task_run_seconds{step}: start → end of the task, panics includedhotblocks_query_tasks_queued: tasks spawned and not yet started;active_queries - query_tasks_queuedis the number of running tasksBuckets are
exponential_buckets(0.0001, 2.0, 18)(100 µs to ~13 s). No dataset or client label. The cost is threeInstant::now()calls and two observations per task.Reading the run time
The query code runs
par_iterinside a task. A worker that waits for its parallel work can take another query task from the pool's queue and run it on the same stack, so a task's run time can include a whole other task. A long run time is not always a slow query.Testing
tests/query_task_metrics.rsruns one query against the real binary and checks the/metricsdelta: onefirstobservation in each histogram, equalnextcounts, and the queued gauge back at 0.Dashboard
Queue and run p50/p99 side by side:
🤖 Generated with Claude Code