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

libcontainer: fix the way to get network stats #2072

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ZeroMagic
Copy link

Although getNetworkInterfaceStats(interfaceName string) was implemented in runc, containerd does not transfer the interface name to runc. So we still can’t get the network stats from libcontainer’s Stats().

Because in a runc container, we can get network stats by cat /proc/<init pid>/root/sys/class/net/<EthInterface>/statistics/rx_bytes. So I leverage this point.

With this PR, runc events --stats <containerd-id> can return network stats.

Currently runc does not know the interfaces, so c.config.Networks is null.
But we can get the network stats from "/proc/<initPid>/root/sys/class/net/<EthInterface>/statistics/"

Signed-off-by: ZeroMagic <anthonyliu@zju.edu.cn>
Signed-off-by: ZeroMagic <anthonyliu@zju.edu.cn>
@ZeroMagic
Copy link
Author

/ping @crosbymichael

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant