fixed agg rate bug

This commit is contained in:
liugq 2022-07-19 09:06:12 +08:00
parent a3bf7a16ad
commit 4cf91d7a40
1 changed files with 4 additions and 0 deletions

View File

@ -485,6 +485,7 @@ func (engine *Engine) GetTargetMetricData(rule *alerting.Rule, isFilterNaN bool,
if len(parameters) == 0 { if len(parameters) == 0 {
continue continue
} }
result, err := expression.Evaluate(parameters) result, err := expression.Evaluate(parameters)
if err != nil { if err != nil {
return nil, queryResult, err return nil, queryResult, err
@ -1008,6 +1009,9 @@ func collectMetricData(agg interface{}, groupValues string, metricData *[]alerti
if k == "key" || k == "key_as_string" || k== "doc_count"{ if k == "key" || k == "key_as_string" || k== "doc_count"{
continue continue
} }
if len(k) > 5 { //just store a,b,c
continue
}
if vm, ok := v.(map[string]interface{}); ok { if vm, ok := v.(map[string]interface{}); ok {
if metricVal, ok := vm["value"]; ok { if metricVal, ok := vm["value"]; ok {
md.Data[k] = append(md.Data[k], alerting.TimeMetricData{bkM["key"], metricVal}) md.Data[k] = append(md.Data[k], alerting.TimeMetricData{bkM["key"], metricVal})