File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -305,14 +305,20 @@ func (h *crioContainerHandler) GetStats() (*info.ContainerStats, error) {
305305 if err != nil {
306306 return stats , err
307307 }
308- // Clean up stats for containers that don't have their own network - this
309- // includes containers running in Kubernetes pods that use the network of the
310- // infrastructure container. This stops metrics being reported multiple times
311- // for each container in a pod.
308+
312309 if ! h .needNet () {
310+ // Clean up stats for containers that don't have their own network - this
311+ // includes containers running in Kubernetes pods that use the network of the
312+ // infrastructure container. This stops metrics being reported multiple times
313+ // for each container in a pod.
313314 stats .Network = info.NetworkStats {}
315+ } else if len (stats .Network .Interfaces ) == 0 {
316+ // No network related information indicates that the pid of the
317+ // container is not longer valid and we need to ask crio to
318+ // provide the pid of another container from that pod
319+ h .pidKnown = false
320+ return stats , nil
314321 }
315-
316322 // Get filesystem stats.
317323 err = h .getFsStats (stats )
318324 if err != nil {
You can’t perform that action at this time.
0 commit comments