Add profiler for microsub server

This commit is contained in:
Peter Stuifzand 2018-07-26 19:49:55 +02:00
parent e4a26e7c96
commit 0d3e2638c1

View File

@ -26,6 +26,7 @@ import (
"regexp" "regexp"
"time" "time"
"cloud.google.com/go/profiler"
"github.com/garyburd/redigo/redis" "github.com/garyburd/redigo/redis"
"github.com/pstuifzand/ekster/pkg/microsub" "github.com/pstuifzand/ekster/pkg/microsub"
) )
@ -58,6 +59,17 @@ func newPool(addr string) *redis.Pool {
} }
func main() { 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") log.Println("eksterd - microsub server")
flag.Parse() flag.Parse()