refactor(metrics): move graph cache lookup to orchestrator - #245
Merged
Conversation
…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.
justinwon777
approved these changes
Jul 27, 2026
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.
Summary
The controller-level
graph_cache_lookupcounter 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_lookupcounter 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
RecordCacheLookupand cache metric name constants to themetricspackage so both controller and orchestrator can use them.Test plan
CI