Repository navigation
feat(cache): trace where a task's time goes - #981
Merged
Merged
Conversation
Add debug spans and events, with durations and sizes as fields, at the points that explain a task's time: the scheduler's permit wait, globbed input hashing, local and remote cache lookups (fetch, each entry's check, archive download), inferred input validation, spawn and exit, post-run fingerprinting, output archiving, local recording, restoring, and remote uploads (prepare, send, the OIDC token request, and the final wait). The remote cache client logs each response's status and length without the request URL. Per-file fingerprinting and validation are at trace level. The leaf span carries the task and its command, and an upload keeps its task's span. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fspy benchmarklinuxmacoswindows |
Rayon's threads don't run in the calling thread's span, so the trace events for each inferred input that the post-run fingerprint and its validation emit had no task or command. They now name the span the work was started in as their parent. Co-Authored-By: Claude Opus 5.5 <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.
Motivation
When a cached run is slower than expected, especially in CI with the remote cache,
vp run's output doesn't say where a task's time went. It could be waiting for a concurrency slot, hashing inputs, the local lookup, the remote fetch, checking each fetched entry, downloading or extracting the archive, the process itself, fingerprinting and archiving after a run, or the upload.With
VP_LOG=vt=debug,vt_remote_cache=debug, each of these steps is now traced with its duration, and with sizes and counts where they matter. The traces run in the task's span, so a CI log can be turned into a per-task timeline. Per-input fingerprinting and validation are traced attracelevel. Nothing changes unlessVP_LOGis set. Token requests log their status and timing, never the request URL or a token.We used these traces on a CI replay of a monorepo's history, about 600 jobs. They showed remote fetches queueing behind the backend's per-isolate read limit, entry checks running one after another on the scheduler thread (fixed by the next PR in this stack), and archive downloads on the critical path.
🤖 Generated with Claude Code
Note
Low Risk
Observability-only: tracing and timing logs gated on
VP_LOG, with careful avoidance of logging credentials or tokens.Overview
Adds opt-in
tracinginstrumentation (viaVP_LOG) across task execution and cache paths so CI logs can show per-step durations and useful sizes/counts without changing normal behavior.Local and remote cache: debug events for local/remote lookup outcomes, remote fetch resolution, per-entry validation, archive download/extract/restore, local record, upload prepare/finish/wait, and output archiving—with a small
file_sizehelper for archive byte counts.Execution path: timing for glob input hashing, spawn/fspy, child exit, DAG concurrency waits, and leaf item completion; fingerprint create/validate get debug summaries plus trace-level per-input events parented under the task span (Rayon-safe).
vt_remote_cache:tracingdependency,#[tracing::instrument]on fetch/download/store, response logging (status/content-length, not URLs), store prep metrics including blob size; GitHub OIDC logs status and timing only (no tokens/URLs).Remote upload tasks run
.in_current_span()so background uploads stay tied to the task timeline.Reviewed by Cursor Bugbot for commit 42bda18. Bugbot is set up for automated code reviews on this repo. Configure here.