Fixes from PR comments

This commit is contained in:
Michael Lumish 2020-07-27 09:17:06 -07:00
parent 9fb6f48bd6
commit 3c948f5d66
2 changed files with 25 additions and 6 deletions

View File

@ -87,9 +87,9 @@ export class EdsLoadBalancer implements LoadBalancer {
constructor(private readonly channelControlHelper: ChannelControlHelper) {
this.childBalancer = new ChildLoadBalancerHandler({
createSubchannel: (subchannelAddres, subchannelArgs) =>
createSubchannel: (subchannelAddress, subchannelArgs) =>
this.channelControlHelper.createSubchannel(
subchannelAddres,
subchannelAddress,
subchannelArgs
),
requestReresolution: () =>
@ -385,10 +385,13 @@ export class EdsLoadBalancer implements LoadBalancer {
this.isWatcherActive = true;
}
this.clusterDropStats = this.xdsClient.addClusterDropStats(
lbConfig.eds.cluster,
lbConfig.eds.edsServiceName ?? ''
);
if (lbConfig.eds.lrsLoadReportingServerName) {
this.clusterDropStats = this.xdsClient.addClusterDropStats(
lbConfig.eds.lrsLoadReportingServerName,
lbConfig.eds.cluster,
lbConfig.eds.edsServiceName ?? ''
);
}
/* If updateAddressList is called after receiving an update and the update
* is still valid, we want to update the child config with the information

View File

@ -791,10 +791,24 @@ export class XdsClient {
}
}
/**
*
* @param lrsServer The target name of the server to send stats to. An empty
* string indicates that the default LRS client should be used. Currently
* only the empty string is supported here.
* @param clusterName
* @param edsServiceName
*/
addClusterDropStats(
lrsServer: string,
clusterName: string,
edsServiceName: string
): XdsClusterDropStats {
if (lrsServer !== '') {
return {
addCallDropped: category => {}
};
}
const clusterStats = this.clusterStatsMap.getOrCreate(
clusterName,
edsServiceName
@ -810,6 +824,8 @@ export class XdsClient {
shutdown(): void {
this.adsCall?.cancel();
this.adsClient?.close();
this.lrsCall?.cancel();
this.lrsClient?.close();
this.hasShutdown = true;
}
}