Repository navigation
feat(hotblocks): count and log query tasks that hold a worker for long - #117
Merged
Merged
Conversation
mo4islona
force-pushed
the
feat/slow-query-task-log
branch
from
October 15, 2026 14:36
a721172 to
827107b
Compare
The queue histograms show that tasks wait behind other tasks, not which queries they wait behind. A slow task is now counted by dataset, client and step, and logged with its query at most once per query shape and up to a limit per five minutes. A worker that waits for its task's parallel work can run another queued task meanwhile, so that nested time is not held against the outer task. The worker reports the task, not the caller, so a task that fails or whose client disconnects is reported too. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
mo4islona
force-pushed
the
feat/slow-query-task-log
branch
from
October 15, 2026 14:38
827107b to
8658841
Compare
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.
The query task histograms show that tasks wait in the query pool's queue behind other tasks. They do not show which queries hold the workers. This PR answers that question.
What it adds
hotblocks_query_slow_tasks_total{dataset_name, client_id, step}counts each task that holds a query pool worker longer than the slow-task threshold.WARNline for a slow task carries:Log volume
Log lines are rate-limited the same way as the shadow logs: at most one line per query shape (the query without its block range), up to
--slow-task-log-limitlines per 5 minutes. The counter is not limited.Nested time
A rayon worker that waits for its task's parallel work can take another queued task in the meantime (
find_workalso pops injected jobs). Without a correction, a light task could show the time of a heavy task that ran inside it. The executor now subtracts the time of tasks nested on the same worker, and the threshold applies to the remaining own time. Tasks nested on other workers are not seen.Settings
--slow-task-threshold-msPATCH /settings{"slowTasks": {"thresholdMs": …}}--slow-task-log-limitPATCH /settings{"slowTasks": {"logLimit": …}}A runtime change lasts until a restart, the same as the shadow settings. A log limit of 0 turns the log lines off.
Refactor
The shadow's log window, query fingerprint and query truncation moved to
log_window.rs, so that both logs share them.Tests
PATCH /settings, to the counter.🤖 Generated with Claude Code