133
}
134
}
136
>
137
>
// Make sure that at lease 2 hosts must be not ready to trigger this check.
138
>
proportionOfDeclinedServiceHosts := ensureMinimumProportionOfHosts(h.hostDeclinedServingProportion(), len(hosts))
139
>
140
>
var overallState enumsspb.HealthState
141
>
hostDeclinedServingProportion := hostDeclinedServingCount / float64(len(hosts))
142
>
if hostDeclinedServingProportion > proportionOfDeclinedServiceHosts {
143
h.logger.Warn("health check exceeded host declined serving proportion threshold", tag.Float64("host declined serving proportion threshold", proportionOfDeclinedServiceHosts))
144
overallState = enumsspb.HEALTH_STATE_DECLINED_SERVING
146
failedHostCountProportion := failedHostCount / float64(len(hosts))
147
if failedHostCountProportion+hostDeclinedServingProportion > h.hostFailurePercentage() {