Skip to content

Commit

Permalink
Remove version arg
Browse files Browse the repository at this point in the history
  • Loading branch information
jtibshirani committed Sep 9, 2024
1 parent 8ab6a84 commit 080d0b9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
3 changes: 1 addition & 2 deletions cmd/zoekt-git-index/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"runtime/pprof"
"strings"

"github.com/sourcegraph/zoekt"
"github.com/sourcegraph/zoekt/internal/profiler"
"go.uber.org/automaxprocs/maxprocs"

Expand Down Expand Up @@ -110,7 +109,7 @@ func run() int {
opts.LanguageMap[m[0]] = ctags.StringToParser(m[1])
}

profiler.InitLightweight("zoekt-git-index", zoekt.Version)
profiler.InitLightweight("zoekt-git-index")
exitStatus := 0
for dir, name := range gitRepos {
opts.RepositoryDescription.Name = name
Expand Down
2 changes: 1 addition & 1 deletion cmd/zoekt-sourcegraph-indexserver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,7 @@ func startServer(conf rootConfig) error {
return err
}

profiler.Init("zoekt-sourcegraph-indexserver", zoekt.Version)
profiler.Init("zoekt-sourcegraph-indexserver")
setCompoundShardCounter(s.IndexDir)

if conf.listen != "" {
Expand Down
2 changes: 1 addition & 1 deletion cmd/zoekt-webserver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func main() {
liblog := sglog.Init(resource)
defer liblog.Sync()
tracer.Init(resource)
profiler.Init("zoekt-webserver", zoekt.Version)
profiler.Init("zoekt-webserver")

if *logDir != "" {
if fi, err := os.Lstat(*logDir); err != nil || !fi.IsDir() {
Expand Down
9 changes: 5 additions & 4 deletions internal/profiler/profiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
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,
})
Expand All @@ -24,11 +25,11 @@ func Init(svcName, version string) {

// InitLightweight starts the supported profilers IFF the environment variable is set.
// Compared to Init, it disables mutex profiling and forced GC to reduce its overhead.
func InitLightweight(svcName, version string) {
func InitLightweight(svcName string) {
if os.Getenv("GOOGLE_CLOUD_PROFILER_ENABLED") != "" {
err := profiler.Start(profiler.Config{
Service: svcName,
ServiceVersion: version,
ServiceVersion: zoekt.Version,
})
if err != nil {
log.Printf("could not initialize profiler: %s", err.Error())
Expand Down

0 comments on commit 080d0b9

Please sign in to comment.