File tree 1 file changed +11
-5
lines changed
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) {
305
305
if err != nil {
306
306
return stats , err
307
307
}
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
+
312
309
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.
313
314
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
314
321
}
315
-
316
322
// Get filesystem stats.
317
323
err = h .getFsStats (stats )
318
324
if err != nil {
You can’t perform that action at this time.
0 commit comments