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"`
|
SHA256Perf float64 `json:"sha256Perf,omitempty" metric:"sha256_perf_mibps,summary" since:"1"`
|
||||||
HashPerf float64 `json:"hashPerf,omitempty" metric:"hash_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"`
|
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
|
// v2 fields
|
||||||
|
|
||||||
|
|||||||
@@ -14,12 +14,14 @@ import (
|
|||||||
"math/rand"
|
"math/rand"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/shirou/gopsutil/v4/process"
|
||||||
"github.com/syncthing/syncthing/lib/build"
|
"github.com/syncthing/syncthing/lib/build"
|
||||||
"github.com/syncthing/syncthing/lib/config"
|
"github.com/syncthing/syncthing/lib/config"
|
||||||
"github.com/syncthing/syncthing/lib/connections"
|
"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.MemorySize = int(memorySize() / 1024 / 1024)
|
||||||
report.NumCPU = runtime.NumCPU()
|
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() {
|
for _, cfg := range s.cfg.Folders() {
|
||||||
report.RescanIntvs = append(report.RescanIntvs, cfg.RescanIntervalS)
|
report.RescanIntvs = append(report.RescanIntvs, cfg.RescanIntervalS)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user