mirror of
https://github.com/prometheus/prometheus.git
synced 2025-08-06 22:27:17 +02:00
Revert "ruler: correct logging of alert name & template data"
This commit is contained in:
parent
503f3cb6d7
commit
d085f7da9b
@ -342,7 +342,7 @@ func (m *Manager) LoadGroups(
|
|||||||
externalLabels,
|
externalLabels,
|
||||||
externalURL,
|
externalURL,
|
||||||
!shouldRestore,
|
!shouldRestore,
|
||||||
m.logger.With("alert", r.Alert.Value),
|
m.logger.With("alert", r.Alert),
|
||||||
))
|
))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -281,30 +281,14 @@ func NewTemplateExpander(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type templateData struct {
|
|
||||||
Labels map[string]string
|
|
||||||
ExternalLabels map[string]string
|
|
||||||
ExternalURL string
|
|
||||||
Value interface{}
|
|
||||||
}
|
|
||||||
|
|
||||||
// String implements fmt.Stringer interface.
|
|
||||||
func (t templateData) String() string {
|
|
||||||
labelsString := func(labels map[string]string) string {
|
|
||||||
// model.LabelSet has a ready String() method, that we can use.
|
|
||||||
labelSet := make(model.LabelSet, len(t.Labels))
|
|
||||||
for k, v := range t.Labels {
|
|
||||||
labelSet[model.LabelName(k)] = model.LabelValue(v)
|
|
||||||
}
|
|
||||||
return labelSet.String()
|
|
||||||
}
|
|
||||||
|
|
||||||
return fmt.Sprintf("<Labels: %s, ExternalLabels: %s, ExternalURL: %s, Value: %v>", labelsString(t.Labels), labelsString(t.ExternalLabels), t.ExternalURL, t.Value)
|
|
||||||
}
|
|
||||||
|
|
||||||
// AlertTemplateData returns the interface to be used in expanding the template.
|
// AlertTemplateData returns the interface to be used in expanding the template.
|
||||||
func AlertTemplateData(labels, externalLabels map[string]string, externalURL string, smpl promql.Sample) interface{} {
|
func AlertTemplateData(labels, externalLabels map[string]string, externalURL string, smpl promql.Sample) interface{} {
|
||||||
res := templateData{
|
res := struct {
|
||||||
|
Labels map[string]string
|
||||||
|
ExternalLabels map[string]string
|
||||||
|
ExternalURL string
|
||||||
|
Value interface{}
|
||||||
|
}{
|
||||||
Labels: labels,
|
Labels: labels,
|
||||||
ExternalLabels: externalLabels,
|
ExternalLabels: externalLabels,
|
||||||
ExternalURL: externalURL,
|
ExternalURL: externalURL,
|
||||||
|
Loading…
Reference in New Issue
Block a user