Skip to content

Commit

Permalink
grpc-js: Outlier Detection: fix failure percentage min hosts check
Browse files Browse the repository at this point in the history
  • Loading branch information
murgatroid99 committed Aug 24, 2022
1 parent 00b33e8 commit f15efb6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/grpc-js/src/load-balancer-outlier-detection.ts
Expand Up @@ -500,7 +500,15 @@ export class OutlierDetectionLoadBalancer implements LoadBalancer {
}
trace('Running failure percentage check. threshold=' + failurePercentageConfig.threshold + ' request volume threshold=' + failurePercentageConfig.request_volume);
// Step 1
if (this.addressMap.size < failurePercentageConfig.minimum_hosts) {
let addresesWithTargetVolume = 0;
for (const mapEntry of this.addressMap.values()) {
const successes = mapEntry.counter.getLastSuccesses();
const failures = mapEntry.counter.getLastFailures();
if (successes + failures >= failurePercentageConfig.request_volume) {
addresesWithTargetVolume += 1;
}
}
if (addresesWithTargetVolume < failurePercentageConfig.minimum_hosts) {
return;
}

Expand Down

0 comments on commit f15efb6

Please sign in to comment.