AjayTripathy 6 лет назад
Родитель
Сommit
d80b49f44b
1 измененных файлов с 3 добавлено и 0 удалено
  1. 3 0
      costmodel/cluster.go

+ 3 - 0
costmodel/cluster.go

@@ -53,6 +53,9 @@ func resultToTotals(qr interface{}) ([][]string, error) {
 	if !ok {
 		return nil, fmt.Errorf("Improperly formatted results from prometheus, result field is not a slice")
 	}
+	if len(results) == 0 {
+		return nil, fmt.Errorf("Not enough data available in the results vector")
+	}
 	res, ok := results[0].(map[string]interface{})["values"]
 	totals := [][]string{}
 	for _, val := range res.([]interface{}) {