updated
This commit is contained in:
@@ -158,6 +158,13 @@ func (s *Server) loadTemplates() {
|
||||
}
|
||||
return fmt.Sprintf("%.2f GB", gb)
|
||||
},
|
||||
"subtract": func(a, b int) int {
|
||||
r := a - b
|
||||
if r < 0 {
|
||||
return 0
|
||||
}
|
||||
return r
|
||||
},
|
||||
}
|
||||
|
||||
s.tmpl = template.Must(template.New("").Funcs(funcMap).Parse(allTemplates))
|
||||
@@ -422,6 +429,11 @@ func (s *Server) deployHandler(w http.ResponseWriter, _ *http.Request, name stri
|
||||
percent = afterReqMB * 100 / usableMB
|
||||
}
|
||||
|
||||
committedPercent := 0
|
||||
if usableMB > 0 {
|
||||
committedPercent = committedReqMB * 100 / usableMB
|
||||
}
|
||||
|
||||
memInfo["Available"] = true
|
||||
memInfo["TotalMB"] = totalMB
|
||||
memInfo["ReservedMB"] = reservedMB
|
||||
@@ -430,6 +442,7 @@ func (s *Server) deployHandler(w http.ResponseWriter, _ *http.Request, name stri
|
||||
memInfo["NewRequestMB"] = newReqMB
|
||||
memInfo["AfterMB"] = afterReqMB
|
||||
memInfo["Percent"] = percent
|
||||
memInfo["CommittedPercent"] = committedPercent
|
||||
memInfo["Blocked"] = newReqMB > 0 && afterReqMB > usableMB
|
||||
memInfo["OvercommitWarn"] = newLimitMB > 0 && afterLimitMB > totalMB
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user