Skip to content

Commit

Permalink
chore: only use ppid when no error
Browse files Browse the repository at this point in the history
  • Loading branch information
VihasMakwana committed Oct 24, 2024
1 parent d62732f commit 0511323
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions metric/system/process/process_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ func FillPidMetrics(_ resolve.Resolver, pid int, state ProcState, _ func(string)
user, _ := getProcCredName(pid)
state.Username = user // we cannot access process token for system-owned protected processes

ppid, _ := getParentPid(pid)
state.Ppid = opt.IntWith(ppid)
if ppid, err := getParentPid(pid); err == nil {
state.Ppid = opt.IntWith(ppid)
}

wss, size, err := procMem(pid)
if err != nil {
Expand Down

0 comments on commit 0511323

Please sign in to comment.