Kaynağa Gözat

tech(alerting): improve/cleanup logging

bergquist 9 yıl önce
ebeveyn
işleme
72e23bca5f

+ 0 - 4
pkg/services/alerting/notifier.go

@@ -19,14 +19,11 @@ func NewNotifier() *NotifierImpl {
 }
 
 func (n *NotifierImpl) Notify(alertResult *AlertResult) {
-	n.log.Warn("LETS NOTIFY!!!!A")
 	notifiers := n.getNotifiers(alertResult.AlertJob.Rule.OrgId, []int64{1, 2})
 
 	for _, notifier := range notifiers {
-
 		warn := alertResult.State == alertstates.Warn && notifier.SendWarning
 		crit := alertResult.State == alertstates.Critical && notifier.SendCritical
-		n.log.Warn("looopie", "warn", warn, "crit", crit)
 		if warn || crit {
 			n.log.Info("Sending notification", "state", alertResult.State, "type", notifier.Type)
 			go notifier.Notifierr.Dispatch(alertResult)
@@ -100,7 +97,6 @@ func (n *NotifierImpl) getNotifiers(orgId int64, notificationGroups []int64) []*
 
 	var result []*Notification
 
-	n.log.Warn("query result", "length", len(query.Result))
 	for _, notification := range query.Result {
 		not, err := NewNotificationFromDBModel(notification)
 		if err == nil {

+ 1 - 3
pkg/services/notifications/webhook.go

@@ -32,15 +32,13 @@ func processWebhookQueue() {
 			err := sendWebRequest(webhook)
 
 			if err != nil {
-				webhookLog.Error("Failed to send webrequest ")
+				webhookLog.Error("Failed to send webrequest ", "error", err)
 			}
 		}
 	}
 }
 
 func sendWebRequest(webhook *Webhook) error {
-	webhookLog.Error("Sending stuff! ", "url", webhook.Url)
-
 	client := http.Client{
 		Timeout: time.Duration(3 * time.Second),
 	}