Parcourir la source

K8s request stats include current timestamp

Necessary for the maxing op that occurs in
getContainerAllocation. The timestamps for
request and usage must be roughly equal.
Michael Dresser il y a 5 ans
Parent
commit
dba6d663a3
1 fichiers modifiés avec 4 ajouts et 2 suppressions
  1. 4 2
      pkg/costmodel/costmodel.go

+ 4 - 2
pkg/costmodel/costmodel.go

@@ -477,7 +477,8 @@ func (cm *CostModel) ComputeCostData(cli prometheusClient.Client, cp costAnalyze
 				ramRequestBytes := container.Resources.Requests.Memory().Value()
 				RAMReqV := []*util.Vector{
 					{
-						Value: float64(ramRequestBytes),
+						Value:     float64(ramRequestBytes),
+						Timestamp: float64(time.Now().UTC().Unix()),
 					},
 				}
 
@@ -485,7 +486,8 @@ func (cm *CostModel) ComputeCostData(cli prometheusClient.Client, cp costAnalyze
 				cpuRequestMilliCores := container.Resources.Requests.Cpu().MilliValue()
 				CPUReqV := []*util.Vector{
 					{
-						Value: float64(cpuRequestMilliCores) / 1000,
+						Value:     float64(cpuRequestMilliCores) / 1000,
+						Timestamp: float64(time.Now().UTC().Unix()),
 					},
 				}