Skip to content

Coderabbit - #2931

Closed
janisozaur wants to merge 11 commits into
mozilla:mainfrom
janisozaur:coderabbit
Closed

janisozaur wants to merge 11 commits into
mozilla:mainfrom
janisozaur:coderabbit

Conversation

@janisozaur

Copy link
Copy Markdown

No description provided.

janisozaur and others added 11 commits October 22, 2026 10:20
Add the Chrome Trace Event infrastructure (event serialization, virtual
worker-track allocation, task-local context, span guard) and the
`trace_file` / SCCACHE_TRACE setting. The server opens the trace file at
startup and terminates it on shutdown. No compilation spans are emitted yet.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Lease a worker track per compile request and hold it until the compile
finishes, so concurrent compilations never share a track. Each request
produces a `compile: <output>` slice annotated with the compiler and the
outcome (Hit, Miss, NotCached, NotCacheable, CompileFailed or Error).

Co-Authored-By: Claude Code <noreply@anthropic.com>
The daemon trace test was restricted to Unix when it started compiling
with `cc`, which dropped the start/stop coverage on Windows. It is now a
`test_case` pair that runs on every non-macOS platform: a start-and-stop
case that checks the trace file is written and parses, and a compile case
that runs `sccache rustc` twice and asserts a Miss followed by a Hit on
the same worker track. The compile case uses rustc, which avoids needing
a C compiler on the test host.

Co-Authored-By: Claude Code <noreply@anthropic.com>
The compile body runs in a spawned task, which does not inherit the
task-local trace context. Spans created inside it, such as nested parsing
spans, were therefore recorded on the background track instead of the
compilation's worker track. Capture the context before spawning and scope
the spawned future with it.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Record a span for compiler argument parsing, for scanning the preprocessor
output for includes, for checking each cached include file, and for parsing
rustc dep-info. They nest under the compile slice on its worker track.

The daemon trace tests now also cover a C compile that hits the
preprocessor cache, and assert the new spans for the rustc compile case.

Co-Authored-By: Claude Code <noreply@anthropic.com>
A miss on the preprocessor cache showed only the compile result, so the
trace could not say which header caused it. Each failing scan_file span
now carries a miss_reason arg (stat, size, open, read, digest, time_macro).
External tool executions were invisible: a C miss spent ~40 ms unaccounted and rustc detection ~100 ms per request. Adds tool: detect_compiler around compiler probing, tool: preprocess around the preprocessor invocation and tool: compile around the local compiler invocation. tests/server.rs asserts the spans appear once per miss and not on hits, on the compilation worker track.
Cache backend activity was invisible: a hit spent most of its time in storage.get and a backfill to a faster level was not on any track. Adds storage: {cache_type} get/put spans around the base storage calls (the put span lands inside the compile slice because the deferred write future is awaited there) and a backfill: L{from} -> L{to} span on the background track (pid 2) for each spawned backfill task. tests/server.rs checks the storage spans per hit/miss; a multilevel unit test checks the backfill span lands on the background track.
Perfetto counter events (ph: "C") on the metrics track (pid 0): a "Cache Totals" sample per compile result (hits, misses, errors) and a "Tier L{idx} ({cache_type})" sample per level at the end of MultiLevelStorage get/put_raw, so hit rates and per-tier activity render as time-series graphs. Tests: a trace.rs unit test for the counter API, an integration test asserting the Cache Totals samples track the hit/miss counts, and the multilevel test asserting tier counter samples exist.
@janisozaur janisozaur closed this Oct 22, 2026
@janisozaur

Copy link
Copy Markdown
Author

Sorry, not ready yet - didn't mean to push to upstream

@janisozaur
janisozaur deleted the coderabbit branch October 22, 2026 12:35
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