Sfoglia il codice sorgente

Raise error if no threshold is provided for a numeric value

Brendan Abolivier 7 anni fa
parent
commit
e76985e0f9
Signed by: Brendan Abolivier <contact@brendanabolivier.com> GPG key ID: 8EF1500759F70623
1 ha cambiato i file con 4 aggiunte e 0 eliminazioni
  1. 4
    0
      src/metrics-alerting/process/process.go

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

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