Skip to content

Commit

Permalink
Merge pull request #756 from kongfei605/heartbeat_up
Browse files Browse the repository at this point in the history
cpu_cores correcting for some cases
  • Loading branch information
kongfei605 authored Jan 4, 2024
2 parents a131a71 + 33e03c4 commit 12fa6df
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions heartbeat/heartbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net"
"net/http"
"runtime"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -114,6 +115,12 @@ func work(ps *system.SystemPS, client *http.Client) {

if ext, err := collectSystemInfo(); err == nil {
data["extend_info"] = ext
if cpuInfo, ok := ext.CPU.(map[string]string); ok {
cpuNum := cpuInfo["cpu_cores"]
if num, err := strconv.Atoi(cpuNum); err == nil {
data["cpu_num"] = num
}
}
} else {
log.Println("E! failed to collect system info:", err)
}
Expand Down

0 comments on commit 12fa6df

Please sign in to comment.