add condition expression to alert info
This commit is contained in:
parent
3f54d52588
commit
eaaf44bd7a
|
@ -594,6 +594,12 @@ func (engine *Engine) Do(rule *alerting.Rule) error {
|
||||||
}()
|
}()
|
||||||
log.Tracef("start check condition of rule %s", rule.ID)
|
log.Tracef("start check condition of rule %s", rule.ID)
|
||||||
|
|
||||||
|
//todo do only once when rule not change
|
||||||
|
metricExpression, _ := rule.Metrics.GenerateExpression()
|
||||||
|
for i, cond := range rule.Conditions.Items {
|
||||||
|
expression, _ := cond.GenerateConditionExpression()
|
||||||
|
rule.Conditions.Items[i].Expression = strings.ReplaceAll(expression, "result", metricExpression)
|
||||||
|
}
|
||||||
alertItem = &alerting.Alert{
|
alertItem = &alerting.Alert{
|
||||||
ID: util.GetUUID(),
|
ID: util.GetUUID(),
|
||||||
Created: time.Now(),
|
Created: time.Now(),
|
||||||
|
|
Loading…
Reference in New Issue