Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

container/crio: fix network metrics collection logic #3582

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions container/crio/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@ func newCrioContainerHandler(
Namespace: CrioNamespace,
}

// Find out if we need network metrics reported for this container.
// Containers that don't have their own network -- this includes
// containers running in Kubernetes pods that use the network of the
// infrastructure container -- does not need their stats to be
// reported. This stops metrics being reported multiple times for each
// container in a pod.
metrics := common.RemoveNetMetrics(includedMetrics, cInfo.Labels["io.kubernetes.container.name"] != "POD")
// In a Kubernetes pod, all containers share the same network namespace.
// If the infrastructure container has empty network metrics, the CRI-O
// handler uses a running container in the pod to gather the necessary
// metrics. Therefore, it is essential to collect network metrics from
// all containers to ensure that if there is any running container in
// the pod, we capture the required network metrics for accurate reporting.
metrics := includedMetrics

libcontainerHandler := containerlibcontainer.NewHandler(cgroupManager, rootFs, cInfo.Pid, metrics)

Expand Down
Loading