Skip to content

Commit

Permalink
Merge pull request #3322 from harche/044_backport
Browse files Browse the repository at this point in the history
[0.44] Request the pid of another container if current pid is not longer valid
  • Loading branch information
bobbypage authored Jun 20, 2023
2 parents f95787b + fa6b6c5 commit 74bb771
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 74bb771

Please sign in to comment.