Explorar o código

Disable resolution coefficient for rate data

Niko Kovacevic %!s(int64=6) %!d(string=hai) anos
pai
achega
3768bfe935
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      costmodel/aggregations.go

+ 4 - 1
costmodel/aggregations.go

@@ -192,8 +192,11 @@ func AggregateCostData(costData map[string]*CostData, field string, subfields []
 		idleCoefficients = make(map[string]float64)
 	}
 
+	// resolution coefficient compensates for less-frequent-than-hourly samples by multiplying
+	// cumulative values by the hours between samples. does not apply to rate data and defaults
+	// to 1.0, which matches hourly sampling of hourly data.
 	resolutionCoefficient := opts.ResolutionCoefficient
-	if resolutionCoefficient == 0.0 {
+	if resolutionCoefficient == 0.0 || rate != "" {
 		resolutionCoefficient = 1.0
 	}