-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
xds: Add xDS node ID in few control plane errors #11519
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -206,8 +206,9 @@ private void handleClusterDiscovered() { | |
} | ||
loopStatus = Status.UNAVAILABLE.withDescription(String.format( | ||
"CDS error: circular aggregate clusters directly under %s for " | ||
+ "root cluster %s, named %s", | ||
clusterState.name, root.name, namesCausingLoops)); | ||
+ "root cluster %s, named %s xDS node ID: %s", | ||
clusterState.name, root.name, namesCausingLoops, | ||
xdsClient.getBootstrapInfo().node().getId())); | ||
} | ||
} | ||
} | ||
|
@@ -225,8 +226,9 @@ private void handleClusterDiscovered() { | |
childLb = null; | ||
} | ||
Status unavailable = | ||
Status.UNAVAILABLE.withDescription("CDS error: found 0 leaf (logical DNS or EDS) " | ||
+ "clusters for root cluster " + root.name); | ||
Status.UNAVAILABLE.withDescription( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As long as you're updating it, it would be nice to switch to String.format() instead of concatenation There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make sense. Updated to use |
||
"CDS error: found 0 leaf (logical DNS or EDS) clusters for root cluster " | ||
+ root.name + " xDS node ID: " + xdsClient.getBootstrapInfo().node().getId()); | ||
helper.updateBalancingState( | ||
TRANSIENT_FAILURE, new FixedResultPicker(PickResult.withError(unavailable))); | ||
return; | ||
|
@@ -288,11 +290,16 @@ private void addAncestors(Set<String> ancestors, ClusterState clusterState, | |
} | ||
|
||
private void handleClusterDiscoveryError(Status error) { | ||
String description = error.getDescription() == null ? "" : error.getDescription() + " "; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will have two spaces before " xDS node ID" if getDescription() != null. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When description == null, then there will be a one space indent before "xDS node ID", so I'd leave the extra space here and remove it from the string building. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As Larry suggested, removed extra space from string building in L294. |
||
Status errorWithNodeId = Status.fromCode(error.getCode()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought of using |
||
.withDescription( | ||
description + " xDS node ID: " + xdsClient.getBootstrapInfo().node().getId()) | ||
.withCause(error.getCause()); | ||
if (childLb != null) { | ||
childLb.handleNameResolutionError(error); | ||
childLb.handleNameResolutionError(errorWithNodeId); | ||
} else { | ||
helper.updateBalancingState( | ||
TRANSIENT_FAILURE, new FixedResultPicker(PickResult.withError(error))); | ||
TRANSIENT_FAILURE, new FixedResultPicker(PickResult.withError(errorWithNodeId))); | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -815,10 +815,12 @@ private void cleanUpRoutes(String error) { | |
// the config selector handles the error message itself. Once the LB API allows providing | ||
// failure information for addresses yet still providing a service config, the config seector | ||
// could be avoided. | ||
String errorWithNodeId = | ||
error + "xDS node ID: " + xdsClient.getBootstrapInfo().node().getId(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will run together with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should use ", " to separate them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
listener.onResult(ResolutionResult.newBuilder() | ||
.setAttributes(Attributes.newBuilder() | ||
.set(InternalConfigSelector.KEY, | ||
new FailingConfigSelector(Status.UNAVAILABLE.withDescription(error))) | ||
new FailingConfigSelector(Status.UNAVAILABLE.withDescription(errorWithNodeId))) | ||
.build()) | ||
.setServiceConfig(emptyServiceConfig) | ||
.build()); | ||
|
@@ -876,7 +878,8 @@ public void onResourceDoesNotExist(final String resourceName) { | |
if (RouteDiscoveryState.this != routeDiscoveryState) { | ||
return; | ||
} | ||
String error = "RDS resource does not exist: " + resourceName; | ||
String error = "RDS resource does not exist: " + resourceName + " xDS node ID: " | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will have two node IDs included, one here and one in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed xDS node ID from here. |
||
+ xdsClient.getBootstrapInfo().node().getId(); | ||
logger.log(XdsLogLevel.INFO, error); | ||
cleanUpRoutes(error); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comma between named and XDS node ID
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done