Skip to content

Log xDS node ID with verbosity INFO #9731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions xds/src/main/java/io/grpc/xds/XdsClientImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,19 @@
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;

/**
* XdsClient implementation for client side usages.
*/
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;
Expand Down Expand Up @@ -126,6 +132,9 @@ public void uncaughtException(Thread t, Throwable e) {
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) {
Expand Down