Skip to content

Commit

Permalink
fix panic (#562)
Browse files Browse the repository at this point in the history
  • Loading branch information
frostbyte73 authored Dec 14, 2023
1 parent d748818 commit 1229daf
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/service/service_prom.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,13 @@ func (s *Service) promProcUpdate(pUsage map[int]float64) map[string]float64 {

eUsage := make(map[string]float64)
for _, h := range s.activeHandlers {
if usage, ok := pUsage[h.cmd.Process.Pid]; ok {
eUsage[h.req.EgressId] = usage
h.updateCPU(usage)
if cmd := h.cmd; cmd != nil {
if process := cmd.Process; process != nil {
if usage, ok := pUsage[process.Pid]; ok {
eUsage[h.req.EgressId] = usage
h.updateCPU(usage)
}
}
}
}

Expand Down

0 comments on commit 1229daf

Please sign in to comment.