mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
ruler: correct logging of alert name
The error messages we see in the embedded ruler in Mimir right now are contain `alert="unsupported value type"` and `data="unsupported value type"` ``` ts=2024-10-04T09:59:56.900015691Z caller=alerting.go:384 level=warn component=ruler insight=true user=XXX alert="unsupported value type" msg="Expanding alert template failed" err="error executing template __alert_service_mesh_down_alert: template: __alert_service_mesh_down_alert:1:139: executing \"__alert_service_mesh_down_alert\" at <.registry_name>: can't evaluate field registry_name in type struct { Labels map[string]string; ExternalLabels map[string]string; ExternalURL string; Value interface {} }" data="unsupported value type" ``` Signed-off-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
This commit is contained in:
parent
6c5e2f8fb9
commit
b544127d9a
|
@ -381,7 +381,7 @@ func (r *AlertingRule) Eval(ctx context.Context, queryOffset time.Duration, ts t
|
||||||
result, err := tmpl.Expand()
|
result, err := tmpl.Expand()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
result = fmt.Sprintf("<error expanding template: %s>", err)
|
result = fmt.Sprintf("<error expanding template: %s>", err)
|
||||||
level.Warn(r.logger).Log("msg", "Expanding alert template failed", "err", err, "data", tmplData)
|
level.Warn(r.logger).Log("msg", "Expanding alert template failed", "err", err, "data", fmt.Sprintf("%#v", tmplData))
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
|
@ -323,7 +323,7 @@ func (m *Manager) LoadGroups(
|
||||||
externalLabels,
|
externalLabels,
|
||||||
externalURL,
|
externalURL,
|
||||||
m.restored,
|
m.restored,
|
||||||
log.With(m.logger, "alert", r.Alert),
|
log.With(m.logger, "alert", r.Alert.Value),
|
||||||
))
|
))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue