diff --git a/pkg/scraper/client/resource/decode.go b/pkg/scraper/client/resource/decode.go index 1b0d01677..b60817a2b 100644 --- a/pkg/scraper/client/resource/decode.go +++ b/pkg/scraper/client/resource/decode.go @@ -194,11 +194,13 @@ func checkContainerMetrics(podMetric storage.PodMetricsPoint) map[string]storage // drop metrics when CumulativeCpuUsed or MemoryUsage is zero if containerMetric.CumulativeCpuUsed == 0 || containerMetric.MemoryUsage == 0 { klog.V(1).InfoS("Failed getting complete container metric", "containerName", containerName, "containerMetric", containerMetric) - return nil } else { podMetrics[containerName] = containerMetric } } } + if len(podMetrics) == 0 { + return nil + } return podMetrics }