Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kotkovkirill committed Oct 17, 2024
1 parent 3bdfe1c commit b922230
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/services/ngalert/notifier/channels/logzio_opsgenie.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/prometheus/alertmanager/types"
"github.com/prometheus/common/model"
"net/http"
"github.com/google/uuid"
)

// LOGZ.IO GRAFANA CHANGE :: DEV-35483 - Add type for logzio Opsgenie integration
Expand Down Expand Up @@ -81,11 +82,15 @@ func NewLogzioOpsgenieNotifier(config *LogzioOpsgenieConfig, ns notifications.We
}

func (on *LogzioOpsgenieNotifier) Notify(ctx context.Context, as ...*types.Alert) (bool, error) {
on.log.Debug("Executing Opsgenie (Logzio Integration) notification", "notification", on.Name)

id := uuid.New()
logger := on.log.New("notificationId", id.String())

logger.Info("Executing Opsgenie (Logzio Integration) notification", "notification", on.Name)

alerts := types.Alerts(as...)
if alerts.Status() == model.AlertResolved && !on.SendResolved() {
on.log.Debug("Not sending a trigger to Opsgenie", "status", alerts.Status(), "auto resolve", on.SendResolved())
logger.Info("Not sending a trigger to Opsgenie", "status", alerts.Status(), "auto resolve", on.SendResolved())
return true, nil
}

Expand Down

0 comments on commit b922230

Please sign in to comment.