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

Configure Feed

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

indexserver: add google cloud profiler integration

Same change we did for zoekt-webserver in f669d63.

Change-Id: I91715ac16226a221f3af95b85b84b8a942806041

+21
+21
cmd/zoekt-sourcegraph-indexserver/main.go
··· 27 27 "sync" 28 28 "time" 29 29 30 + "cloud.google.com/go/profiler" 30 31 "github.com/google/zoekt" 31 32 "github.com/google/zoekt/debugserver" 32 33 "go.uber.org/automaxprocs/maxprocs" ··· 741 742 return zoekt.PrintNgramStats(iFile) 742 743 } 743 744 745 + func initializeGoogleCloudProfiler() { 746 + // Google cloud profiler is opt-in since we only want to run it on 747 + // Sourcegraph.com. 748 + if os.Getenv("GOOGLE_CLOUD_PROFILER_ENABLED") == "" { 749 + return 750 + } 751 + 752 + err := profiler.Start(profiler.Config{ 753 + Service: "zoekt-sourcegraph-indexserver", 754 + ServiceVersion: zoekt.Version, 755 + MutexProfiling: true, 756 + AllocForceGC: true, 757 + }) 758 + if err != nil { 759 + log.Printf("could not initialize google cloud profiler: %s", err.Error()) 760 + } 761 + } 762 + 744 763 func main() { 745 764 defaultIndexDir := os.Getenv("DATA_DIR") 746 765 if defaultIndexDir == "" { ··· 845 864 } 846 865 os.Exit(0) 847 866 } 867 + 868 + initializeGoogleCloudProfiler() 848 869 849 870 queue := &Queue{} 850 871