浏览代码

Raise error if no threshold is provided for a numeric value

父节点
当前提交
e76985e0f9
签署人:: Brendan Abolivier <contact@brendanabolivier.com> GPG 密钥 ID: 8EF1500759F70623
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4
    0
      src/metrics-alerting/process/process.go

+ 4
- 0
src/metrics-alerting/process/process.go 查看文件

138
 	labels map[string]string,
138
 	labels map[string]string,
139
 	data script_data.Data,
139
 	data script_data.Data,
140
 ) error {
140
 ) error {
141
+	if script.Threshold == 0 {
142
+		return fmt.Errorf("no threshold provided for number value")
143
+	}
144
+
141
 	if value < script.Threshold {
145
 	if value < script.Threshold {
142
 		// Nothing to alert about
146
 		// Nothing to alert about
143
 		return nil
147
 		return nil