Add profiling support for cloud.google.com

- Adds dependency on env var GOOGLE_APPLICATION_CREDENTIALS, which
should contain a json file with a service key
This commit is contained in:
Peter Stuifzand 2018-05-06 10:43:45 +02:00
parent e935820387
commit 6e89e8d4f7

View File

@ -31,6 +31,7 @@ import (
"linkheader"
"cloud.google.com/go/profiler"
"github.com/garyburd/redigo/redis"
"github.com/pstuifzand/microsub-server/microsub"
"github.com/pstuifzand/microsub-server/pkg/util"
@ -299,6 +300,14 @@ func newPool(addr string) *redis.Pool {
}
func main() {
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)
}
flag.Parse()
createBackend := false