Skip to content

Commit

Permalink
Merge pull request #3321 from harche/045_backport
Browse files Browse the repository at this point in the history
[0.45] Request the pid of another container if current pid is not longer valid
  • Loading branch information
bobbypage committed Jun 20, 2023
2 parents 3f2cb48 + aacff15 commit 96830d9
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 96830d9

Please sign in to comment.