func()

in pkg/gpu/nvidia/metrics/metrics.go [163:180]


func (m *MetricServer) collectMetrics() {
	gmc = &mCollector{}
	t := time.NewTicker(time.Millisecond * time.Duration(m.collectionInterval))
	defer t.Stop()

	for {
		select {
		case <-t.C:
			devices, err := GetDevicesForAllContainers()
			if err != nil {
				glog.Errorf("Failed to get devices for containers: %v", err)
				continue
			}
			gpuDevices := GetAllGpuDevices()
			m.updateMetrics(devices, gpuDevices)
		}
	}
}