Skip to content

Commit

Permalink
debug: add debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-karan committed May 12, 2023
1 parent c92b2bb commit 0a2d276
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/providers/google_chat/google_chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ func (m *GoogleChatManager) Push(alerts []alertmgrtmpl.Alert) error {

// For each alert, lookup the UUID and send the alert.
for _, a := range alerts {
m.lo.WithField("fingerprint", a.Fingerprint).WithField("room", m.Room()).WithField("annot", a.Annotations).WithField("labels", a.Labels).Debug("processing alert")
// If it's a new alert whose fingerprint isn't in the active alerts map, add it first.
if m.activeAlerts.loookup(a.Fingerprint) == "" {
m.activeAlerts.add(a)
Expand All @@ -126,6 +127,7 @@ func (m *GoogleChatManager) Push(alerts []alertmgrtmpl.Alert) error {
if m.dryRun {
m.lo.WithField("room", m.Room()).Info("dry_run is enabled for this room. skipping pushing notification")
} else {
m.lo.WithField("room", m.Room()).WithField("threadkey", threadKey).Debug("sending message")
if err := m.sendMessage(msg, threadKey); err != nil {
m.metrics.Increment(fmt.Sprintf(`alerts_dispatched_errors_total{provider="%s", room="%s"}`, m.ID(), m.Room()))
m.lo.WithError(err).Error("error sending message")
Expand Down

0 comments on commit 0a2d276

Please sign in to comment.