Просмотр исходного кода

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 5 лет назад
Родитель
Сommit
dba6d663a3
1 измененных файлов с 4 добавлено и 2 удалено
  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()),
 					},
 				}