Merge pull request #2204 from murgatroid99/grpc-js_outlier_detection_failure_percentage_fix

grpc-js: Outlier Detection: fix failure percentage min hosts check
This commit is contained in:
Michael Lumish 2022-08-24 14:24:59 -07:00 committed by GitHub
commit 1b2cf99bf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -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;
}