fork of https://github.com/sourcegraph/zoekt
0

Configure Feed

Select the types of activity you want to include in your feed.

Report GCP profiles from zoekt-git-index (#816)

This PR initializes the GCP profiler in the `zoekt-git-index` process so we can
examine CPU and memory usage for the indexing process itself.

+8 -4
+3
cmd/zoekt-git-index/main.go
··· 22 22 "runtime/pprof" 23 23 "strings" 24 24 25 + "github.com/sourcegraph/zoekt/internal/profiler" 25 26 "go.uber.org/automaxprocs/maxprocs" 26 27 27 28 "github.com/sourcegraph/zoekt/cmd" ··· 70 71 } 71 72 *repoCacheDir = dir 72 73 } 74 + 73 75 opts := cmd.OptionsFromFlags() 74 76 opts.IsDelta = *isDelta 75 77 opts.DocumentRanksPath = *offlineRanking ··· 107 109 opts.LanguageMap[m[0]] = ctags.StringToParser(m[1]) 108 110 } 109 111 112 + profiler.Init("zoekt-git-index") 110 113 exitStatus := 0 111 114 for dir, name := range gitRepos { 112 115 opts.RepositoryDescription.Name = name
+1 -1
cmd/zoekt-sourcegraph-indexserver/main.go
··· 1277 1277 return err 1278 1278 } 1279 1279 1280 - profiler.Init("zoekt-sourcegraph-indexserver", zoekt.Version, conf.blockProfileRate) 1280 + profiler.Init("zoekt-sourcegraph-indexserver") 1281 1281 setCompoundShardCounter(s.IndexDir) 1282 1282 1283 1283 if conf.listen != "" {
+1 -1
cmd/zoekt-webserver/main.go
··· 177 177 liblog := sglog.Init(resource) 178 178 defer liblog.Sync() 179 179 tracer.Init(resource) 180 - profiler.Init("zoekt-webserver", zoekt.Version, -1) 180 + profiler.Init("zoekt-webserver") 181 181 182 182 if *logDir != "" { 183 183 if fi, err := os.Lstat(*logDir); err != nil || !fi.IsDir() {
+3 -2
internal/profiler/profiler.go
··· 5 5 "os" 6 6 7 7 "cloud.google.com/go/profiler" 8 + "github.com/sourcegraph/zoekt" 8 9 ) 9 10 10 11 // Init starts the supported profilers IFF the environment variable is set. 11 - func Init(svcName, version string, blockProfileRate int) { 12 + func Init(svcName string) { 12 13 if os.Getenv("GOOGLE_CLOUD_PROFILER_ENABLED") != "" { 13 14 err := profiler.Start(profiler.Config{ 14 15 Service: svcName, 15 - ServiceVersion: version, 16 + ServiceVersion: zoekt.Version, 16 17 MutexProfiling: true, 17 18 AllocForceGC: true, 18 19 })