-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
Currently, cAdvisor retrieves UDP metrics by parsing /proc/net/udp
and /proc/net/udp6
, as shown below:
if h.includedMetrics.Has(container.NetworkUdpUsageMetrics) {
u, err := udpStatsFromProc(h.rootFs, h.pid, "net/udp")
if err != nil {
klog.V(4).Infof("Unable to get udp stats from pid %d: %v", h.pid, err)
} else {
stats.Network.Udp = u
}
u6, err := udpStatsFromProc(h.rootFs, h.pid, "net/udp6")
if err != nil {
klog.V(4).Infof("Unable to get udp6 stats from pid %d: %v", h.pid, err)
} else {
stats.Network.Udp6 = u6
}
}
However, I have observed that the UDP metrics obtained from these files tend to be of low quality because the values change very frequently, which can result in inconsistent and unreliable data.
To address this, I propose enhancing the UDP metrics by incorporating data from /proc/net/snmp
. This file provides more comprehensive UDP statistics, similar to those already used for advanced TCP metrics. For example, /proc/net/snmp
includes details like:
Udp: InDatagrams NoPorts InErrors OutDatagrams RcvbufErrors SndbufErrors InCsumErrors IgnoredMulti
Udp: 174527561 8979 8 174548568 8 0 0 0
Integrating these metrics would offer valuable insights for deeper network analysis and troubleshooting.
I am willing to contribute by creating a PR to implement this enhancement.
Looking forward to your thoughts and feedback on this proposal.
Thank you!