Adds option to disable Stackdriver Export (#293)
This commit is contained in:
parent
595bd21d38
commit
90f9287f3a
17 changed files with 267 additions and 75 deletions
|
@ -69,8 +69,19 @@ type checkoutService struct {
|
|||
}
|
||||
|
||||
func main() {
|
||||
go initTracing()
|
||||
go initProfiling("checkoutservice", "1.0.0")
|
||||
if os.Getenv("DISABLE_TRACING") == "" {
|
||||
log.Info("Tracing enabled.")
|
||||
go initTracing()
|
||||
} else {
|
||||
log.Info("Tracing disabled.")
|
||||
}
|
||||
|
||||
if os.Getenv("DISABLE_PROFILER") == "" {
|
||||
log.Info("Profiling enabled.")
|
||||
go initProfiling("checkoutservice", "1.0.0")
|
||||
} else {
|
||||
log.Info("Profiling disabled.")
|
||||
}
|
||||
|
||||
port := listenPort
|
||||
if os.Getenv("PORT") != "" {
|
||||
|
@ -91,7 +102,15 @@ func main() {
|
|||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
srv := grpc.NewServer(grpc.StatsHandler(&ocgrpc.ServerHandler{}))
|
||||
|
||||
var srv *grpc.Server
|
||||
if os.Getenv("DISABLE_STATS") == "" {
|
||||
log.Info("Stats enabled.")
|
||||
srv = grpc.NewServer(grpc.StatsHandler(&ocgrpc.ServerHandler{}))
|
||||
} else {
|
||||
log.Info("Stats disabled.")
|
||||
srv = grpc.NewServer()
|
||||
}
|
||||
pb.RegisterCheckoutServiceServer(srv, svc)
|
||||
healthpb.RegisterHealthServer(srv, svc)
|
||||
log.Infof("starting to listen on tcp: %q", lis.Addr().String())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue