Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn client when Invocation fail #634

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/relay/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ replace github.com/vhive-serverless/vSwarm/utils/tracing/go => ../../utils/traci

require (
github.com/sirupsen/logrus v1.9.3
github.com/vhive-serverless/vSwarm-proto v0.4.3-0.20231030051952-95c2986277cc
github.com/vhive-serverless/vSwarm-proto v0.5.0
github.com/vhive-serverless/vSwarm/utils/tracing/go v0.0.0-20230802102142-dbfda39fc27c
google.golang.org/grpc v1.60.1
)
Expand Down
4 changes: 2 additions & 2 deletions tools/relay/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/vhive-serverless/vSwarm-proto v0.4.3-0.20231030051952-95c2986277cc h1:jzG4kdqtKGvAIuIvAa1aBGsbceeDEfL/w0wn7E0gO6E=
github.com/vhive-serverless/vSwarm-proto v0.4.3-0.20231030051952-95c2986277cc/go.mod h1:SwR0sLup2AAxyjm81H8OPr+jd2D7gNBZSMTGJZaedWw=
github.com/vhive-serverless/vSwarm-proto v0.5.0 h1:EWPD0xTs1XkBerTQVsQ9sFJSOyCUKOu7Y3L9AftuLow=
github.com/vhive-serverless/vSwarm-proto v0.5.0/go.mod h1:bUm7QUFkBnFNVhbG7PHWRNT5tXRFXR9WEkfIGE82o+0=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 h1:SpGay3w+nEwMpfVnbqOLH5gY52/foP8RE8UzTZ1pdSE=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1/go.mod h1:4UoMYEZOC0yN/sPGH76KPkkU7zgiEWYWL9vwmbnTJPE=
go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc=
Expand Down
20 changes: 12 additions & 8 deletions tools/relay/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,24 @@ var (
generatorString = flag.String("generator", "unique", "Generator type (unique / linear / random)")
value = flag.String("value", "helloWorld", "String input to pass to benchmark")
functionMethod = flag.String("function-method", "default", "Which method of benchmark to invoke")
verbose = flag.Bool("verbose", false, "Enable verbose log printing")

// Client
grpcClient grpcClients.GrpcClient
inputGenerator grpcClients.Generator
)

func isDebuggingEnabled() bool {
debugging := false
if val, ok := os.LookupEnv("ENABLE_DEBUGGING"); !ok || val == "false" {
return false
debugging = false
} else if val == "true" {
return true
debugging = true
} else {
log.Fatalf("ENABLE_DEBUGGING has unexpected value: `%s`", val)
return false
}
return debugging || *verbose
}

func main() {
Expand All @@ -99,7 +102,9 @@ func main() {
serviceName := grpcClients.FindServiceName(*functionName)
grpcClient = grpcClients.FindGrpcClient(serviceName)
ctx := context.Background()
grpcClient.Init(ctx, *functionEndpointURL, *functionEndpointPort)
if err := grpcClient.Init(ctx, *functionEndpointURL, *functionEndpointPort); err != nil {
log.Fatalf("Fail to init client: %s", err)
}
defer grpcClient.Close()

// Configure the Input generator
Expand Down Expand Up @@ -146,13 +151,12 @@ func main() {
}

func (s *server) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.HelloReply, error) {
log.Info("Received from invoker: ", in.GetName())

// Create new packet
pkt := inputGenerator.Next()
log.Debug("Send to func: ", pkt)
reply := grpcClient.Request(ctx, pkt)
log.Debug("Recv from func: ", reply)
log.Debugf("Send to func: %s\n", pkt)
reply, err := grpcClient.Request(ctx, pkt)
log.Debugf("Recv from func: %s\n", reply)

return &pb.HelloReply{Message: reply}, nil
return &pb.HelloReply{Message: reply}, err
}
Loading