lib/ur: Track new folder feature usage (#6803)

This commit is contained in:
Audrius Butkevicius
2020-06-28 20:35:22 +02:00
committed by GitHub
parent d7fc7008af
commit 9d4a700829
4 changed files with 180 additions and 6 deletions
+10 -6
View File
@@ -13,6 +13,8 @@ import (
"reflect"
"strconv"
"time"
"github.com/syncthing/syncthing/lib/util"
)
type Report struct {
@@ -119,6 +121,13 @@ type Report struct {
PullOrder map[string]int `json:"pullOrder,omitempty" since:"3"`
FilesystemType map[string]int `json:"filesystemType,omitempty" since:"3"`
FsWatcherDelays []int `json:"fsWatcherDelays,omitempty" since:"3"`
CustomMarkerName int `json:"customMarkerName,omitempty" since:"3"`
CopyOwnershipFromParent int `json:"copyOwnershipFromParent,omitempty" since:"3"`
ModTimeWindowS []int `json:"modTimeWindowS,omitempty" since:"3"`
MaxConcurrentWrites []int `json:"maxConcurrentWrites,omitempty" since:"3"`
DisableFsync int `json:"disableFsync,omitempty" since:"3"`
BlockPullOrder map[string]int `json:"blockPullOrder,omitempty" since:"3"`
CopyRangeMethod map[string]int `json:"copyRangeMethod,omitempty" since:"3"`
} `json:"folderUsesV3,omitempty" since:"3"`
GUIStats struct {
@@ -164,12 +173,7 @@ type Report struct {
func New() *Report {
r := &Report{}
r.FolderUsesV3.PullOrder = make(map[string]int)
r.FolderUsesV3.FilesystemType = make(map[string]int)
r.GUIStats.Theme = make(map[string]int)
r.TransportStats = make(map[string]int)
r.RescanIntvs = make([]int, 0)
r.FolderUsesV3.FsWatcherDelays = make([]int, 0)
util.FillNil(r)
return r
}
+13
View File
@@ -256,6 +256,19 @@ func (s *Service) reportData(ctx context.Context, urVersion int, preview bool) (
report.FolderUsesV3.PullOrder[cfg.Order.String()]++
report.FolderUsesV3.FilesystemType[cfg.FilesystemType.String()]++
report.FolderUsesV3.FsWatcherDelays = append(report.FolderUsesV3.FsWatcherDelays, cfg.FSWatcherDelayS)
if cfg.MarkerName != config.DefaultMarkerName {
report.FolderUsesV3.CustomMarkerName++
}
if cfg.CopyOwnershipFromParent {
report.FolderUsesV3.CopyOwnershipFromParent++
}
report.FolderUsesV3.ModTimeWindowS = append(report.FolderUsesV3.ModTimeWindowS, int(cfg.ModTimeWindow().Seconds()))
report.FolderUsesV3.MaxConcurrentWrites = append(report.FolderUsesV3.MaxConcurrentWrites, cfg.MaxConcurrentWrites)
if cfg.DisableFsync {
report.FolderUsesV3.DisableFsync++
}
report.FolderUsesV3.BlockPullOrder[cfg.BlockPullOrder.String()]++
report.FolderUsesV3.CopyRangeMethod[cfg.CopyRangeMethod.String()]++
}
sort.Ints(report.FolderUsesV3.FsWatcherDelays)