mirror of https://github.com/grpc/grpc-node.git
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:
commit
1b2cf99bf6
|
@ -500,7 +500,15 @@ export class OutlierDetectionLoadBalancer implements LoadBalancer {
|
||||||
}
|
}
|
||||||
trace('Running failure percentage check. threshold=' + failurePercentageConfig.threshold + ' request volume threshold=' + failurePercentageConfig.request_volume);
|
trace('Running failure percentage check. threshold=' + failurePercentageConfig.threshold + ' request volume threshold=' + failurePercentageConfig.request_volume);
|
||||||
// Step 1
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue