mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Improve logs in state manager and historian (#57374)
* Touch up log statements, fix casing, add and normalize contexts * Dedicated logger for dashboard resolver * Avoid injecting logger to historian * More minor log touch-ups * Dedicated logger for state manager * Use rule context in annotation creator * Rename base logger and avoid redundant contextual loggers
This commit is contained in:
@@ -90,13 +90,13 @@ func (rs *ruleStates) getOrCreate(ctx context.Context, log log.Logger, alertRule
|
||||
}
|
||||
}
|
||||
if len(dupes) > 0 {
|
||||
log.Warn("evaluation result contains either reserved labels or labels declared in the rules. Those labels from the result will be ignored", "labels", dupes)
|
||||
log.Warn("Evaluation result contains either reserved labels or labels declared in the rules. Those labels from the result will be ignored", "labels", dupes)
|
||||
}
|
||||
|
||||
il := ngModels.InstanceLabels(lbs)
|
||||
id, err := il.StringKey()
|
||||
if err != nil {
|
||||
log.Error("error getting cacheId for entry", "error", err.Error())
|
||||
log.Error("Error getting cacheId for entry", "error", err)
|
||||
}
|
||||
|
||||
if state, ok := rs.states[id]; ok {
|
||||
@@ -145,7 +145,7 @@ func (rs *ruleStates) expandRuleLabelsAndAnnotations(ctx context.Context, log lo
|
||||
ev, err := expandTemplate(ctx, alertRule.Title, v, templateLabels, alertInstance, externalURL)
|
||||
expanded[k] = ev
|
||||
if err != nil {
|
||||
log.Error("error in expanding template", "name", k, "value", v, "error", err.Error())
|
||||
log.Error("Error in expanding template", "name", k, "value", v, "error", err)
|
||||
// Store the original template on error.
|
||||
expanded[k] = v
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user