Skip to content

Commit 9cbea16

Browse files
authored
xds: stop setting PROXYLESS_CLIENT_HOSTNAME node metadata in LRS requests (grpc#7459)
The PROXYLESS_CLIENT_HOSTNAME node metadata was a temporary workaround for management server to not send back all backend services as load reporting clusters. Now the management server is able to use `send_all_clusters` field to let the client side decide the group of clusters it is reporting loads for. So this node metadata is no longer needed.
1 parent 7ca6c02 commit 9cbea16

File tree

2 files changed

+2
-22
lines changed

2 files changed

+2
-22
lines changed

xds/src/main/java/io/grpc/xds/LoadReportClient.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@
3939
import io.grpc.xds.XdsClient.XdsChannel;
4040
import io.grpc.xds.XdsLogger.XdsLogLevel;
4141
import java.util.ArrayList;
42-
import java.util.HashMap;
4342
import java.util.List;
44-
import java.util.Map;
4543
import java.util.concurrent.ScheduledExecutorService;
4644
import java.util.concurrent.TimeUnit;
4745
import javax.annotation.Nullable;
@@ -53,9 +51,6 @@
5351
*/
5452
@NotThreadSafe
5553
final class LoadReportClient {
56-
@VisibleForTesting
57-
static final String TARGET_NAME_METADATA_KEY = "PROXYLESS_CLIENT_HOSTNAME";
58-
5954
private final InternalLogId logId;
6055
private final XdsLogger logger;
6156
private final XdsChannel xdsChannel;
@@ -91,14 +86,7 @@ final class LoadReportClient {
9186
this.backoffPolicyProvider = checkNotNull(backoffPolicyProvider, "backoffPolicyProvider");
9287
checkNotNull(stopwatchSupplier, "stopwatchSupplier");
9388
this.retryStopwatch = stopwatchSupplier.get();
94-
checkNotNull(targetName, "targetName");
95-
checkNotNull(node, "node");
96-
Map<String, Object> newMetadata = new HashMap<>();
97-
if (node.getMetadata() != null) {
98-
newMetadata.putAll(node.getMetadata());
99-
}
100-
newMetadata.put(TARGET_NAME_METADATA_KEY, targetName);
101-
this.node = node.toBuilder().setMetadata(newMetadata).build();
89+
this.node = checkNotNull(node, "node");
10290
logId = InternalLogId.allocate("lrs-client", targetName);
10391
logger = XdsLogger.withLogId(logId);
10492
logger.log(XdsLogLevel.INFO, "Created");

xds/src/test/java/io/grpc/xds/LoadReportClientTest.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -469,10 +469,7 @@ private static LoadStatsRequest buildInitialRequest() {
469469
Struct.newBuilder()
470470
.putFields(
471471
"TRAFFICDIRECTOR_NETWORK_HOSTNAME",
472-
Value.newBuilder().setStringValue("default").build())
473-
.putFields(
474-
LoadReportClient.TARGET_NAME_METADATA_KEY,
475-
Value.newBuilder().setStringValue(TARGET_NAME).build())))
472+
Value.newBuilder().setStringValue("default").build())))
476473
.build();
477474
}
478475

@@ -490,11 +487,6 @@ private static class LoadStatsRequestMatcher implements ArgumentMatcher<LoadStat
490487

491488
@Override
492489
public boolean matches(LoadStatsRequest argument) {
493-
if (!argument.getNode().getMetadata()
494-
.getFieldsOrThrow(LoadReportClient.TARGET_NAME_METADATA_KEY)
495-
.getStringValue().equals(TARGET_NAME)) {
496-
return false;
497-
}
498490
if (argument.getClusterStatsCount() != expectedStats.size()) {
499491
return false;
500492
}

0 commit comments

Comments
 (0)