xds: Add xDS node ID in few control plane errors#11519
xds: Add xDS node ID in few control plane errors#11519DNVindhya merged 3 commits intogrpc:masterfrom
Conversation
|
|
||
| private void handleClusterDiscoveryError(Status error) { | ||
| String description = error.getDescription() == null ? "" : error.getDescription() + " "; | ||
| Status errorWithNodeId = Status.fromCode(error.getCode()) |
There was a problem hiding this comment.
Just use error.withDescription(). That will replace the existing description without modifying the other parts. (So you don't need to fiddle with code and cause)
There was a problem hiding this comment.
I thought of using error.augmentDescription but didn't realize this method existed. Thanks for pointing it out, updated to use error.withDescription instead.
| } | ||
|
|
||
| private void handleClusterDiscoveryError(Status error) { | ||
| String description = error.getDescription() == null ? "" : error.getDescription() + " "; |
There was a problem hiding this comment.
This will have two spaces before " xDS node ID" if getDescription() != null.
There was a problem hiding this comment.
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.
As Larry suggested, removed extra space from string building in L294.
| // 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.
This will run together with error. There's not even a space separating them.
There was a problem hiding this comment.
Should use ", " to separate them.
| 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.
This will have two node IDs included, one here and one in cleanUpRoutes().
There was a problem hiding this comment.
Removed xDS node ID from here.
| "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", |
There was a problem hiding this comment.
Add a comma between named and XDS node ID
| 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.
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.
Make sense. Updated to use String.format().
| } | ||
|
|
||
| private void handleClusterDiscoveryError(Status error) { | ||
| String description = error.getDescription() == null ? "" : error.getDescription() + " "; |
There was a problem hiding this comment.
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.
| // 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.
Should use ", " to separate them.
| "CDS error: circular aggregate clusters directly under cluster-02.googleapis.com for root" | ||
| + " cluster cluster-foo.googleapis.com, named [cluster-01.googleapis.com," | ||
| + " cluster-02.googleapis.com]"); | ||
| + " cluster-02.googleapis.com]" + ", xDS node ID: " + NODE_ID); |
There was a problem hiding this comment.
Combine the two string literals on the same line together. Ditto bellow.
This PR adds xDS node ID in control plane errors to enable cross-referencing with control plane logs when debugging (b/364405814).
CC @fengli79