Chore: capitalise messages for alerting (#74335)
This commit is contained in:
@@ -50,7 +50,7 @@ func (e *AlertEngine) mapRulesToUsageStats(ctx context.Context, rules []*models.
|
||||
for _, a := range rules {
|
||||
dss, err := e.parseAlertRuleModel(a.Settings)
|
||||
if err != nil {
|
||||
e.log.Debug("could not parse settings for alert rule", "id", a.ID)
|
||||
e.log.Debug("Could not parse settings for alert rule", "id", a.ID)
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
@@ -142,11 +142,11 @@ func (n *notificationService) sendAndMarkAsComplete(evalContext *EvalContext, no
|
||||
metrics.MAlertingNotificationSent.WithLabelValues(notifier.GetType()).Inc()
|
||||
|
||||
if err := evalContext.evaluateNotificationTemplateFields(); err != nil {
|
||||
n.log.Error("failed trying to evaluate notification template fields", "uid", notifier.GetNotifierUID(), "error", err)
|
||||
n.log.Error("Failed trying to evaluate notification template fields", "uid", notifier.GetNotifierUID(), "error", err)
|
||||
}
|
||||
|
||||
if err := notifier.Notify(evalContext); err != nil {
|
||||
n.log.Error("failed to send notification", "uid", notifier.GetNotifierUID(), "error", err)
|
||||
n.log.Error("Failed to send notification", "uid", notifier.GetNotifierUID(), "error", err)
|
||||
metrics.MAlertingNotificationFailed.WithLabelValues(notifier.GetType()).Inc()
|
||||
return err
|
||||
}
|
||||
@@ -192,7 +192,7 @@ func (n *notificationService) sendNotifications(evalContext *EvalContext, notifi
|
||||
for _, notifierState := range notifierStates {
|
||||
err := n.sendNotification(evalContext, notifierState)
|
||||
if err != nil {
|
||||
n.log.Error("failed to send notification", "uid", notifierState.notifier.GetNotifierUID(), "error", err)
|
||||
n.log.Error("Failed to send notification", "uid", notifierState.notifier.GetNotifierUID(), "error", err)
|
||||
if evalContext.IsTestRun {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ func (dd *DingDingNotifier) genBody(evalContext *alerting.EvalContext, messageUR
|
||||
// Refer: https://open-doc.dingtalk.com/docs/doc.htm?treeId=385&articleId=104972&docType=1#s9
|
||||
messageURL = "dingtalk://dingtalkclient/page/link?" + q.Encode()
|
||||
|
||||
dd.log.Info("messageUrl:" + messageURL)
|
||||
dd.log.Info("MessageUrl:" + messageURL)
|
||||
|
||||
message := evalContext.Rule.Message
|
||||
picURL := evalContext.ImagePublicURL
|
||||
|
||||
@@ -172,7 +172,7 @@ func (dn *DiscordNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
} else {
|
||||
err := dn.embedImage(cmd, evalContext.ImageOnDiskPath, json)
|
||||
if err != nil {
|
||||
dn.log.Error("failed to embed image", "error", err)
|
||||
dn.log.Error("Failed to embed image", "error", err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ func (gcn *GoogleChatNotifier) Notify(evalContext *alerting.EvalContext) error {
|
||||
|
||||
ruleURL, err := evalContext.GetRuleURL()
|
||||
if err != nil {
|
||||
gcn.log.Error("evalContext returned an invalid rule URL")
|
||||
gcn.log.Error("EvalContext returned an invalid rule URL")
|
||||
}
|
||||
|
||||
widgets := []widget{}
|
||||
|
||||
@@ -103,11 +103,11 @@ func (handler *defaultResultHandler) handle(evalContext *EvalContext) error {
|
||||
if err := handler.notifier.SendIfNeeded(evalContext); err != nil {
|
||||
switch {
|
||||
case errors.Is(err, context.Canceled):
|
||||
handler.log.Debug("handler.notifier.SendIfNeeded returned context.Canceled")
|
||||
handler.log.Debug("Handler.notifier.SendIfNeeded returned context.Canceled")
|
||||
case errors.Is(err, context.DeadlineExceeded):
|
||||
handler.log.Debug("handler.notifier.SendIfNeeded returned context.DeadlineExceeded")
|
||||
handler.log.Debug("Handler.notifier.SendIfNeeded returned context.DeadlineExceeded")
|
||||
default:
|
||||
handler.log.Error("handler.notifier.SendIfNeeded failed", "err", err)
|
||||
handler.log.Error("Handler.notifier.SendIfNeeded failed", "err", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -493,7 +493,7 @@ func (ss *sqlStore) SetAlertNotificationStateToCompleteCommand(ctx context.Conte
|
||||
}
|
||||
|
||||
if current.Version != version {
|
||||
ss.log.Error("notification state out of sync. the notification is marked as complete but has been modified between set as pending and completion.", "notifierId", current.NotifierID)
|
||||
ss.log.Error("Notification state out of sync. the notification is marked as complete but has been modified between set as pending and completion.", "notifierId", current.NotifierID)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user