Skip to content

Commit

Permalink
add check on returned stats
Browse files Browse the repository at this point in the history
  • Loading branch information
spacehamster87 committed Nov 22, 2024
1 parent a8eff6f commit 5f4a74f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions internal/taskManager/updateFootprintService.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,16 @@ func RegisterFootprintWorker() {
for metric, data := range jobStats { // Metric, Hostname:Stats
avg, min, max := 0.0, math.MaxFloat32, -math.MaxFloat32

for _, hostStats := range data {
avg += hostStats.Avg
min = math.Min(min, hostStats.Min)
max = math.Max(max, hostStats.Max)
for hostname := range data {
hostStats, ok := data[hostname]
if !ok {
log.Debugf("footprintWorker: NAN stats returned for job %d @ %s", job.JobID, hostname)
} else {
log.Debugf("stats returned for job %d : %#v", job.JobID, hostStats)
avg += hostStats.Avg
min = math.Min(min, hostStats.Min)
max = math.Max(max, hostStats.Max)
}
}

// Add values rounded to 2 digits
Expand Down

0 comments on commit 5f4a74f

Please sign in to comment.