Skip to content

Commit f880948

Browse files
meisterTcopybara-github
authored andcommitted
Replace remote_cache_hits with more detailed runner_count.
Improvement on #7714. ``` $ bazel build --internal_spawn_scheduler --strategy=Javac=dynamic --config=remote --build_event_json_file=/tmp/bep.json //src:bazel $ cat /tmp/bep.json | jq '.buildMetrics.actionSummary.runnerCount | select( . != null)' [ { "name": "total", "count": 2698 }, { "name": "remote cache hit", "count": 2259 }, { "name": "internal", "count": 60 }, { "name": "local", "count": 1 }, { "name": "remote", "count": 63 }, { "name": "worker", "count": 315 } ] ``` PiperOrigin-RevId: 385725354
1 parent 9015f38 commit f880948

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

src/main/java/com/google/devtools/build/lib/buildeventstream/proto/build_event_stream.proto

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -836,9 +836,6 @@ message BuildMetrics {
836836
// remote cache hits, but excludes local action cache hits.
837837
int64 actions_executed = 2;
838838

839-
// The total number of remote cache hits.
840-
int64 remote_cache_hits = 5;
841-
842839
message ActionData {
843840
string mnemonic = 1;
844841

@@ -856,6 +853,15 @@ message BuildMetrics {
856853
}
857854
// Contains the top N actions by number of actions executed.
858855
repeated ActionData action_data = 4;
856+
857+
// Deprecated. The total number of remote cache hits.
858+
int64 remote_cache_hits = 5 [deprecated = true];
859+
860+
message RunnerCount {
861+
string name = 1;
862+
int32 count = 2;
863+
}
864+
repeated RunnerCount runner_count = 6;
859865
}
860866
ActionSummary action_summary = 1;
861867

src/main/java/com/google/devtools/build/lib/metrics/MetricsCollector.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.BuildMetrics;
2828
import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.BuildMetrics.ActionSummary;
2929
import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.BuildMetrics.ActionSummary.ActionData;
30+
import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.BuildMetrics.ActionSummary.RunnerCount;
3031
import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.BuildMetrics.ArtifactMetrics;
3132
import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.BuildMetrics.BuildGraphMetrics;
3233
import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.BuildMetrics.CumulativeMetrics;
@@ -236,10 +237,16 @@ private ActionSummary finishActionSummary() {
236237
action.lastEnded.longValue()))
237238
.setActionsExecuted(action.numActions.get())
238239
.build()));
240+
239241
ImmutableMap<String, Integer> spawnSummary = spawnStats.getSummary();
240-
Integer total = spawnSummary.getOrDefault("total", 0);
241-
Integer remoteCacheHits = spawnSummary.getOrDefault("remote cache hit", 0);
242-
return actionSummary.setActionsExecuted(total).setRemoteCacheHits(remoteCacheHits).build();
242+
actionSummary.setActionsExecuted(spawnSummary.getOrDefault("total", 0));
243+
spawnSummary
244+
.entrySet()
245+
.forEach(
246+
e ->
247+
actionSummary.addRunnerCount(
248+
RunnerCount.newBuilder().setName(e.getKey()).setCount(e.getValue()).build()));
249+
return actionSummary.build();
243250
}
244251

245252
private MemoryMetrics createMemoryMetrics() {

0 commit comments

Comments
 (0)