add rule name
This commit is contained in:
parent
9bb29fba12
commit
f39ddacb0f
|
@ -13,7 +13,7 @@ type Rule struct {
|
|||
ID string `json:"id,omitempty" elastic_meta:"_id" elastic_mapping:"id: { type: keyword }"`
|
||||
Created time.Time `json:"created,omitempty" elastic_mapping:"created: { type: date }"`
|
||||
Updated time.Time `json:"updated,omitempty" elastic_mapping:"updated: { type: date }"`
|
||||
//Name string `json:"name" elastic_mapping:"name:{type:keyword,copy_to:search_text}"`
|
||||
Name string `json:"name" elastic_mapping:"name:{type:keyword,copy_to:search_text}"`
|
||||
Enabled bool `json:"enabled" elastic_mapping:"enabled:{type:keyword}"`
|
||||
Resource Resource `json:"resource" elastic_mapping:"resource:{type:object}"`
|
||||
Metrics Metric `json:"metrics" elastic_mapping:"metrics:{type:object}"`
|
||||
|
|
|
@ -486,6 +486,10 @@ func (engine *Engine) CheckCondition(rule *alerting.Rule)(*alerting.ConditionRes
|
|||
}
|
||||
triggerCount := 0
|
||||
for i := 0; i < dataLength; i++ {
|
||||
//clear nil value
|
||||
if targetData.Data[dataKey][i][1] == nil {
|
||||
continue
|
||||
}
|
||||
if r, ok := targetData.Data[dataKey][i][1].(float64); ok {
|
||||
if math.IsNaN(r){
|
||||
continue
|
||||
|
|
Loading…
Reference in New Issue