chore(ur): add RSS to reported stats (#10002)

For easier comparison in the future.
This commit is contained in:
Jakob Borg
2025-03-27 10:17:10 +01:00
committed by GitHub
parent 3fd090bfa7
commit 4235b2c406
2 changed files with 9 additions and 0 deletions
+1
View File
@@ -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
+8
View File
@@ -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)