tech(alerting): improve/cleanup logging

This commit is contained in:
bergquist 2016-06-16 08:56:19 +02:00
parent 4d03e04172
commit 72e23bca5f
2 changed files with 1 additions and 7 deletions

View File

@ -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 {

View File

@ -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),
}