diff --git a/cmd/zoekt-git-index/main.go b/cmd/zoekt-git-index/main.go index c1aa5d1ad..5ba4bc38f 100644 --- a/cmd/zoekt-git-index/main.go +++ b/cmd/zoekt-git-index/main.go @@ -22,6 +22,7 @@ import ( "runtime/pprof" "strings" + "github.com/sourcegraph/zoekt/internal/profiler" "go.uber.org/automaxprocs/maxprocs" "github.com/sourcegraph/zoekt/cmd" @@ -70,6 +71,7 @@ func run() int { } *repoCacheDir = dir } + opts := cmd.OptionsFromFlags() opts.IsDelta = *isDelta opts.DocumentRanksPath = *offlineRanking @@ -107,6 +109,7 @@ func run() int { opts.LanguageMap[m[0]] = ctags.StringToParser(m[1]) } + profiler.Init("zoekt-git-index") exitStatus := 0 for dir, name := range gitRepos { opts.RepositoryDescription.Name = name diff --git a/cmd/zoekt-sourcegraph-indexserver/main.go b/cmd/zoekt-sourcegraph-indexserver/main.go index 671e3de91..d5c513bfb 100644 --- a/cmd/zoekt-sourcegraph-indexserver/main.go +++ b/cmd/zoekt-sourcegraph-indexserver/main.go @@ -1277,7 +1277,7 @@ func startServer(conf rootConfig) error { return err } - profiler.Init("zoekt-sourcegraph-indexserver", zoekt.Version, conf.blockProfileRate) + profiler.Init("zoekt-sourcegraph-indexserver") setCompoundShardCounter(s.IndexDir) if conf.listen != "" { diff --git a/cmd/zoekt-webserver/main.go b/cmd/zoekt-webserver/main.go index 5503dd3c8..49fb923d2 100644 --- a/cmd/zoekt-webserver/main.go +++ b/cmd/zoekt-webserver/main.go @@ -177,7 +177,7 @@ func main() { liblog := sglog.Init(resource) defer liblog.Sync() tracer.Init(resource) - profiler.Init("zoekt-webserver", zoekt.Version, -1) + profiler.Init("zoekt-webserver") if *logDir != "" { if fi, err := os.Lstat(*logDir); err != nil || !fi.IsDir() { diff --git a/internal/profiler/profiler.go b/internal/profiler/profiler.go index 194fc9b4b..84039ac92 100644 --- a/internal/profiler/profiler.go +++ b/internal/profiler/profiler.go @@ -5,14 +5,15 @@ import ( "os" "cloud.google.com/go/profiler" + "github.com/sourcegraph/zoekt" ) // Init starts the supported profilers IFF the environment variable is set. -func Init(svcName, version string, blockProfileRate int) { +func Init(svcName string) { if os.Getenv("GOOGLE_CLOUD_PROFILER_ENABLED") != "" { err := profiler.Start(profiler.Config{ Service: svcName, - ServiceVersion: version, + ServiceVersion: zoekt.Version, MutexProfiling: true, AllocForceGC: true, })