Skip to content

Additional metrics to graph runner#101

Merged
yushan8 merged 2 commits into
mainfrom
additional-metrics
Jun 5, 2026
Merged

Additional metrics to graph runner#101
yushan8 merged 2 commits into
mainfrom
additional-metrics

Conversation

@yushan8
Copy link
Copy Markdown
Contributor

@yushan8 yushan8 commented Jun 5, 2026

  1. Metrics for graph computation (graphrunner/native.go, graphrunner/BUILD.bazel)

Added a tally.Scope to nativeGraphRunner so it can emit M3 metrics. Three new timers and a gauge are recorded on every Compute call:

  • graph_runner.bazel_query_duration — time spent running bazel query
  • graph_runner.git_file_hashes_duration — time spent running git ls-tree HEAD to get known source hashes
  • graph_runner.target_hash_duration — time spent in targethasher.FromProto (the Merkle DAG hash traversal)
  • graph_runner.target_count — number of targets in the computed graph

The scope is inherited from the orchestrator's existing tally scope, so metrics surface as tango.orchestrator.graph_runner.* in M3. NativeGraphRunnerParams gained a Scope tally.Scope field (defaults to noop if nil).

  1. Scope wired through orchestrator (orchestrator/native_orchestrator.go)

b.scope is now passed to NativeGraphRunnerParams.Scted to the real tally reporter in production.

  1. Hashing optimization (core/targethasher/graph.go

HashRuleCommon was being called twice per rule targ

  • Once in toTarget (parallel, result stored in target.HashWithoutDeps)
  • Once again in HashRecursively's default case (red

Fix: removed target.HashWithoutDeps = []byte{} fromget.Hash needs to be the sentinel), thenHashRecursively reads target.HashWithoutDeps directly instead of re-running HashRuleCommon. A fallback still calls HashRuleCommon if HashWithoutDeps is somehow empty.

@yushan8 yushan8 requested review from a team as code owners June 5, 2026 23:35
@yushan8 yushan8 merged commit 952a81c into main Jun 5, 2026
8 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