You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Decrease log level for directpath warnings outside GCE (#4139)
Directpath is not available outside of GCE. When a Cloud service client
has Directpath enabled, the users with clients outside of GCE receive
this warning and it's not actionable.
Copy file name to clipboardExpand all lines: sdk-platform-java/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java
+41-37Lines changed: 41 additions & 37 deletions
Original file line number
Diff line number
Diff line change
@@ -441,43 +441,47 @@ public boolean isDirectPathXdsEnabled() {
441
441
// builder or createSingleChannel, only in getTransportChannel which creates the first channel
442
442
// for a client.
443
443
privatevoidlogDirectPathMisconfig() {
444
-
if (isDirectPathXdsEnabled()) {
445
-
if (!isDirectPathEnabled()) {
446
-
// This misconfiguration occurs when Direct Path xDS is enabled, but Direct Path is not
447
-
// Direct Path xDS can be enabled two ways: via environment variable or via builder.
448
-
// Case 1: Direct Path is only enabled via xDS env var. We will _warn_ the user that this is
449
-
// a misconfiguration if they intended to set the env var.
450
-
if (isDirectPathXdsEnabledViaEnv()) {
451
-
LOG.log(
452
-
Level.WARNING,
453
-
"Env var "
454
-
+ DIRECT_PATH_ENV_ENABLE_XDS
455
-
+ " was found and set to TRUE, but DirectPath was not enabled for this client. If this is intended for "
456
-
+ "this client, please note that this is a misconfiguration and set the attemptDirectPath option as well.");
457
-
}
458
-
// Case 2: Direct Path xDS was enabled via Builder. Direct Path Traffic Director must be set
459
-
// (enabled with `setAttemptDirectPath(true)`) along with xDS.
"DirectPath is misconfigured. The DirectPath XDS option was set, but the attemptDirectPath option was not. Please set both the attemptDirectPath and attemptDirectPathXds options.");
465
-
}
466
-
} else {
467
-
// Case 3: credential is not correctly set
468
-
if (!isCredentialDirectPathCompatible()) {
469
-
LOG.log(
470
-
Level.WARNING,
471
-
"DirectPath is misconfigured. Please make sure the credential is an instance of "
472
-
+ ComputeEngineCredentials.class.getName()
473
-
+ " .");
474
-
}
475
-
// Case 4: not running on GCE
476
-
if (!isOnComputeEngine()) {
477
-
LOG.log(
478
-
Level.WARNING,
479
-
"DirectPath is misconfigured. DirectPath is only available in a GCE environment.");
"DirectPath is misconfigured. The DirectPath XDS option was set, but the attemptDirectPath option was not. Please set both the attemptDirectPath and attemptDirectPathXds options.");
470
+
}
471
+
} else {
472
+
// Case 3: credential is not correctly set
473
+
if (!isCredentialDirectPathCompatible()) {
474
+
LOG.log(
475
+
level,
476
+
"DirectPath is misconfigured. Please make sure the credential is an instance of "
477
+
+ ComputeEngineCredentials.class.getName()
478
+
+ " .");
479
+
}
480
+
// Case 4: not running on GCE
481
+
if (!isOnComputeEngine()) {
482
+
LOG.log(
483
+
level,
484
+
"DirectPath is misconfigured. DirectPath is only available in a GCE environment.");
Copy file name to clipboardExpand all lines: sdk-platform-java/gax-java/gax-grpc/src/test/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProviderTest.java
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -77,6 +77,7 @@
77
77
importjava.util.concurrent.TimeUnit;
78
78
importjava.util.function.Function;
79
79
importjava.util.logging.Handler;
80
+
importjava.util.logging.Level;
80
81
importjava.util.logging.LogRecord;
81
82
importjava.util.stream.Collectors;
82
83
importjavax.annotation.Nullable;
@@ -645,6 +646,7 @@ private void createAndCloseTransportChannel(InstantiatingGrpcChannelProvider pro
0 commit comments