diff --git a/release/kubernetes-manifests.yaml b/release/kubernetes-manifests.yaml index eea7574..49c9e2b 100644 --- a/release/kubernetes-manifests.yaml +++ b/release/kubernetes-manifests.yaml @@ -374,8 +374,8 @@ spec: value: "1" - name: ENABLE_RELOAD value: "1" - - name: LATENCY_SPIKE - value: "100" + # - name: LATENCY_SPIKE + # value: "100" # - name: JAEGER_SERVICE_ADDR # value: "jaeger-collector:14268" readinessProbe: diff --git a/src/productcatalogservice/server.go b/src/productcatalogservice/server.go index 4770d0d..3cececb 100644 --- a/src/productcatalogservice/server.go +++ b/src/productcatalogservice/server.go @@ -28,7 +28,7 @@ import ( // "syscall" "time" "math/rand" - "strconv" + // "strconv" pb "github.com/GoogleCloudPlatform/microservices-demo/src/productcatalogservice/genproto" healthpb "google.golang.org/grpc/health/grpc_health_v1" @@ -249,12 +249,12 @@ func (p *productCatalog) ListProducts(context.Context, *pb.Empty) (*pb.ListProdu func (p *productCatalog) GetProduct(ctx context.Context, req *pb.GetProductRequest) (*pb.Product, error) { if s := os.Getenv("LATENCY_SPIKE"); s != "" { - v, err := strconv.Atoi(s) - if err != nil { - log.Fatalf("faigit chaled to parse EXTRA_LATENCY (%s) as int: %+v", v, err) - } - rand.Seed(time.Now().UnixNano()) - n := 3 * (1 + rand.Intn(v)) // n will be between 0 and v + // v, err := strconv.Atoi(s) + // if err != nil { + // log.Fatalf("faigit chaled to parse EXTRA_LATENCY (%s) as int: %+v", v, err) + // } + // rand.Seed(time.Now().UnixNano()) + n := 3 * (1 + rand.Intn(10)) // n will be between 0 and v time.Sleep(time.Duration(n)*time.Second) log.Infof("extra latency enabled (duration: %v)", extraLatency) } else {