Skip to content

Commit

Permalink
fix panic if no node memory metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
apetruhin committed Oct 11, 2022
1 parent 7110c47 commit 7493b28
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions api/views/overview/overview.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,12 @@ func Render(w *model.World) *View {
}
}

if total := n.MemoryTotalBytes.Last(); !math.IsNaN(total) {
node.AddTag("memory: " + humanize.Bytes(uint64(total)))
if avail := n.MemoryAvailableBytes.Last(); !math.IsNaN(avail) {
memoryPercent.SetProgress(int(100-avail/total*100), "deep-purple")
if n.MemoryTotalBytes != nil && n.MemoryAvailableBytes != nil {
if total := n.MemoryTotalBytes.Last(); !math.IsNaN(total) {
node.AddTag("memory: " + humanize.Bytes(uint64(total)))
if avail := n.MemoryAvailableBytes.Last(); !math.IsNaN(avail) {
memoryPercent.SetProgress(int(100-avail/total*100), "deep-purple")
}
}
}

Expand Down

0 comments on commit 7493b28

Please sign in to comment.