From f93bfb72277b1ff4ae5eb8f5ce7537c027a80c28 Mon Sep 17 00:00:00 2001 From: mohanli-ml Date: Wed, 11 Oct 2023 22:37:48 +0000 Subject: [PATCH 1/8] feat: log DirectPath misconfiguration --- .../InstantiatingGrpcChannelProvider.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java b/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java index 06d0c18e51..550cd602cf 100644 --- a/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java +++ b/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java @@ -64,6 +64,8 @@ import java.util.concurrent.Executor; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.annotation.Nullable; import javax.net.ssl.KeyManagerFactory; import org.threeten.bp.Duration; @@ -82,6 +84,8 @@ */ @InternalExtensionOnly public final class InstantiatingGrpcChannelProvider implements TransportChannelProvider { + private static final Logger LOG = + Logger.getLogger(InstantiatingGrpcChannelProvider.class.getName()); private static final String DIRECT_PATH_ENV_DISABLE_DIRECT_PATH = "GOOGLE_CLOUD_DISABLE_DIRECT_PATH"; private static final String DIRECT_PATH_ENV_ENABLE_XDS = "GOOGLE_CLOUD_ENABLE_DIRECT_PATH_XDS"; @@ -266,6 +270,40 @@ boolean isDirectPathXdsEnabled() { return false; } + private void logDirectPathMisconfig() { + boolean isDirectPathOptionSet = Boolean.TRUE.equals(attemptDirectPath); + boolean isDirectPathXdsEnvSet = + Boolean.parseBoolean(envProvider.getenv(DIRECT_PATH_ENV_ENABLE_XDS)); + boolean isDirectPathXdsOptionSet = Boolean.TRUE.equals(attemptDirectPathXds); + if (isDirectPathOptionSet || isDirectPathXdsEnvSet || isDirectPathXdsOptionSet) { + // Case 1: use DirectPath with gRPCLB + if (isDirectPathOptionSet && !(isDirectPathXdsEnvSet || isDirectPathXdsOptionSet)) { + // TODO: Add the warning once we move traffic out from gRPCLB + } + + // Case 2: just enable DirectPath xDS + if (!isDirectPathOptionSet && (isDirectPathXdsEnvSet || isDirectPathXdsOptionSet)) { + LOG.log( + Level.WARNING, "DirectPath is misconfigured. Please set the attemptDirectPath option."); + } + + if (isDirectPathXdsEnvSet && (isDirectPathOptionSet || isDirectPathXdsOptionSet)) { + // Case 3: credential is not correctly set + if (!isNonDefaultServiceAccountAllowed()) { + LOG.log( + Level.WARNING, + "DirectPath is misconfigured. Please make sure the credential is an instance of" + + " ComputeEngineCredentials."); + } + // Case 4: not running on GCE + if (!isOnComputeEngine()) { + LOG.log( + Level.WARNING, "DirectPath is misconfigured. Please run in the GCE environment. "); + } + } + } + } + private boolean isNonDefaultServiceAccountAllowed() { if (allowNonDefaultServiceAccount != null && allowNonDefaultServiceAccount) { return true; @@ -341,6 +379,7 @@ private ManagedChannel createSingleChannel() throws IOException { builder.keepAliveTime(DIRECT_PATH_KEEP_ALIVE_TIME_SECONDS, TimeUnit.SECONDS); builder.keepAliveTimeout(DIRECT_PATH_KEEP_ALIVE_TIMEOUT_SECONDS, TimeUnit.SECONDS); } else { + logDirectPathMisconfig(); ChannelCredentials channelCredentials; try { channelCredentials = createMtlsChannelCredentials(); From 6454a4690c5674a5afa22604ec66b290bb1fddef Mon Sep 17 00:00:00 2001 From: mohanli-ml Date: Thu, 12 Oct 2023 18:41:39 +0000 Subject: [PATCH 2/8] feat: log DirectPath misconfiguration --- .../api/gax/grpc/InstantiatingGrpcChannelProvider.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java b/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java index 550cd602cf..4d5a477419 100644 --- a/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java +++ b/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java @@ -270,7 +270,7 @@ boolean isDirectPathXdsEnabled() { return false; } - private void logDirectPathMisconfig() { + private void logDirectPathMisconfig(String serviceAddress) { boolean isDirectPathOptionSet = Boolean.TRUE.equals(attemptDirectPath); boolean isDirectPathXdsEnvSet = Boolean.parseBoolean(envProvider.getenv(DIRECT_PATH_ENV_ENABLE_XDS)); @@ -287,7 +287,10 @@ private void logDirectPathMisconfig() { Level.WARNING, "DirectPath is misconfigured. Please set the attemptDirectPath option."); } - if (isDirectPathXdsEnvSet && (isDirectPathOptionSet || isDirectPathXdsOptionSet)) { + // The following WARNING logs are GCS only. + if (serviceAddress.contains("storage.googleapis.com") + && isDirectPathXdsEnvSet + && (isDirectPathOptionSet || isDirectPathXdsOptionSet)) { // Case 3: credential is not correctly set if (!isNonDefaultServiceAccountAllowed()) { LOG.log( @@ -379,7 +382,7 @@ private ManagedChannel createSingleChannel() throws IOException { builder.keepAliveTime(DIRECT_PATH_KEEP_ALIVE_TIME_SECONDS, TimeUnit.SECONDS); builder.keepAliveTimeout(DIRECT_PATH_KEEP_ALIVE_TIMEOUT_SECONDS, TimeUnit.SECONDS); } else { - logDirectPathMisconfig(); + logDirectPathMisconfig(serviceAddress); ChannelCredentials channelCredentials; try { channelCredentials = createMtlsChannelCredentials(); From ec9116e3ee67293341fc1d3a2371f9e324f2aacc Mon Sep 17 00:00:00 2001 From: mohanli-ml Date: Thu, 12 Oct 2023 20:58:00 +0000 Subject: [PATCH 3/8] feat: log DirectPath misconfiguration --- .../InstantiatingGrpcChannelProvider.java | 26 ++++++------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java b/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java index 4d5a477419..13fd87d0cb 100644 --- a/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java +++ b/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java @@ -237,6 +237,7 @@ public TransportChannel getTransportChannel() throws IOException { } private TransportChannel createChannel() throws IOException { + logDirectPathMisconfig(); return GrpcTransportChannel.create( ChannelPool.create( channelPoolSettings, InstantiatingGrpcChannelProvider.this::createSingleChannel)); @@ -270,35 +271,25 @@ boolean isDirectPathXdsEnabled() { return false; } - private void logDirectPathMisconfig(String serviceAddress) { + private void logDirectPathMisconfig() { boolean isDirectPathOptionSet = Boolean.TRUE.equals(attemptDirectPath); boolean isDirectPathXdsEnvSet = Boolean.parseBoolean(envProvider.getenv(DIRECT_PATH_ENV_ENABLE_XDS)); boolean isDirectPathXdsOptionSet = Boolean.TRUE.equals(attemptDirectPathXds); - if (isDirectPathOptionSet || isDirectPathXdsEnvSet || isDirectPathXdsOptionSet) { - // Case 1: use DirectPath with gRPCLB - if (isDirectPathOptionSet && !(isDirectPathXdsEnvSet || isDirectPathXdsOptionSet)) { - // TODO: Add the warning once we move traffic out from gRPCLB - } - - // Case 2: just enable DirectPath xDS - if (!isDirectPathOptionSet && (isDirectPathXdsEnvSet || isDirectPathXdsOptionSet)) { + if (isDirectPathXdsEnvSet || isDirectPathXdsOptionSet) { + // Case 1: does not enable DirectPath + if (!isDirectPathOptionSet) { LOG.log( Level.WARNING, "DirectPath is misconfigured. Please set the attemptDirectPath option."); - } - - // The following WARNING logs are GCS only. - if (serviceAddress.contains("storage.googleapis.com") - && isDirectPathXdsEnvSet - && (isDirectPathOptionSet || isDirectPathXdsOptionSet)) { - // Case 3: credential is not correctly set + } else { + // Case 2: credential is not correctly set if (!isNonDefaultServiceAccountAllowed()) { LOG.log( Level.WARNING, "DirectPath is misconfigured. Please make sure the credential is an instance of" + " ComputeEngineCredentials."); } - // Case 4: not running on GCE + // Case 3: not running on GCE if (!isOnComputeEngine()) { LOG.log( Level.WARNING, "DirectPath is misconfigured. Please run in the GCE environment. "); @@ -382,7 +373,6 @@ private ManagedChannel createSingleChannel() throws IOException { builder.keepAliveTime(DIRECT_PATH_KEEP_ALIVE_TIME_SECONDS, TimeUnit.SECONDS); builder.keepAliveTimeout(DIRECT_PATH_KEEP_ALIVE_TIMEOUT_SECONDS, TimeUnit.SECONDS); } else { - logDirectPathMisconfig(serviceAddress); ChannelCredentials channelCredentials; try { channelCredentials = createMtlsChannelCredentials(); From 752b4a3684ff8de358caeeaf58ca5950be74ca7d Mon Sep 17 00:00:00 2001 From: mohanli-ml Date: Mon, 16 Oct 2023 23:40:15 +0000 Subject: [PATCH 4/8] feat: log DirectPath misconfiguration --- .../gax/grpc/InstantiatingGrpcChannelProvider.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java b/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java index 13fd87d0cb..a6710b9c86 100644 --- a/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java +++ b/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java @@ -280,19 +280,23 @@ private void logDirectPathMisconfig() { // Case 1: does not enable DirectPath if (!isDirectPathOptionSet) { LOG.log( - Level.WARNING, "DirectPath is misconfigured. Please set the attemptDirectPath option."); + Level.WARNING, + "DirectPath is misconfigured. Please set the attemptDirectPath option along with the" + + " attemptDirectPathXds option."); } else { // Case 2: credential is not correctly set if (!isNonDefaultServiceAccountAllowed()) { LOG.log( Level.WARNING, - "DirectPath is misconfigured. Please make sure the credential is an instance of" - + " ComputeEngineCredentials."); + "DirectPath is misconfigured. Please make sure the credential is an instance of " + + ComputeEngineCredentials.class.getName() + + " ."); } // Case 3: not running on GCE if (!isOnComputeEngine()) { LOG.log( - Level.WARNING, "DirectPath is misconfigured. Please run in the GCE environment. "); + Level.WARNING, + "DirectPath is misconfigured. DirectPath is only available in a GCE environment."); } } } From f7647865512209a19d0a1d9e7464a6dad0824920 Mon Sep 17 00:00:00 2001 From: mohanli-ml Date: Tue, 17 Oct 2023 20:44:47 +0000 Subject: [PATCH 5/8] feat: log DirectPath misconfiguration --- .../api/gax/grpc/InstantiatingGrpcChannelProvider.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java b/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java index a6710b9c86..9fd207ece3 100644 --- a/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java +++ b/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java @@ -144,6 +144,7 @@ private InstantiatingGrpcChannelProvider(Builder builder) { builder.directPathServiceConfig == null ? getDefaultDirectPathServiceConfig() : builder.directPathServiceConfig; + logDirectPathMisconfig(); } /** @@ -237,7 +238,6 @@ public TransportChannel getTransportChannel() throws IOException { } private TransportChannel createChannel() throws IOException { - logDirectPathMisconfig(); return GrpcTransportChannel.create( ChannelPool.create( channelPoolSettings, InstantiatingGrpcChannelProvider.this::createSingleChannel)); @@ -272,13 +272,9 @@ boolean isDirectPathXdsEnabled() { } private void logDirectPathMisconfig() { - boolean isDirectPathOptionSet = Boolean.TRUE.equals(attemptDirectPath); - boolean isDirectPathXdsEnvSet = - Boolean.parseBoolean(envProvider.getenv(DIRECT_PATH_ENV_ENABLE_XDS)); - boolean isDirectPathXdsOptionSet = Boolean.TRUE.equals(attemptDirectPathXds); - if (isDirectPathXdsEnvSet || isDirectPathXdsOptionSet) { + if (isDirectPathXdsEnabled()) { // Case 1: does not enable DirectPath - if (!isDirectPathOptionSet) { + if (!isDirectPathXdsEnabled()) { LOG.log( Level.WARNING, "DirectPath is misconfigured. Please set the attemptDirectPath option along with the" From 1c5f4bb949bdaad3306c21e83a46bd85181625dc Mon Sep 17 00:00:00 2001 From: mohanli-ml Date: Tue, 17 Oct 2023 22:03:46 +0000 Subject: [PATCH 6/8] feat: log DirectPath misconfiguration --- .../InstantiatingGrpcChannelProvider.java | 8 ++- .../InstantiatingGrpcChannelProviderTest.java | 57 +++++++++++++++++++ 2 files changed, 62 insertions(+), 3 deletions(-) diff --git a/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java b/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java index 9fd207ece3..4e7a654f7e 100644 --- a/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java +++ b/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java @@ -84,8 +84,9 @@ */ @InternalExtensionOnly public final class InstantiatingGrpcChannelProvider implements TransportChannelProvider { - private static final Logger LOG = - Logger.getLogger(InstantiatingGrpcChannelProvider.class.getName()); + @VisibleForTesting + static final Logger LOG = Logger.getLogger(InstantiatingGrpcChannelProvider.class.getName()); + private static final String DIRECT_PATH_ENV_DISABLE_DIRECT_PATH = "GOOGLE_CLOUD_DISABLE_DIRECT_PATH"; private static final String DIRECT_PATH_ENV_ENABLE_XDS = "GOOGLE_CLOUD_ENABLE_DIRECT_PATH_XDS"; @@ -274,7 +275,7 @@ boolean isDirectPathXdsEnabled() { private void logDirectPathMisconfig() { if (isDirectPathXdsEnabled()) { // Case 1: does not enable DirectPath - if (!isDirectPathXdsEnabled()) { + if (!isDirectPathEnabled()) { LOG.log( Level.WARNING, "DirectPath is misconfigured. Please set the attemptDirectPath option along with the" @@ -307,6 +308,7 @@ private boolean isNonDefaultServiceAccountAllowed() { // DirectPath should only be used on Compute Engine. // Notice Windows is supported for now. + @VisibleForTesting static boolean isOnComputeEngine() { String osName = System.getProperty("os.name"); if ("Linux".equals(osName)) { diff --git a/gax-java/gax-grpc/src/test/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProviderTest.java b/gax-java/gax-grpc/src/test/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProviderTest.java index d58a3b56b6..6b139f8eb5 100644 --- a/gax-java/gax-grpc/src/test/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProviderTest.java +++ b/gax-java/gax-grpc/src/test/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProviderTest.java @@ -56,6 +56,9 @@ import java.util.concurrent.Executor; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.logging.Handler; +import java.util.logging.LogRecord; +import java.util.stream.Collectors; import javax.annotation.Nullable; import org.junit.Test; import org.junit.runner.RunWith; @@ -503,4 +506,58 @@ protected Object getMtlsObjectFromTransportChannel(MtlsProvider provider) .build(); return channelProvider.createMtlsChannelCredentials(); } + + @Test + public void testDirectPathMisconfigLog() { + { + FakeLogHandler logHandler = new FakeLogHandler(); + InstantiatingGrpcChannelProvider.LOG.addHandler(logHandler); + InstantiatingGrpcChannelProvider provider = + InstantiatingGrpcChannelProvider.newBuilder().setAttemptDirectPathXds().build(); + assertThat(logHandler.getAllMessages()) + .contains( + "DirectPath is misconfigured. Please set the attemptDirectPath option along with the" + + " attemptDirectPathXds option."); + InstantiatingGrpcChannelProvider.LOG.removeHandler(logHandler); + } + + { + FakeLogHandler logHandler = new FakeLogHandler(); + InstantiatingGrpcChannelProvider.LOG.addHandler(logHandler); + InstantiatingGrpcChannelProvider provider = + InstantiatingGrpcChannelProvider.newBuilder() + .setAttemptDirectPathXds() + .setAttemptDirectPath(true) + .build(); + assertThat(logHandler.getAllMessages()) + .contains( + "DirectPath is misconfigured. Please make sure the credential is an instance of" + + " com.google.auth.oauth2.ComputeEngineCredentials ."); + if (!InstantiatingGrpcChannelProvider.isOnComputeEngine()) { + assertThat(logHandler.getAllMessages()) + .contains( + "DirectPath is misconfigured. DirectPath is only available in a GCE environment"); + } + InstantiatingGrpcChannelProvider.LOG.removeHandler(logHandler); + } + } + + private static class FakeLogHandler extends Handler { + List records = new ArrayList<>(); + + @Override + public void publish(LogRecord record) { + records.add(record); + } + + @Override + public void flush() {} + + @Override + public void close() throws SecurityException {} + + List getAllMessages() { + return records.stream().map(LogRecord::getMessage).collect(Collectors.toList()); + } + } } From b3ce533769c89fc87629736227236d02952c1c7b Mon Sep 17 00:00:00 2001 From: mohanli-ml Date: Tue, 17 Oct 2023 22:50:09 +0000 Subject: [PATCH 7/8] feat: log DirectPath misconfiguration --- .../InstantiatingGrpcChannelProviderTest.java | 68 +++++++++++-------- 1 file changed, 40 insertions(+), 28 deletions(-) diff --git a/gax-java/gax-grpc/src/test/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProviderTest.java b/gax-java/gax-grpc/src/test/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProviderTest.java index 6b139f8eb5..8594ac2d2a 100644 --- a/gax-java/gax-grpc/src/test/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProviderTest.java +++ b/gax-java/gax-grpc/src/test/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProviderTest.java @@ -508,38 +508,50 @@ protected Object getMtlsObjectFromTransportChannel(MtlsProvider provider) } @Test - public void testDirectPathMisconfigLog() { - { - FakeLogHandler logHandler = new FakeLogHandler(); - InstantiatingGrpcChannelProvider.LOG.addHandler(logHandler); - InstantiatingGrpcChannelProvider provider = - InstantiatingGrpcChannelProvider.newBuilder().setAttemptDirectPathXds().build(); - assertThat(logHandler.getAllMessages()) - .contains( - "DirectPath is misconfigured. Please set the attemptDirectPath option along with the" - + " attemptDirectPathXds option."); - InstantiatingGrpcChannelProvider.LOG.removeHandler(logHandler); - } + public void testLogDirectPathMisconfigAttrempDirectPathNotSet() { + FakeLogHandler logHandler = new FakeLogHandler(); + InstantiatingGrpcChannelProvider.LOG.addHandler(logHandler); + InstantiatingGrpcChannelProvider provider = + InstantiatingGrpcChannelProvider.newBuilder().setAttemptDirectPathXds().build(); + assertThat(logHandler.getAllMessages()) + .contains( + "DirectPath is misconfigured. Please set the attemptDirectPath option along with the" + + " attemptDirectPathXds option."); + InstantiatingGrpcChannelProvider.LOG.removeHandler(logHandler); + } - { - FakeLogHandler logHandler = new FakeLogHandler(); - InstantiatingGrpcChannelProvider.LOG.addHandler(logHandler); - InstantiatingGrpcChannelProvider provider = - InstantiatingGrpcChannelProvider.newBuilder() - .setAttemptDirectPathXds() - .setAttemptDirectPath(true) - .build(); + @Test + public void testLogDirectPathMisconfigWrongCredential() { + FakeLogHandler logHandler = new FakeLogHandler(); + InstantiatingGrpcChannelProvider.LOG.addHandler(logHandler); + InstantiatingGrpcChannelProvider provider = + InstantiatingGrpcChannelProvider.newBuilder() + .setAttemptDirectPathXds() + .setAttemptDirectPath(true) + .build(); + assertThat(logHandler.getAllMessages()) + .contains( + "DirectPath is misconfigured. Please make sure the credential is an instance of" + + " com.google.auth.oauth2.ComputeEngineCredentials ."); + InstantiatingGrpcChannelProvider.LOG.removeHandler(logHandler); + } + + @Test + public void testLogDirectPathMisconfigNotOnGCE() { + FakeLogHandler logHandler = new FakeLogHandler(); + InstantiatingGrpcChannelProvider.LOG.addHandler(logHandler); + InstantiatingGrpcChannelProvider provider = + InstantiatingGrpcChannelProvider.newBuilder() + .setAttemptDirectPathXds() + .setAttemptDirectPath(true) + .setAllowNonDefaultServiceAccount(true) + .build(); + if (!InstantiatingGrpcChannelProvider.isOnComputeEngine()) { assertThat(logHandler.getAllMessages()) .contains( - "DirectPath is misconfigured. Please make sure the credential is an instance of" - + " com.google.auth.oauth2.ComputeEngineCredentials ."); - if (!InstantiatingGrpcChannelProvider.isOnComputeEngine()) { - assertThat(logHandler.getAllMessages()) - .contains( - "DirectPath is misconfigured. DirectPath is only available in a GCE environment"); - } - InstantiatingGrpcChannelProvider.LOG.removeHandler(logHandler); + "DirectPath is misconfigured. DirectPath is only available in a GCE environment"); } + InstantiatingGrpcChannelProvider.LOG.removeHandler(logHandler); } private static class FakeLogHandler extends Handler { From cb685dcd2d2dca09775769f37f5181e8f5af500c Mon Sep 17 00:00:00 2001 From: mohanli-ml Date: Wed, 18 Oct 2023 16:53:12 +0000 Subject: [PATCH 8/8] feat: log DirectPath misconfiguration --- .../api/gax/grpc/InstantiatingGrpcChannelProviderTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gax-java/gax-grpc/src/test/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProviderTest.java b/gax-java/gax-grpc/src/test/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProviderTest.java index 8594ac2d2a..edd7a73768 100644 --- a/gax-java/gax-grpc/src/test/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProviderTest.java +++ b/gax-java/gax-grpc/src/test/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProviderTest.java @@ -549,7 +549,7 @@ public void testLogDirectPathMisconfigNotOnGCE() { if (!InstantiatingGrpcChannelProvider.isOnComputeEngine()) { assertThat(logHandler.getAllMessages()) .contains( - "DirectPath is misconfigured. DirectPath is only available in a GCE environment"); + "DirectPath is misconfigured. DirectPath is only available in a GCE environment."); } InstantiatingGrpcChannelProvider.LOG.removeHandler(logHandler); }