mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-19 06:59:50 +02:00
feat(health): add health check detail to health api
This commit is contained in:
@@ -266,6 +266,12 @@ func (lb *LoadBalancer) Status() health.Status {
|
||||
return status
|
||||
}
|
||||
|
||||
// Detail implements health.HealthMonitor.
|
||||
func (lb *LoadBalancer) Detail() string {
|
||||
_, numHealthy := lb.status()
|
||||
return fmt.Sprintf("%d/%d servers are healthy", numHealthy, lb.pool.Size())
|
||||
}
|
||||
|
||||
func (lb *LoadBalancer) status() (status health.Status, numHealthy int) {
|
||||
if lb.pool.Size() == 0 {
|
||||
return health.StatusUnknown, 0
|
||||
|
||||
Reference in New Issue
Block a user