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

Comment explaining manual timestamp

Michael Dresser 5 лет назад
Родитель
Сommit
33f44b43a2
1 измененных файлов с 6 добавлено и 0 удалено
  1. 6 0
      pkg/costmodel/costmodel.go

+ 6 - 0
pkg/costmodel/costmodel.go

@@ -475,6 +475,12 @@ func (cm *CostModel) ComputeCostData(cli prometheusClient.Client, cp costAnalyze
 				// https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#resource-types
 				// for the units of memory and CPU.
 				ramRequestBytes := container.Resources.Requests.Memory().Value()
+
+				// Because RAM (and CPU) information isn't coming from Prometheus, it won't
+				// have a timestamp associated with it. We need to provide a timestamp,
+				// otherwise the vector op that gets applied to take the max of usage
+				// and request won't work properly and will only take into account
+				// usage.
 				RAMReqV := []*util.Vector{
 					{
 						Value:     float64(ramRequestBytes),