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
|
@ -58,8 +58,19 @@ func init() {
|
|||
}
|
||||
|
||||
func main() {
|
||||
go initTracing()
|
||||
go initProfiling("shippingservice", "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("shippingservice", "1.0.0")
|
||||
} else {
|
||||
log.Info("Profiling disabled.")
|
||||
}
|
||||
|
||||
port := defaultPort
|
||||
if value, ok := os.LookupEnv("PORT"); ok {
|
||||
|
@ -71,7 +82,15 @@ func main() {
|
|||
if err != nil {
|
||||
log.Fatalf("failed to listen: %v", 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()
|
||||
}
|
||||
svc := &server{}
|
||||
pb.RegisterShippingServiceServer(srv, svc)
|
||||
healthpb.RegisterHealthServer(srv, svc)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue