-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Description
https://github.com/grpc/proposal/blob/master/A94-subchannel-otel-metrics.md :
Since currently, only xDS is using these labels, the attributes will be set for each endpoint or address by cds (post-A74) or xds_cluster_resolver (pre-A74) LB policies.
cds vs cluster_resolver isn't important; cluster_resolver was merged into cds for A74, so all the code is going to the same place in either case.
I see the code setting locality, but nothing for backend_service:
grpc-java/xds/src/main/java/io/grpc/xds/ClusterResolverLoadBalancer.java
Lines 194 to 201 in 096c4d9
| endpoint.eag().getAttributes().toBuilder() | |
| .set(io.grpc.xds.XdsAttributes.ATTR_LOCALITY, locality) | |
| .set(EquivalentAddressGroup.ATTR_LOCALITY_NAME, localityName) | |
| .set(io.grpc.xds.XdsAttributes.ATTR_LOCALITY_WEIGHT, | |
| localityLbInfo.localityWeight()) | |
| .set(io.grpc.xds.XdsAttributes.ATTR_SERVER_WEIGHT, weight) | |
| .set(XdsInternalAttributes.ATTR_ADDRESS_NAME, endpoint.hostname()) | |
| .build(); |
I see the code trying to get the backend_service, but it is using a ResolutionResultAttr attribute, which should never be set in the EquivalentAddressGroup:
| addressIndex.getCurrentEagAttributes(), NameResolver.ATTR_BACKEND_SERVICE), |
That attribute is being set today, but it is only in the NameResolver attributes, not in the EAG:
grpc-java/xds/src/main/java/io/grpc/xds/ClusterImplLoadBalancer.java
Lines 156 to 162 in 096c4d9
| childSwitchLb.handleResolvedAddresses( | |
| resolvedAddresses.toBuilder() | |
| .setAttributes(attributes.toBuilder() | |
| .set(NameResolver.ATTR_BACKEND_SERVICE, cluster) | |
| .build()) | |
| .setLoadBalancingPolicyConfig(config.childConfig) | |
| .build()); |
(Note that code will be moving to cds/cluster_resolver to complete A75 in #12431. After that issue and this issue are fixed, all setting of backend_service would be within cds/cluster_resolver.)