mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
tech(alerting): improve/cleanup logging
This commit is contained in:
parent
4d03e04172
commit
72e23bca5f
@ -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 {
|
||||
|
@ -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),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user