all: Add Prometheus-style metrics to expose some internal performance counters (fixes #5175) (#9003)

This commit is contained in:
Jakob Borg
2023-08-04 19:57:30 +02:00
committed by GitHub
parent 58042b3129
commit b9c08d3814
25 changed files with 945 additions and 53 deletions
+8
View File
@@ -137,6 +137,9 @@ func newFolder(model *model, fset *db.FileSet, ignores *ignore.Matcher, cfg conf
f.pullPause = f.pullBasePause()
f.pullFailTimer = time.NewTimer(0)
<-f.pullFailTimer.C
registerFolderMetrics(f.ID)
return f
}
@@ -459,6 +462,11 @@ func (f *folder) scanSubdirs(subDirs []string) error {
}
defer f.ioLimiter.Give(1)
metricFolderScans.WithLabelValues(f.ID).Inc()
ctx, cancel := context.WithCancel(f.ctx)
defer cancel()
go addTimeUntilCancelled(ctx, metricFolderScanSeconds.WithLabelValues(f.ID))
for i := range subDirs {
sub := osutil.NativeFilename(subDirs[i])