refactor fix after profiler patch

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This commit is contained in:
Ahmet Alp Balkan 2018-07-16 15:09:51 -07:00
parent 9486bc24fd
commit e4664c22ea
5 changed files with 8 additions and 9 deletions

View File

@ -43,9 +43,9 @@ func main() {
// ProjectID must be set if not running on GCP. // ProjectID must be set if not running on GCP.
// ProjectID: "my-project", // ProjectID: "my-project",
}); err != nil { }); err != nil {
// TODO: Handle error. log.Fatalf("failed to start profiler: %+v", err)
} }
port := listenPort port := listenPort
if os.Getenv("PORT") != "" { if os.Getenv("PORT") != "" {
port = os.Getenv("PORT") port = os.Getenv("PORT")

View File

@ -3,6 +3,7 @@ package main
import ( import (
"context" "context"
"fmt" "fmt"
"log"
"net/http" "net/http"
"os" "os"
"time" "time"
@ -62,14 +63,13 @@ type frontendServer struct {
} }
func main() { func main() {
// Profiler initialization, best done as early as possible.
if err := profiler.Start(profiler.Config{ if err := profiler.Start(profiler.Config{
Service: "frontendservice", Service: "frontendservice",
ServiceVersion: "1.0.0", ServiceVersion: "1.0.0",
// ProjectID must be set if not running on GCP. // ProjectID must be set if not running on GCP.
// ProjectID: "my-project", // ProjectID: "my-project",
}); err != nil { }); err != nil {
// TODO: Handle error. log.Fatalf("failed to start profiler: %+v", err)
} }
ctx := context.Background() ctx := context.Background()

View File

@ -94,7 +94,7 @@ func main() {
// ProjectID must be set if not running on GCP. // ProjectID must be set if not running on GCP.
// ProjectID: "my-project", // ProjectID: "my-project",
}); err != nil { }); err != nil {
// TODO: Handle error. log.Fatalf("failed to start profiler: %+v", err)
} }
flag.Parse() flag.Parse()

View File

@ -42,7 +42,7 @@ if __name__ == "__main__":
try: try:
googleclouddebugger.enable( googleclouddebugger.enable(
module='recommendationserver', module='recommendationserver',
version='[VERSION]' version='1.0.0'
) )
except: except:
pass pass
@ -70,4 +70,4 @@ if __name__ == "__main__":
while True: while True:
time.sleep(10000) time.sleep(10000)
except KeyboardInterrupt: except KeyboardInterrupt:
server.stop(0) server.stop(0)

View File

@ -29,14 +29,13 @@ func main() {
} }
port = fmt.Sprintf(":%s", port) port = fmt.Sprintf(":%s", port)
// Profiler initialization, best done as early as possible.
if err := profiler.Start(profiler.Config{ if err := profiler.Start(profiler.Config{
Service: "shippingservice", Service: "shippingservice",
ServiceVersion: "1.0.0", ServiceVersion: "1.0.0",
// ProjectID must be set if not running on GCP. // ProjectID must be set if not running on GCP.
// ProjectID: "my-project", // ProjectID: "my-project",
}); err != nil { }); err != nil {
// TODO: Handle error. log.Fatalf("failed to start profiler: %+v", err)
} }
go initTracing() go initTracing()