Skip to content

refactor(metrics): move graph cache lookup to orchestrator - #245

Merged
xytan0056 merged 2 commits into
mainfrom
refactor/move-graph-cache-lookup
Jul 28, 2026
Merged

refactor(metrics): move graph cache lookup to orchestrator#245
xytan0056 merged 2 commits into
mainfrom
refactor/move-graph-cache-lookup

Conversation

@xytan0056

@xytan0056 xytan0056 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

The controller-level graph_cache_lookup counter was always ~100% hit rate because it only fires after a treehash cache hit — and since the orchestrator writes the graph before the treehash, the graph is guaranteed to exist whenever the treehash does. This made the metric meaningless.

This PR moves the graph_cache_lookup counter to the orchestrator, where the real cache decision happens: after materializing a workspace and computing the treehash, but before falling through to bazel. A miss here means "we actually need to run bazel", which is what we care about.

Also promotes RecordCacheLookup and cache metric name constants to the metrics package so both controller and orchestrator can use them.

Test plan

CI

…e RecordCacheLookup

The controller-level graph_cache_lookup counter was trivially ~100%
because it only fired after a treehash cache hit, and the orchestrator
writes the graph before the treehash — so the graph is guaranteed to
exist whenever the treehash does.

Move the graph_cache_lookup counter to the orchestrator where the real
cache decision happens (after workspace materialization computes the
treehash, before falling through to bazel).

Promote recordCacheLookup and the cache metric name constants from
controller-internal to the metrics package so both controller and
orchestrator can use them.
@xytan0056
xytan0056 requested review from a team as code owners July 27, 2026 22:56
@xytan0056
xytan0056 merged commit 59f2b97 into main Jul 28, 2026
15 of 17 checks passed
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.

2 participants