Log the GroupKey and alerts in retry (#3438)
This commit updates notify.go to log the GroupKey and fingerprints of an alert at the debug level, and just the GroupKey at the warning level should the notify attempt fail. Signed-off-by: George Robinson <george.robinson@grafana.com>
This commit is contained in:
parent
5626bd4a94
commit
638f41c215
|
@ -710,7 +710,11 @@ func (r RetryStage) exec(ctx context.Context, l log.Logger, alerts ...*types.Ale
|
||||||
i = 0
|
i = 0
|
||||||
iErr error
|
iErr error
|
||||||
)
|
)
|
||||||
|
|
||||||
l = log.With(l, "receiver", r.groupName, "integration", r.integration.String())
|
l = log.With(l, "receiver", r.groupName, "integration", r.integration.String())
|
||||||
|
if groupKey, ok := GroupKey(ctx); ok {
|
||||||
|
l = log.With(l, "aggrGroup", groupKey)
|
||||||
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
i++
|
i++
|
||||||
|
@ -745,10 +749,11 @@ func (r RetryStage) exec(ctx context.Context, l log.Logger, alerts ...*types.Ale
|
||||||
// integration upon context timeout.
|
// integration upon context timeout.
|
||||||
iErr = err
|
iErr = err
|
||||||
} else {
|
} else {
|
||||||
lvl := level.Debug(l)
|
lvl := level.Info(l)
|
||||||
if i > 1 {
|
if i <= 1 {
|
||||||
lvl = level.Info(l)
|
lvl = level.Debug(log.With(l, "alerts", fmt.Sprintf("%v", alerts)))
|
||||||
}
|
}
|
||||||
|
|
||||||
lvl.Log("msg", "Notify success", "attempts", i)
|
lvl.Log("msg", "Notify success", "attempts", i)
|
||||||
return ctx, alerts, nil
|
return ctx, alerts, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue