提交 3092b4b6 编写于 作者: 7 710leo

fix: recovery alert value is null & refactor stats

上级 5df96d41
......@@ -110,16 +110,16 @@ func Judge(stra *model.Stra, exps []model.Exp, historyData []*dataobj.RRDData, f
}()
leftValue, isTriggered = judgeItemWithStrategy(stra, historyData, exps[0], firstItem, now)
if !isTriggered {
return
}
if value == "" {
value = fmt.Sprintf("%s: %v", exp.Metric, leftValue)
} else {
value += fmt.Sprintf("; %s: %v", exp.Metric, leftValue)
}
if !isTriggered {
return
}
//与条件情况下执行
if len(exps) > 1 {
if exps[1].Func == "nodata" { //nodata重新查询索引来进行告警判断
......
......@@ -18,11 +18,12 @@ type IdentitySection struct {
func Init(identity IdentitySection) {
if identity.Specify != "" {
Identity = identity.Specify
return
}
var err error
Identity, err = sys.CmdOutTrim("bash", "-c", identity.Shell)
if err != nil {
log.Fatalln("[F] cannot get hostname")
log.Fatalln("[F] cannot get identity")
}
}
......@@ -7,7 +7,6 @@ import (
"time"
"github.com/didi/nightingale/src/dataobj"
"github.com/didi/nightingale/src/toolkits/identity"
"github.com/toolkits/pkg/logger"
)
......@@ -42,7 +41,6 @@ func Push() {
func NewMetricValue(metric string, value int64) *dataobj.MetricValue {
item := &dataobj.MetricValue{
Metric: metric,
Endpoint: identity.Identity,
Timestamp: time.Now().Unix(),
ValueUntyped: value,
CounterType: "GAUGE",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册