diff --git a/cmd/eksterd/main.go b/cmd/eksterd/main.go index eb0b9eb..d5970b2 100644 --- a/cmd/eksterd/main.go +++ b/cmd/eksterd/main.go @@ -26,6 +26,7 @@ import ( "regexp" "time" + "cloud.google.com/go/profiler" "github.com/garyburd/redigo/redis" "github.com/pstuifzand/ekster/pkg/microsub" ) @@ -58,6 +59,17 @@ func newPool(addr string) *redis.Pool { } func main() { + + if os.Getenv("GOOGLE_APPLICATION_CREDENTIALS") != "" { + if err := profiler.Start(profiler.Config{ + Service: "microsub-server", + ServiceVersion: "1.0", + ProjectID: "microsub-server", // optional on GCP + }); err != nil { + log.Fatalf("Cannot start the profiler: %v", err) + } + } + log.Println("eksterd - microsub server") flag.Parse()