fix(alerting): Set correct email subject to resolved alert (#572)

fix(alerting): Set correct email subject to resolved alert (#566)
This commit is contained in:
lolgopher
2023-09-22 10:36:42 +09:00
committed by GitHub
parent 0e9df7f00f
commit 8fbfba2163
2 changed files with 4 additions and 3 deletions

View File

@ -67,11 +67,12 @@ func (provider *AlertProvider) Send(endpoint *core.Endpoint, alert *alert.Alert,
// buildMessageSubjectAndBody builds the message subject and body
func (provider *AlertProvider) buildMessageSubjectAndBody(endpoint *core.Endpoint, alert *alert.Alert, result *core.Result, resolved bool) (string, string) {
var message, results string
subject := fmt.Sprintf("[%s] Alert triggered", endpoint.DisplayName())
var subject, message, results string
if resolved {
subject = fmt.Sprintf("[%s] Alert resolved", endpoint.DisplayName())
message = fmt.Sprintf("An alert for %s has been resolved after passing successfully %d time(s) in a row", endpoint.DisplayName(), alert.SuccessThreshold)
} else {
subject = fmt.Sprintf("[%s] Alert triggered", endpoint.DisplayName())
message = fmt.Sprintf("An alert for %s has been triggered due to having failed %d time(s) in a row", endpoint.DisplayName(), alert.FailureThreshold)
}
for _, conditionResult := range result.ConditionResults {