Skip to content

Commit 5fd7219

Browse files
committed
kubelet/stats: fix pid stats for cadvisor stats provider
the process stats aren't correct coming from only the pod stats. They need to be summed for all of the containers, as cadvisor is only reading per pid (per container process) Signed-off-by: Peter Hunt <[email protected]>
1 parent 7d8ba78 commit 5fd7219

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/kubelet/stats/cadvisor_stats_provider.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ func (p *cadvisorStatsProvider) ListPodStats(_ context.Context) ([]statsapi.PodS
139139
}
140140
podStats.Containers = append(podStats.Containers, *containerStat)
141141
}
142+
// Either way, collect process stats
143+
podStats.ProcessStats = mergeProcessStats(podStats.ProcessStats, cadvisorInfoToProcessStats(&cinfo))
142144
}
143145

144146
// Add each PodStats to the result.
@@ -154,7 +156,7 @@ func (p *cadvisorStatsProvider) ListPodStats(_ context.Context) ([]statsapi.PodS
154156
podStats.CPU = cpu
155157
podStats.Memory = memory
156158
podStats.Swap = cadvisorInfoToSwapStats(podInfo)
157-
podStats.ProcessStats = cadvisorInfoToProcessStats(podInfo)
159+
// ProcessStats were accumulated as the containers were iterated.
158160
}
159161

160162
status, found := p.statusProvider.GetPodStatus(podUID)

0 commit comments

Comments
 (0)