Skip to content

Commit

Permalink
Warn client when invocation fail.
Browse files Browse the repository at this point in the history
Before the relay panics when the function
not repond in time or something breaks.
Instead of breaking we send back a waring to
the invoking client.

Signed-off-by: David Schall <[email protected]>
  • Loading branch information
dhschall committed Dec 17, 2023
1 parent ac05758 commit 1a9cb16
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
4 changes: 2 additions & 2 deletions tools/relay/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ 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.59.0
google.golang.org/grpc v1.60.0
)

require (
Expand Down
16 changes: 8 additions & 8 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.45.0 h1:RsQi0qJ2imFfCvZabqzM9cNXBG8k6gXMv1A0cXRmH6A=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.45.0/go.mod h1:vsh3ySueQCiKPxFLvjWC4Z135gIa34TQ/NSqkDTZYUM=
go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs=
Expand All @@ -46,20 +46,20 @@ go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1
go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/oauth2 v0.11.0 h1:vPL4xzxBM4niKCW6g9whtaWVXTJf1U5e4aZxxFx/gbU=
golang.org/x/oauth2 v0.11.0/go.mod h1:LdF7O/8bLR/qWK9DrpXmbHLTouvRHK0SgJl0GmDBchk=
golang.org/x/oauth2 v0.13.0 h1:jDDenyj+WgFtmV3zYVoi8aE2BwtXFLWOA67ZfNWftiY=
golang.org/x/oauth2 v0.13.0/go.mod h1:/JMhi4ZRXAf4HG9LiNmxvk+45+96RUlVThiH8FzNBn0=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM=
google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds=
google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 h1:AB/lmRny7e2pLhFEYIbl5qkDAUt2h0ZRO4wGPhZf+ik=
google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405/go.mod h1:67X1fPuzjcrkymZzZV1vvkFeTn2Rvc6lYF9MYFGCcwE=
google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk=
google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98=
google.golang.org/grpc v1.60.0 h1:6FQAR0kM31P6MRdeluor2w2gPaS4SVNrD/DNTxrQ15k=
google.golang.org/grpc v1.60.0/go.mod h1:OlCHIeLYqSSsLi6i49B5QGdzaMZK9+M7LXN2FKz4eGM=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
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
}

0 comments on commit 1a9cb16

Please sign in to comment.