fix(health): treat SMTP unhealthy as degraded at app level
This commit is contained in:
@@ -35,12 +35,17 @@ type OverallResult struct {
|
|||||||
|
|
||||||
func determineOverallStatus(results map[string]Result) Status {
|
func determineOverallStatus(results map[string]Result) Status {
|
||||||
hasUnhealthy := false
|
hasUnhealthy := false
|
||||||
|
hasSMTPUnhealthy := false
|
||||||
hasDegraded := false
|
hasDegraded := false
|
||||||
|
|
||||||
for _, result := range results {
|
for name, result := range results {
|
||||||
switch result.Status {
|
switch result.Status {
|
||||||
case StatusUnhealthy:
|
case StatusUnhealthy:
|
||||||
|
if name == "smtp" {
|
||||||
|
hasSMTPUnhealthy = true
|
||||||
|
} else {
|
||||||
hasUnhealthy = true
|
hasUnhealthy = true
|
||||||
|
}
|
||||||
case StatusDegraded:
|
case StatusDegraded:
|
||||||
hasDegraded = true
|
hasDegraded = true
|
||||||
}
|
}
|
||||||
@@ -49,7 +54,7 @@ func determineOverallStatus(results map[string]Result) Status {
|
|||||||
if hasUnhealthy {
|
if hasUnhealthy {
|
||||||
return StatusUnhealthy
|
return StatusUnhealthy
|
||||||
}
|
}
|
||||||
if hasDegraded {
|
if hasDegraded || hasSMTPUnhealthy {
|
||||||
return StatusDegraded
|
return StatusDegraded
|
||||||
}
|
}
|
||||||
return StatusHealthy
|
return StatusHealthy
|
||||||
|
|||||||
Reference in New Issue
Block a user