Przeglądaj źródła

review after PR feedback

Signed-off-by: Bernard Grymonpon <bernard@grymonpon.be>
Bernard Grymonpon 2 lat temu
rodzic
commit
fd2b9f311b
1 zmienionych plików z 13 dodań i 13 usunięć
  1. 13 13
      pkg/costmodel/metrics.go

+ 13 - 13
pkg/costmodel/metrics.go

@@ -680,37 +680,37 @@ func (cmme *CostModelMetricsEmitter) Start() bool {
 					if ok {
 						log.Debugf("No data observed for node with labels %v, removed from totalprice", labels)
 					} else {
-						log.Debugf("No data observed for node with labels %v, but we could not remove it from totalprice", labels)
+						log.Warnf("Failed to remove label set %v from metric node_total_hourly_cost", labels)
 					}
 					ok = cmme.NodeSpotRecorder.DeleteLabelValues(labels...)
 					if ok {
 						log.Debugf("No data observed for node with labels %v, removed from spot records", labels)
 					} else {
-						log.Debugf("No data observed for node with labels %v, but we could not remove it from spot records", labels)
+						log.Warnf("Failed to remove label set %v from metric kubecost_node_is_spot", labels)
 					}
 					ok = cmme.CPUPriceRecorder.DeleteLabelValues(labels...)
 					if ok {
 						log.Debugf("No data observed for node with labels %v, removed from cpuprice", labels)
 					} else {
-						log.Debugf("No data observed for node with labels %v, but we could not remove it from cpuprice", labels)
+						log.Warnf("Failed to remove label set %v from metric node_cpu_hourly_cost", labels)
 					}
 					ok = cmme.GPUPriceRecorder.DeleteLabelValues(labels...)
 					if ok {
 						log.Debugf("No data observed for node with labels %v, removed from gpuprice", labels)
 					} else {
-						log.Debugf("No data observed for node with labels %v, but we could not remove it from gpuprice", labels)
+						log.Warnf("Failed to remove label set %v from metric node_gpu_hourly_cost", labels)
 					}
 					ok = cmme.GPUCountRecorder.DeleteLabelValues(labels...)
 					if ok {
 						log.Debugf("No data observed for node with labels %v, removed from gpucount", labels)
 					} else {
-						log.Debugf("No data observed for node with labels %v, but we could not remove it from gpucount", labels)
+						log.Warnf("Failed to remove label set %v from metric node_gpu_count", labels)
 					}
 					ok = cmme.RAMPriceRecorder.DeleteLabelValues(labels...)
 					if ok {
 						log.Debugf("No data observed for node with labels %v, removed from ramprice", labels)
 					} else {
-						log.Debugf("No data observed for node with labels %v, but we could not remove it from ramprice", labels)
+						log.Warnf("Failed to remove label set %v from metric node_ram_hourly_cost", labels)
 					}
 					delete(nodeSeen, labelString)
 					delete(nodeCostAverages, labelString)
@@ -723,7 +723,7 @@ func (cmme *CostModelMetricsEmitter) Start() bool {
 					labels := getLabelStringsFromKey(labelString)
 					ok := cmme.LBCostRecorder.DeleteLabelValues(labels...)
 					if !ok {
-						log.Debugf("Failed to delete LoadBalancer with labels: %v", labels)
+						log.Warnf("Failed to remove label set %v from metric kubecost_load_balancer_cost: %v", labels)
 					}
 					delete(loadBalancerSeen, labelString)
 				} else {
@@ -733,18 +733,18 @@ func (cmme *CostModelMetricsEmitter) Start() bool {
 			for labelString, seen := range containerSeen {
 				if !seen {
 					labels := getLabelStringsFromKey(labelString)
-					if labels[1] == unmountedPVsContainer { // special "pod" to contain the unmounted PVs - does not have RAM/CPU/...
+					if labels[1] != unmountedPVsContainer { // special "pod" to contain the unmounted PVs - does not have RAM/CPU/...
 						ok := cmme.RAMAllocationRecorder.DeleteLabelValues(labels...)
 						if !ok {
-							log.Debugf("Failed to delete RAMAllocation for container with labels: %v", labels)
+							log.Warnf("Failed to remove label set %v from metric container_memory_allocation_bytes", labels)
 						}
 						ok = cmme.CPUAllocationRecorder.DeleteLabelValues(labels...)
 						if !ok {
-							log.Debugf("Failed to delete CPUAllocation for container with labels: %v", labels)
+							log.Warnf("Failed to remove label set %v from metric container_cpu_allocation", labels)
 						}
 						ok = cmme.GPUAllocationRecorder.DeleteLabelValues(labels...)
 						if !ok {
-							log.Debugf("Failed to delete GPUAllocation for container with labels: %v", labels)
+							log.Warnf("Failed to remove label set %v from metric container_gpu_allocation", labels)
 						}
 					} else {
 						log.Debugf("Did not try to delete RAM/CPU/GPU for fake '%s' container: %v", unmountedPVsContainer, labels)
@@ -759,7 +759,7 @@ func (cmme *CostModelMetricsEmitter) Start() bool {
 					labels := getLabelStringsFromKey(labelString)
 					ok := cmme.PersistentVolumePriceRecorder.DeleteLabelValues(labels...)
 					if !ok {
-						log.Debugf("Failed to delete PVPrice for PV with labels: %v", labels)
+						log.Warnf("Failed to remove label set %v from metric pv_hourly_cost", labels)
 					}
 					delete(pvSeen, labelString)
 				} else {
@@ -771,7 +771,7 @@ func (cmme *CostModelMetricsEmitter) Start() bool {
 					labels := getLabelStringsFromKey(labelString)
 					ok := cmme.PVAllocationRecorder.DeleteLabelValues(labels...)
 					if !ok {
-						log.Debugf("Failed to delete PVAllocation for PVC with labels: %v", labels)
+						log.Warnf("Failed to remove label set %v from metric pod_pvc_allocation", labels)
 					}
 					delete(pvcSeen, labelString)
 				} else {