mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	update cAdvisor to v0.37.0
This commit is contained in:
		
							
								
								
									
										92
									
								
								vendor/github.com/google/cadvisor/container/libcontainer/handler.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										92
									
								
								vendor/github.com/google/cadvisor/container/libcontainer/handler.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -118,56 +118,58 @@ func (h *Handler) GetStats() (*info.ContainerStats, error) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// If we know the pid then get network stats from /proc/<pid>/net/dev
 | 
			
		||||
	if h.pid == 0 {
 | 
			
		||||
		return stats, nil
 | 
			
		||||
	}
 | 
			
		||||
	if h.includedMetrics.Has(container.NetworkUsageMetrics) {
 | 
			
		||||
		netStats, err := networkStatsFromProc(h.rootFs, h.pid)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			klog.V(4).Infof("Unable to get network stats from pid %d: %v", h.pid, err)
 | 
			
		||||
		} else {
 | 
			
		||||
			stats.Network.Interfaces = append(stats.Network.Interfaces, netStats...)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if h.includedMetrics.Has(container.NetworkTcpUsageMetrics) {
 | 
			
		||||
		t, err := tcpStatsFromProc(h.rootFs, h.pid, "net/tcp")
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			klog.V(4).Infof("Unable to get tcp stats from pid %d: %v", h.pid, err)
 | 
			
		||||
		} else {
 | 
			
		||||
			stats.Network.Tcp = t
 | 
			
		||||
	if h.pid > 0 {
 | 
			
		||||
		if h.includedMetrics.Has(container.NetworkUsageMetrics) {
 | 
			
		||||
			netStats, err := networkStatsFromProc(h.rootFs, h.pid)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				klog.V(4).Infof("Unable to get network stats from pid %d: %v", h.pid, err)
 | 
			
		||||
			} else {
 | 
			
		||||
				stats.Network.Interfaces = append(stats.Network.Interfaces, netStats...)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if h.includedMetrics.Has(container.NetworkTcpUsageMetrics) {
 | 
			
		||||
			t, err := tcpStatsFromProc(h.rootFs, h.pid, "net/tcp")
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				klog.V(4).Infof("Unable to get tcp stats from pid %d: %v", h.pid, err)
 | 
			
		||||
			} else {
 | 
			
		||||
				stats.Network.Tcp = t
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		t6, err := tcpStatsFromProc(h.rootFs, h.pid, "net/tcp6")
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			klog.V(4).Infof("Unable to get tcp6 stats from pid %d: %v", h.pid, err)
 | 
			
		||||
		} else {
 | 
			
		||||
			stats.Network.Tcp6 = t6
 | 
			
		||||
		}
 | 
			
		||||
			t6, err := tcpStatsFromProc(h.rootFs, h.pid, "net/tcp6")
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				klog.V(4).Infof("Unable to get tcp6 stats from pid %d: %v", h.pid, err)
 | 
			
		||||
			} else {
 | 
			
		||||
				stats.Network.Tcp6 = t6
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	if h.includedMetrics.Has(container.NetworkAdvancedTcpUsageMetrics) {
 | 
			
		||||
		ta, err := advancedTCPStatsFromProc(h.rootFs, h.pid, "net/netstat", "net/snmp")
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			klog.V(4).Infof("Unable to get advanced tcp stats from pid %d: %v", h.pid, err)
 | 
			
		||||
		} else {
 | 
			
		||||
			stats.Network.TcpAdvanced = ta
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	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
 | 
			
		||||
		if h.includedMetrics.Has(container.NetworkAdvancedTcpUsageMetrics) {
 | 
			
		||||
			ta, err := advancedTCPStatsFromProc(h.rootFs, h.pid, "net/netstat", "net/snmp")
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				klog.V(4).Infof("Unable to get advanced tcp stats from pid %d: %v", h.pid, err)
 | 
			
		||||
			} else {
 | 
			
		||||
				stats.Network.TcpAdvanced = ta
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		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
 | 
			
		||||
			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
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	// some process metrics are per container ( number of processes, number of
 | 
			
		||||
	// file descriptors etc.) and not required a proper container's
 | 
			
		||||
	// root PID (systemd services don't have the root PID atm)
 | 
			
		||||
	if h.includedMetrics.Has(container.ProcessMetrics) {
 | 
			
		||||
		paths := h.cgroupManager.GetPaths()
 | 
			
		||||
		path, ok := paths["cpu"]
 | 
			
		||||
@@ -298,13 +300,15 @@ func processStatsFromProcs(rootFs string, cgroupPath string, rootPid int) (info.
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	ulimits := processRootProcUlimits(rootFs, rootPid)
 | 
			
		||||
 | 
			
		||||
	processStats := info.ProcessStats{
 | 
			
		||||
		ProcessCount: uint64(len(pids)),
 | 
			
		||||
		FdCount:      fdCount,
 | 
			
		||||
		SocketCount:  socketCount,
 | 
			
		||||
		Ulimits:      ulimits,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if rootPid > 0 {
 | 
			
		||||
		processStats.Ulimits = processRootProcUlimits(rootFs, rootPid)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return processStats, nil
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user