chore(ur): add RSS to reported stats (#10002)
For easier comparison in the future.
This commit is contained in:
@@ -34,6 +34,7 @@ type Report struct {
|
||||
SHA256Perf float64 `json:"sha256Perf,omitempty" metric:"sha256_perf_mibps,summary" since:"1"`
|
||||
HashPerf float64 `json:"hashPerf,omitempty" metric:"hash_perf_mibps,summary" since:"1"`
|
||||
MemorySize int `json:"memorySize,omitempty" metric:"memory_size_mib,summary" since:"1"`
|
||||
ProcessRSSMiB int `json:"processRSSMiB,omitempty" metric:"process_rss_mib,summary" since:"1"`
|
||||
|
||||
// v2 fields
|
||||
|
||||
|
||||
@@ -14,12 +14,14 @@ import (
|
||||
"math/rand"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/shirou/gopsutil/v4/process"
|
||||
"github.com/syncthing/syncthing/lib/build"
|
||||
"github.com/syncthing/syncthing/lib/config"
|
||||
"github.com/syncthing/syncthing/lib/connections"
|
||||
@@ -119,6 +121,12 @@ func (s *Service) reportData(ctx context.Context, urVersion int, preview bool) (
|
||||
report.MemorySize = int(memorySize() / 1024 / 1024)
|
||||
report.NumCPU = runtime.NumCPU()
|
||||
|
||||
if proc, err := process.NewProcess(int32(os.Getpid())); err == nil {
|
||||
if mem, err := proc.MemoryInfo(); err == nil {
|
||||
report.ProcessRSSMiB = int(mem.RSS / 1024 / 1024)
|
||||
}
|
||||
}
|
||||
|
||||
for _, cfg := range s.cfg.Folders() {
|
||||
report.RescanIntvs = append(report.RescanIntvs, cfg.RescanIntervalS)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user