Log xDS node ID with verbosity INFO (#9731)

Log xDS node ID so that we can better debug DirectPath issues.

b/260634412
This commit is contained in:
Mohan Li 2022-12-06 08:06:00 -08:00 committed by GitHub
parent e14cba0bae
commit bf0b92a963
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -60,6 +60,8 @@ import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nullable;
/**
@ -67,6 +69,10 @@ import javax.annotation.Nullable;
*/
final class XdsClientImpl extends XdsClient implements XdsResponseHandler, ResourceStore {
private static boolean LOG_XDS_NODE_ID = Boolean.parseBoolean(
System.getenv("GRPC_LOG_XDS_NODE_ID"));
private static final Logger classLogger = Logger.getLogger(XdsClientImpl.class.getName());
// Longest time to wait, since the subscription to some resource, for concluding its absence.
@VisibleForTesting
static final int INITIAL_RESOURCE_FETCH_TIMEOUT_SEC = 15;
@ -126,6 +132,9 @@ final class XdsClientImpl extends XdsClient implements XdsResponseHandler, Resou
logId = InternalLogId.allocate("xds-client", null);
logger = XdsLogger.withLogId(logId);
logger.log(XdsLogLevel.INFO, "Created");
if (LOG_XDS_NODE_ID) {
classLogger.log(Level.INFO, "xDS node ID: {0}", bootstrapInfo.node().getId());
}
}
private void maybeCreateXdsChannelWithLrs(ServerInfo serverInfo) {