Skip to content

Commit

Permalink
chore: update variable name and return result
Browse files Browse the repository at this point in the history
  • Loading branch information
gshilei committed Dec 4, 2024
1 parent e70f4d1 commit 2063067
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/metrics/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ func InitProcessMetricsServer(listenAddress string) <-chan error {
customRegistry.MustRegister(ProcessRequestDuration)
customRegistry.MustRegister(ProcessPerRequestDuration)

var errCH chan error
var errChan chan error
go func() {
http.Handle("/process/metrics", promhttp.HandlerFor(customRegistry, promhttp.HandlerOpts{}))
errCH <- http.ListenAndServe(listenAddress, nil)
errChan <- http.ListenAndServe(listenAddress, nil)
}()
return errCH
return errChan
}

func RecordProcessResourceUsageMetrics(pid int32) error {
Expand Down Expand Up @@ -228,11 +228,11 @@ func CollectProcessInfo(pid int32) (*ProcessInfo, error) {
}
memoryPercent, err := p.MemoryPercent()
if err != nil {
fmt.Errorf("failed to get process[%v] memory percent: %v", pid, err)
return nil, fmt.Errorf("failed to get process[%v] memory percent: %v", pid, err)
}
memInfo, err := p.MemoryInfo()
if err != nil {
fmt.Errorf("failed to get process[%v] memory info: %v", pid, err)
return nil, fmt.Errorf("failed to get process[%v] memory info: %v", pid, err)
}

pi := &ProcessInfo{
Expand Down

0 comments on commit 2063067

Please sign in to comment.