Explorar o código

discount should be applied to totalcost

AjayTripathy %!s(int64=6) %!d(string=hai) anos
pai
achega
2fdb6080cf
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      costmodel/aggregations.go

+ 1 - 1
costmodel/aggregations.go

@@ -43,7 +43,7 @@ func ComputeIdleCoefficient(costData map[string]*CostData, cli prometheusClient.
 	if err != nil || totalClusterCost == 0.0 {
 	if err != nil || totalClusterCost == 0.0 {
 		return 0.0, err
 		return 0.0, err
 	}
 	}
-	totalClusterCostOverWindow := (totalClusterCost / 730) * windowDuration.Hours()
+	totalClusterCostOverWindow := (totalClusterCost / 730) * windowDuration.Hours() * (1 - discount)
 	totalContainerCost := 0.0
 	totalContainerCost := 0.0
 	for _, costDatum := range costData {
 	for _, costDatum := range costData {
 		cpuv, ramv, gpuv, pvvs := getPriceVectors(costDatum, discount, 1)
 		cpuv, ramv, gpuv, pvvs := getPriceVectors(costDatum, discount, 1)