go services: fix bug that starts profiling 3 times

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This commit is contained in:
Ahmet Alp Balkan 2018-07-17 21:33:49 -07:00
parent 38cd08e1ad
commit 3ac12b862f
4 changed files with 12 additions and 0 deletions

View file

@ -95,6 +95,9 @@ func initProfiling(service, version string) {
// ProjectID: "my-project", // ProjectID: "my-project",
}); err != nil { }); err != nil {
log.Printf("warn: failed to start profiler: %+v", err) log.Printf("warn: failed to start profiler: %+v", err)
} else {
log.Print("started stackdriver profiler")
return
} }
d := time.Second * 10 * time.Duration(i) d := time.Second * 10 * time.Duration(i)
log.Printf("sleeping %v to retry initializing stackdriver profiler", d) log.Printf("sleeping %v to retry initializing stackdriver profiler", d)

View file

@ -145,6 +145,9 @@ func initProfiling(log logrus.FieldLogger, service, version string) {
// ProjectID: "my-project", // ProjectID: "my-project",
}); err != nil { }); err != nil {
log.Warnf("warn: failed to start profiler: %+v", err) log.Warnf("warn: failed to start profiler: %+v", err)
} else {
log.Info("started stackdriver profiler")
return
} }
d := time.Second * 10 * time.Duration(i) d := time.Second * 10 * time.Duration(i)
log.Debugf("sleeping %v to retry initializing stackdriver profiler", d) log.Debugf("sleeping %v to retry initializing stackdriver profiler", d)

View file

@ -139,6 +139,9 @@ func initProfiling(service, version string) {
// ProjectID: "my-project", // ProjectID: "my-project",
}); err != nil { }); err != nil {
log.Printf("warn: failed to start profiler: %+v", err) log.Printf("warn: failed to start profiler: %+v", err)
} else {
log.Print("started stackdriver profiler")
return
} }
d := time.Second * 10 * time.Duration(i) d := time.Second * 10 * time.Duration(i)
log.Printf("sleeping %v to retry initializing stackdriver profiler", d) log.Printf("sleeping %v to retry initializing stackdriver profiler", d)

View file

@ -120,6 +120,9 @@ func initProfiling(service, version string) {
// ProjectID: "my-project", // ProjectID: "my-project",
}); err != nil { }); err != nil {
log.Printf("warn: failed to start profiler: %+v", err) log.Printf("warn: failed to start profiler: %+v", err)
} else {
log.Print("started stackdriver profiler")
return
} }
d := time.Second * 10 * time.Duration(i) d := time.Second * 10 * time.Duration(i)
log.Printf("sleeping %v to retry initializing stackdriver profiler", d) log.Printf("sleeping %v to retry initializing stackdriver profiler", d)