Skip to content

Commit

Permalink
Merge pull request #3320 from harche/046_backport
Browse files Browse the repository at this point in the history
[0.46] Backport of PR 3301 to 0.46
  • Loading branch information
bobbypage authored Jun 20, 2023
2 parents 1ac3f5c + b293e49 commit 65584c3
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions container/crio/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,20 @@ func (h *crioContainerHandler) GetStats() (*info.ContainerStats, error) {
if err != nil {
return stats, err
}
// Clean up stats for containers that don't have their own network - this
// includes containers running in Kubernetes pods that use the network of the
// infrastructure container. This stops metrics being reported multiple times
// for each container in a pod.

if !h.needNet() {
// Clean up stats for containers that don't have their own network - this
// includes containers running in Kubernetes pods that use the network of the
// infrastructure container. This stops metrics being reported multiple times
// for each container in a pod.
stats.Network = info.NetworkStats{}
} else if len(stats.Network.Interfaces) == 0 {
// No network related information indicates that the pid of the
// container is not longer valid and we need to ask crio to
// provide the pid of another container from that pod
h.pidKnown = false
return stats, nil
}

// Get filesystem stats.
err = h.getFsStats(stats)
if err != nil {
Expand Down

0 comments on commit 65584c3

Please sign in to comment.