Browse Source

Raise error if no threshold is provided for a numeric value

Brendan Abolivier 7 years ago
parent
commit
e76985e0f9
Signed by: Brendan Abolivier <contact@brendanabolivier.com> GPG key ID: 8EF1500759F70623
1 changed files with 4 additions and 0 deletions
  1. 4
    0
      src/metrics-alerting/process/process.go

+ 4
- 0
src/metrics-alerting/process/process.go View File

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