Skip to content

Commit

Permalink
Merge pull request #2204 from murgatroid99/grpc-js_outlier_detection_…
Browse files Browse the repository at this point in the history
…failure_percentage_fix

grpc-js: Outlier Detection: fix failure percentage min hosts check
  • Loading branch information
murgatroid99 committed Aug 24, 2022
2 parents 3db72f9 + 8664c83 commit 1b2cf99
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
Original file line number Diff line number Diff line change
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 addressesWithTargetVolume = 0;
for (const mapEntry of this.addressMap.values()) {
const successes = mapEntry.counter.getLastSuccesses();
const failures = mapEntry.counter.getLastFailures();
if (successes + failures >= failurePercentageConfig.request_volume) {
addressesWithTargetVolume += 1;
}
}
if (addressesWithTargetVolume < failurePercentageConfig.minimum_hosts) {
return;
}

Expand Down

0 comments on commit 1b2cf99

Please sign in to comment.