progress on gpu metrics

This commit is contained in:
Henry Dollman
2024-11-08 16:52:50 -05:00
parent b433437636
commit 8262a9a45b
6 changed files with 313 additions and 7 deletions

View File

@@ -206,6 +206,22 @@ func (a *Agent) getSystemStats() system.Stats {
}
}
// GPU data
if a.gpuManager != nil {
if gpuData := a.gpuManager.GetCurrentData(); len(gpuData) > 0 {
systemStats.GPUData = gpuData
// add temperatures
if systemStats.Temperatures == nil {
systemStats.Temperatures = make(map[string]float64, len(gpuData))
}
for _, gpu := range gpuData {
if gpu.Temperature > 0 {
systemStats.Temperatures[gpu.Name] = gpu.Temperature
}
}
}
}
// update base system info
a.systemInfo.Cpu = systemStats.Cpu
a.systemInfo.MemPct = systemStats.MemPct