Skip to content

Commit

Permalink
Add profile spans to BazelOutputService RPC calls
Browse files Browse the repository at this point in the history
  • Loading branch information
coeuvre committed Apr 8, 2024
1 parent a0c17b0 commit bf16de3
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.google.devtools.build.lib.actions.ExecException;
import com.google.devtools.build.lib.actions.cache.OutputMetadataStore;
import com.google.devtools.build.lib.events.EventHandler;
import com.google.devtools.build.lib.profiler.Profiler;
import com.google.devtools.build.lib.remote.BazelOutputServiceProto.BatchStatRequest;
import com.google.devtools.build.lib.remote.BazelOutputServiceProto.BatchStatResponse;
import com.google.devtools.build.lib.remote.BazelOutputServiceProto.CleanRequest;
Expand Down Expand Up @@ -250,7 +251,7 @@ private StartBuildResponse startBuild(StartBuildRequest request)
() ->
channel.withChannelBlocking(
channel -> {
try {
try (var sc = Profiler.instance().profile("BazelOutputService.StartBuild")) {
return BazelOutputServiceGrpc.newBlockingStub(channel).startBuild(request);
} catch (StatusRuntimeException e) {
throw new IOException(e);
Expand Down Expand Up @@ -295,7 +296,7 @@ private StageArtifactsResponse stageArtifacts(StageArtifactsRequest request)
() ->
channel.withChannelBlocking(
channel -> {
try {
try (var sc = Profiler.instance().profile("BazelOutputService.StageArtifacts")) {
return BazelOutputServiceGrpc.newBlockingStub(channel).stageArtifacts(request);
} catch (StatusRuntimeException e) {
throw new IOException(e);
Expand Down Expand Up @@ -335,7 +336,7 @@ private FinalizeBuildResponse finalizeBuild(FinalizeBuildRequest request)
() ->
channel.withChannelBlocking(
channel -> {
try {
try (var sc = Profiler.instance().profile("BazelOutputService.FinalizeBuild")) {
return BazelOutputServiceGrpc.newBlockingStub(channel).finalizeBuild(request);
} catch (StatusRuntimeException e) {
throw new IOException(e);
Expand Down Expand Up @@ -376,7 +377,8 @@ private FinalizeArtifactsResponse finalizeArtifacts(FinalizeArtifactsRequest req
() ->
channel.withChannelBlocking(
channel -> {
try {
try (var sc =
Profiler.instance().profile("BazelOutputService.FinalizeArtifacts")) {
return BazelOutputServiceGrpc.newBlockingStub(channel)
.finalizeArtifacts(request);
} catch (StatusRuntimeException e) {
Expand Down Expand Up @@ -643,7 +645,7 @@ private CleanResponse clean(CleanRequest request) throws IOException, Interrupte
() ->
channel.withChannelBlocking(
channel -> {
try {
try (var sc = Profiler.instance().profile("BazelOutputService.Clean")) {
return BazelOutputServiceGrpc.newBlockingStub(channel).clean(request);
} catch (StatusRuntimeException e) {
throw new IOException(e);
Expand All @@ -657,7 +659,7 @@ private BatchStatResponse batchStat(BatchStatRequest request)
() ->
channel.withChannelBlocking(
channel -> {
try {
try (var sc = Profiler.instance().profile("BazelOutputService.BatchStat")) {
return BazelOutputServiceGrpc.newBlockingStub(channel).batchStat(request);
} catch (StatusRuntimeException e) {
throw new IOException(e);
Expand Down

0 comments on commit bf16de3

Please sign in to comment.