From 23380f2a00211eee4ce4a66a66ca33d8f7bfe370 Mon Sep 17 00:00:00 2001 From: zhaoxiangchun <1422928955@qq.com> Date: Thu, 14 May 2020 19:51:37 +0800 Subject: [PATCH] modify the logic of queryCondition save the evalMatch --- pkg/monitor/alerting/conditions/query.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pkg/monitor/alerting/conditions/query.go b/pkg/monitor/alerting/conditions/query.go index 11e2c47841..1868a3f10c 100644 --- a/pkg/monitor/alerting/conditions/query.go +++ b/pkg/monitor/alerting/conditions/query.go @@ -122,12 +122,14 @@ func (c *QueryCondition) Eval(context *alerting.EvalContext) (*alerting.Conditio if len(metas) > idx { meta = &metas[idx] } - matches = append(matches, &monitor.EvalMatch{ - Condition: c.GenerateFormatCond(meta).String(), - Metric: series.Name, - Value: reducedValue, - Tags: tags, - }) + if evalMatch { + matches = append(matches, &monitor.EvalMatch{ + Condition: c.GenerateFormatCond(meta).String(), + Metric: series.Name, + Value: reducedValue, + Tags: tags, + }) + } } // handle no series special case @@ -215,7 +217,6 @@ func (c *QueryCondition) executeQuery(context *alerting.EvalContext, timeRange * return nil, errors.Wrap(err, "tsdb.HandleRequest() error") } - for _, v := range resp.Results { if v.Error != nil { return nil, errors.Wrap(err, "tsdb.HandleResult() response")