|
59 | 59 | import com.google.devtools.build.lib.exec.ExecutorBuilder;
|
60 | 60 | import com.google.devtools.build.lib.exec.ModuleActionContextRegistry;
|
61 | 61 | import com.google.devtools.build.lib.exec.SpawnStrategyRegistry;
|
| 62 | +import com.google.devtools.build.lib.profiler.Profiler; |
62 | 63 | import com.google.devtools.build.lib.remote.RemoteServerCapabilities.ServerCapabilitiesRequirement;
|
63 | 64 | import com.google.devtools.build.lib.remote.circuitbreaker.CircuitBreakerFactory;
|
64 | 65 | import com.google.devtools.build.lib.remote.common.RemoteCacheClient;
|
@@ -443,45 +444,49 @@ public void beforeCommand(CommandEnvironment env) throws AbruptExitException {
|
443 | 444 | }
|
444 | 445 |
|
445 | 446 | if (enableRemoteExecution) {
|
446 |
| - ImmutableList.Builder<ClientInterceptor> interceptors = ImmutableList.builder(); |
447 |
| - interceptors.add(TracingMetadataUtils.newExecHeadersInterceptor(remoteOptions)); |
448 |
| - if (loggingInterceptor != null) { |
449 |
| - interceptors.add(loggingInterceptor); |
450 |
| - } |
451 |
| - execChannel = |
452 |
| - new ReferenceCountedChannel( |
453 |
| - new GoogleChannelConnectionFactory( |
454 |
| - channelFactory, |
455 |
| - remoteOptions.remoteExecutor, |
456 |
| - remoteOptions.remoteProxy, |
457 |
| - authAndTlsOptions, |
458 |
| - interceptors.build(), |
459 |
| - maxConcurrencyPerConnection), |
460 |
| - maxConnections); |
461 |
| - |
462 |
| - // Create a separate channel if --remote_executor and --remote_cache point to different |
463 |
| - // endpoints. |
464 |
| - if (remoteOptions.remoteCache.equals(remoteOptions.remoteExecutor)) { |
465 |
| - cacheChannel = execChannel.retain(); |
| 447 | + try (var s = Profiler.instance().profile("init exec channel")) { |
| 448 | + ImmutableList.Builder<ClientInterceptor> interceptors = ImmutableList.builder(); |
| 449 | + interceptors.add(TracingMetadataUtils.newExecHeadersInterceptor(remoteOptions)); |
| 450 | + if (loggingInterceptor != null) { |
| 451 | + interceptors.add(loggingInterceptor); |
| 452 | + } |
| 453 | + execChannel = |
| 454 | + new ReferenceCountedChannel( |
| 455 | + new GoogleChannelConnectionFactory( |
| 456 | + channelFactory, |
| 457 | + remoteOptions.remoteExecutor, |
| 458 | + remoteOptions.remoteProxy, |
| 459 | + authAndTlsOptions, |
| 460 | + interceptors.build(), |
| 461 | + maxConcurrencyPerConnection), |
| 462 | + maxConnections); |
| 463 | + |
| 464 | + // Create a separate channel if --remote_executor and --remote_cache point to different |
| 465 | + // endpoints. |
| 466 | + if (remoteOptions.remoteCache.equals(remoteOptions.remoteExecutor)) { |
| 467 | + cacheChannel = execChannel.retain(); |
| 468 | + } |
466 | 469 | }
|
467 | 470 | }
|
468 | 471 |
|
469 | 472 | if (cacheChannel == null) {
|
470 |
| - ImmutableList.Builder<ClientInterceptor> interceptors = ImmutableList.builder(); |
471 |
| - interceptors.add(TracingMetadataUtils.newCacheHeadersInterceptor(remoteOptions)); |
472 |
| - if (loggingInterceptor != null) { |
473 |
| - interceptors.add(loggingInterceptor); |
| 473 | + try (var s = Profiler.instance().profile("init cache channel")) { |
| 474 | + ImmutableList.Builder<ClientInterceptor> interceptors = ImmutableList.builder(); |
| 475 | + interceptors.add(TracingMetadataUtils.newCacheHeadersInterceptor(remoteOptions)); |
| 476 | + if (loggingInterceptor != null) { |
| 477 | + interceptors.add(loggingInterceptor); |
| 478 | + } |
| 479 | + cacheChannel = |
| 480 | + new ReferenceCountedChannel( |
| 481 | + new GoogleChannelConnectionFactory( |
| 482 | + channelFactory, |
| 483 | + remoteOptions.remoteCache, |
| 484 | + remoteOptions.remoteProxy, |
| 485 | + authAndTlsOptions, |
| 486 | + interceptors.build(), |
| 487 | + maxConcurrencyPerConnection), |
| 488 | + maxConnections); |
474 | 489 | }
|
475 |
| - cacheChannel = |
476 |
| - new ReferenceCountedChannel( |
477 |
| - new GoogleChannelConnectionFactory( |
478 |
| - channelFactory, |
479 |
| - remoteOptions.remoteCache, |
480 |
| - remoteOptions.remoteProxy, |
481 |
| - authAndTlsOptions, |
482 |
| - interceptors.build(), |
483 |
| - maxConcurrencyPerConnection), |
484 |
| - maxConnections); |
485 | 490 | }
|
486 | 491 |
|
487 | 492 | if (enableRemoteDownloader) {
|
@@ -526,7 +531,7 @@ public void beforeCommand(CommandEnvironment env) throws AbruptExitException {
|
526 | 531 | // capabilities respectively.
|
527 | 532 | ServerCapabilities executionCapabilities = null;
|
528 | 533 | ServerCapabilities cacheCapabilities = null;
|
529 |
| - try { |
| 534 | + try (var s = Profiler.instance().profile("check server capabilities")) { |
530 | 535 | if (execChannel != null) {
|
531 | 536 | if (cacheChannel != execChannel) {
|
532 | 537 | executionCapabilities =
|
|
0 commit comments