From ceac3aba7f789e792bf9444f6f2a8bf094eae3b7 Mon Sep 17 00:00:00 2001 From: castaneai Date: Mon, 11 Nov 2024 17:28:46 +0900 Subject: [PATCH] frontend: gRPC-Go implementation for compatibility --- buf.gen.yaml | 4 + frontendgrpc.go | 151 ++++++ gen/openmatch/frontend_grpc.pb.go | 474 ++++++++++++++++++ .../openmatchconnect/frontend.connect.go | 4 +- go.mod | 14 +- go.sum | 22 +- loadtest/cmd/frontend/main.go | 52 +- loadtest/go.mod | 19 +- loadtest/go.sum | 35 +- loadtest/skaffold.yaml | 2 + 10 files changed, 733 insertions(+), 44 deletions(-) create mode 100644 frontendgrpc.go create mode 100644 gen/openmatch/frontend_grpc.pb.go diff --git a/buf.gen.yaml b/buf.gen.yaml index c6248fe..2e33c8a 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -9,6 +9,10 @@ plugins: out: gen opt: - paths=source_relative + - remote: buf.build/grpc/go:v1.5.1 + out: gen + opt: + - paths=source_relative # dependencies - remote: buf.build/protocolbuffers/go:v1.34.2 out: gen diff --git a/frontendgrpc.go b/frontendgrpc.go new file mode 100644 index 0000000..1d38333 --- /dev/null +++ b/frontendgrpc.go @@ -0,0 +1,151 @@ +package minimatch + +import ( + "context" + "errors" + + "github.com/rs/xid" + "github.com/sethvargo/go-retry" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/known/anypb" + "google.golang.org/protobuf/types/known/emptypb" + "google.golang.org/protobuf/types/known/timestamppb" + "google.golang.org/protobuf/types/known/wrapperspb" + + pb "github.com/castaneai/minimatch/gen/openmatch" + "github.com/castaneai/minimatch/pkg/statestore" +) + +type FrontendGPRCService struct { + pb.UnimplementedFrontendServiceServer + + store statestore.FrontendStore + options *frontendOptions +} + +func NewFrontendGPRCService(store statestore.FrontendStore, opts ...FrontendOption) pb.FrontendServiceServer { + options := defaultFrontendOptions() + for _, opt := range opts { + opt.apply(options) + } + return &FrontendGPRCService{store: store, options: options} +} + +func (s *FrontendGPRCService) CreateTicket(ctx context.Context, req *pb.CreateTicketRequest) (*pb.Ticket, error) { + ticket, ok := proto.Clone(req.Ticket).(*pb.Ticket) + if !ok { + return nil, status.Errorf(codes.Internal, "failed to clone input ticket proto") + } + ticket.Id = xid.New().String() + ticket.CreateTime = timestamppb.Now() + ttlVal, err := anypb.New(wrapperspb.Int64(s.options.ticketTTL.Nanoseconds())) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to create ttl value") + } + ticket.PersistentField = map[string]*anypb.Any{ + persistentFieldKeyTicketTTL: ttlVal, + } + if err := s.store.CreateTicket(ctx, ticket, s.options.ticketTTL); err != nil { + return nil, err + } + return ticket, nil +} + +func (s *FrontendGPRCService) DeleteTicket(ctx context.Context, req *pb.DeleteTicketRequest) (*emptypb.Empty, error) { + if req.TicketId == "" { + return nil, status.Errorf(codes.InvalidArgument, "invalid ticket_id") + } + if err := s.store.DeleteTicket(ctx, req.TicketId); err != nil { + return nil, err + } + return &emptypb.Empty{}, nil +} + +func (s *FrontendGPRCService) GetTicket(ctx context.Context, req *pb.GetTicketRequest) (*pb.Ticket, error) { + if req.TicketId == "" { + return nil, status.Errorf(codes.InvalidArgument, "invalid ticket_id") + } + ticket, err := s.store.GetTicket(ctx, req.TicketId) + if err != nil { + if errors.Is(err, statestore.ErrTicketNotFound) { + return nil, status.Errorf(codes.NotFound, "ticket id: %s not found", req.TicketId) + } + return nil, err + } + assignment, err := s.store.GetAssignment(ctx, req.TicketId) + if err != nil && !errors.Is(err, statestore.ErrAssignmentNotFound) { + return nil, err + } + if assignment != nil { + ticket.Assignment = assignment + } + return ticket, nil +} + +func (s *FrontendGPRCService) WatchAssignments(req *pb.WatchAssignmentsRequest, stream grpc.ServerStreamingServer[pb.WatchAssignmentsResponse]) error { + if req.TicketId == "" { + return status.Errorf(codes.InvalidArgument, "invalid ticket_id") + } + + onAssignmentChanged := func(as *pb.Assignment) error { + if err := stream.Send(&pb.WatchAssignmentsResponse{Assignment: as}); err != nil { + return err + } + return nil + } + + var prev *pb.Assignment + backoff := newWatchAssignmentBackoff() + if err := retry.Do(stream.Context(), backoff, func(ctx context.Context) error { + assignment, err := s.store.GetAssignment(ctx, req.TicketId) + if err != nil { + if errors.Is(err, statestore.ErrAssignmentNotFound) { + return retry.RetryableError(err) + } + return err + } + if (prev == nil && assignment != nil) || !proto.Equal(prev, assignment) { + prev = assignment + if err := onAssignmentChanged(assignment); err != nil { + return err + } + } + return retry.RetryableError(errors.New("assignment unchanged")) + }); err != nil { + return err + } + return nil +} + +func (s *FrontendGPRCService) AcknowledgeBackfill(ctx context.Context, req *pb.AcknowledgeBackfillRequest) (*pb.AcknowledgeBackfillResponse, error) { + return nil, status.Error(codes.Unimplemented, "unimplemented") +} + +func (s *FrontendGPRCService) CreateBackfill(ctx context.Context, req *pb.CreateBackfillRequest) (*pb.Backfill, error) { + return nil, status.Error(codes.Unimplemented, "unimplemented") +} + +func (s *FrontendGPRCService) DeleteBackfill(ctx context.Context, req *pb.DeleteBackfillRequest) (*emptypb.Empty, error) { + return nil, status.Error(codes.Unimplemented, "unimplemented") +} + +func (s *FrontendGPRCService) GetBackfill(ctx context.Context, req *pb.GetBackfillRequest) (*pb.Backfill, error) { + return nil, status.Error(codes.Unimplemented, "unimplemented") +} + +func (s *FrontendGPRCService) UpdateBackfill(ctx context.Context, req *pb.UpdateBackfillRequest) (*pb.Backfill, error) { + return nil, status.Error(codes.Unimplemented, "unimplemented") +} + +func (s *FrontendGPRCService) DeindexTicket(ctx context.Context, req *pb.DeindexTicketRequest) (*pb.DeindexTicketResponse, error) { + if req.TicketId == "" { + return nil, status.Errorf(codes.InvalidArgument, "invalid ticket_id") + } + if err := s.store.DeindexTicket(ctx, req.TicketId); err != nil { + return nil, err + } + return &pb.DeindexTicketResponse{}, nil +} diff --git a/gen/openmatch/frontend_grpc.pb.go b/gen/openmatch/frontend_grpc.pb.go new file mode 100644 index 0000000..b9dadb1 --- /dev/null +++ b/gen/openmatch/frontend_grpc.pb.go @@ -0,0 +1,474 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc (unknown) +// source: openmatch/frontend.proto + +package openmatch + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + emptypb "google.golang.org/protobuf/types/known/emptypb" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + FrontendService_CreateTicket_FullMethodName = "/openmatch.FrontendService/CreateTicket" + FrontendService_DeleteTicket_FullMethodName = "/openmatch.FrontendService/DeleteTicket" + FrontendService_GetTicket_FullMethodName = "/openmatch.FrontendService/GetTicket" + FrontendService_WatchAssignments_FullMethodName = "/openmatch.FrontendService/WatchAssignments" + FrontendService_AcknowledgeBackfill_FullMethodName = "/openmatch.FrontendService/AcknowledgeBackfill" + FrontendService_CreateBackfill_FullMethodName = "/openmatch.FrontendService/CreateBackfill" + FrontendService_DeleteBackfill_FullMethodName = "/openmatch.FrontendService/DeleteBackfill" + FrontendService_GetBackfill_FullMethodName = "/openmatch.FrontendService/GetBackfill" + FrontendService_UpdateBackfill_FullMethodName = "/openmatch.FrontendService/UpdateBackfill" + FrontendService_DeindexTicket_FullMethodName = "/openmatch.FrontendService/DeindexTicket" +) + +// FrontendServiceClient is the client API for FrontendService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type FrontendServiceClient interface { + CreateTicket(ctx context.Context, in *CreateTicketRequest, opts ...grpc.CallOption) (*Ticket, error) + DeleteTicket(ctx context.Context, in *DeleteTicketRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + GetTicket(ctx context.Context, in *GetTicketRequest, opts ...grpc.CallOption) (*Ticket, error) + WatchAssignments(ctx context.Context, in *WatchAssignmentsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[WatchAssignmentsResponse], error) + AcknowledgeBackfill(ctx context.Context, in *AcknowledgeBackfillRequest, opts ...grpc.CallOption) (*AcknowledgeBackfillResponse, error) + CreateBackfill(ctx context.Context, in *CreateBackfillRequest, opts ...grpc.CallOption) (*Backfill, error) + DeleteBackfill(ctx context.Context, in *DeleteBackfillRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) + GetBackfill(ctx context.Context, in *GetBackfillRequest, opts ...grpc.CallOption) (*Backfill, error) + UpdateBackfill(ctx context.Context, in *UpdateBackfillRequest, opts ...grpc.CallOption) (*Backfill, error) + // DeindexTickets removes the ticket from the matching candidates. + // unlike DeleteTicket, it does not delete the ticket body; + // you can still get the Assignment with GetTicket after Deindex. + DeindexTicket(ctx context.Context, in *DeindexTicketRequest, opts ...grpc.CallOption) (*DeindexTicketResponse, error) +} + +type frontendServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewFrontendServiceClient(cc grpc.ClientConnInterface) FrontendServiceClient { + return &frontendServiceClient{cc} +} + +func (c *frontendServiceClient) CreateTicket(ctx context.Context, in *CreateTicketRequest, opts ...grpc.CallOption) (*Ticket, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Ticket) + err := c.cc.Invoke(ctx, FrontendService_CreateTicket_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *frontendServiceClient) DeleteTicket(ctx context.Context, in *DeleteTicketRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, FrontendService_DeleteTicket_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *frontendServiceClient) GetTicket(ctx context.Context, in *GetTicketRequest, opts ...grpc.CallOption) (*Ticket, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Ticket) + err := c.cc.Invoke(ctx, FrontendService_GetTicket_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *frontendServiceClient) WatchAssignments(ctx context.Context, in *WatchAssignmentsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[WatchAssignmentsResponse], error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &FrontendService_ServiceDesc.Streams[0], FrontendService_WatchAssignments_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &grpc.GenericClientStream[WatchAssignmentsRequest, WatchAssignmentsResponse]{ClientStream: stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type FrontendService_WatchAssignmentsClient = grpc.ServerStreamingClient[WatchAssignmentsResponse] + +func (c *frontendServiceClient) AcknowledgeBackfill(ctx context.Context, in *AcknowledgeBackfillRequest, opts ...grpc.CallOption) (*AcknowledgeBackfillResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AcknowledgeBackfillResponse) + err := c.cc.Invoke(ctx, FrontendService_AcknowledgeBackfill_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *frontendServiceClient) CreateBackfill(ctx context.Context, in *CreateBackfillRequest, opts ...grpc.CallOption) (*Backfill, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Backfill) + err := c.cc.Invoke(ctx, FrontendService_CreateBackfill_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *frontendServiceClient) DeleteBackfill(ctx context.Context, in *DeleteBackfillRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(emptypb.Empty) + err := c.cc.Invoke(ctx, FrontendService_DeleteBackfill_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *frontendServiceClient) GetBackfill(ctx context.Context, in *GetBackfillRequest, opts ...grpc.CallOption) (*Backfill, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Backfill) + err := c.cc.Invoke(ctx, FrontendService_GetBackfill_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *frontendServiceClient) UpdateBackfill(ctx context.Context, in *UpdateBackfillRequest, opts ...grpc.CallOption) (*Backfill, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Backfill) + err := c.cc.Invoke(ctx, FrontendService_UpdateBackfill_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *frontendServiceClient) DeindexTicket(ctx context.Context, in *DeindexTicketRequest, opts ...grpc.CallOption) (*DeindexTicketResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeindexTicketResponse) + err := c.cc.Invoke(ctx, FrontendService_DeindexTicket_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// FrontendServiceServer is the server API for FrontendService service. +// All implementations must embed UnimplementedFrontendServiceServer +// for forward compatibility. +type FrontendServiceServer interface { + CreateTicket(context.Context, *CreateTicketRequest) (*Ticket, error) + DeleteTicket(context.Context, *DeleteTicketRequest) (*emptypb.Empty, error) + GetTicket(context.Context, *GetTicketRequest) (*Ticket, error) + WatchAssignments(*WatchAssignmentsRequest, grpc.ServerStreamingServer[WatchAssignmentsResponse]) error + AcknowledgeBackfill(context.Context, *AcknowledgeBackfillRequest) (*AcknowledgeBackfillResponse, error) + CreateBackfill(context.Context, *CreateBackfillRequest) (*Backfill, error) + DeleteBackfill(context.Context, *DeleteBackfillRequest) (*emptypb.Empty, error) + GetBackfill(context.Context, *GetBackfillRequest) (*Backfill, error) + UpdateBackfill(context.Context, *UpdateBackfillRequest) (*Backfill, error) + // DeindexTickets removes the ticket from the matching candidates. + // unlike DeleteTicket, it does not delete the ticket body; + // you can still get the Assignment with GetTicket after Deindex. + DeindexTicket(context.Context, *DeindexTicketRequest) (*DeindexTicketResponse, error) + mustEmbedUnimplementedFrontendServiceServer() +} + +// UnimplementedFrontendServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedFrontendServiceServer struct{} + +func (UnimplementedFrontendServiceServer) CreateTicket(context.Context, *CreateTicketRequest) (*Ticket, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateTicket not implemented") +} +func (UnimplementedFrontendServiceServer) DeleteTicket(context.Context, *DeleteTicketRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteTicket not implemented") +} +func (UnimplementedFrontendServiceServer) GetTicket(context.Context, *GetTicketRequest) (*Ticket, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetTicket not implemented") +} +func (UnimplementedFrontendServiceServer) WatchAssignments(*WatchAssignmentsRequest, grpc.ServerStreamingServer[WatchAssignmentsResponse]) error { + return status.Errorf(codes.Unimplemented, "method WatchAssignments not implemented") +} +func (UnimplementedFrontendServiceServer) AcknowledgeBackfill(context.Context, *AcknowledgeBackfillRequest) (*AcknowledgeBackfillResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AcknowledgeBackfill not implemented") +} +func (UnimplementedFrontendServiceServer) CreateBackfill(context.Context, *CreateBackfillRequest) (*Backfill, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateBackfill not implemented") +} +func (UnimplementedFrontendServiceServer) DeleteBackfill(context.Context, *DeleteBackfillRequest) (*emptypb.Empty, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteBackfill not implemented") +} +func (UnimplementedFrontendServiceServer) GetBackfill(context.Context, *GetBackfillRequest) (*Backfill, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBackfill not implemented") +} +func (UnimplementedFrontendServiceServer) UpdateBackfill(context.Context, *UpdateBackfillRequest) (*Backfill, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateBackfill not implemented") +} +func (UnimplementedFrontendServiceServer) DeindexTicket(context.Context, *DeindexTicketRequest) (*DeindexTicketResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeindexTicket not implemented") +} +func (UnimplementedFrontendServiceServer) mustEmbedUnimplementedFrontendServiceServer() {} +func (UnimplementedFrontendServiceServer) testEmbeddedByValue() {} + +// UnsafeFrontendServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to FrontendServiceServer will +// result in compilation errors. +type UnsafeFrontendServiceServer interface { + mustEmbedUnimplementedFrontendServiceServer() +} + +func RegisterFrontendServiceServer(s grpc.ServiceRegistrar, srv FrontendServiceServer) { + // If the following call pancis, it indicates UnimplementedFrontendServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&FrontendService_ServiceDesc, srv) +} + +func _FrontendService_CreateTicket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateTicketRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FrontendServiceServer).CreateTicket(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: FrontendService_CreateTicket_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FrontendServiceServer).CreateTicket(ctx, req.(*CreateTicketRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FrontendService_DeleteTicket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteTicketRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FrontendServiceServer).DeleteTicket(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: FrontendService_DeleteTicket_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FrontendServiceServer).DeleteTicket(ctx, req.(*DeleteTicketRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FrontendService_GetTicket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetTicketRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FrontendServiceServer).GetTicket(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: FrontendService_GetTicket_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FrontendServiceServer).GetTicket(ctx, req.(*GetTicketRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FrontendService_WatchAssignments_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(WatchAssignmentsRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(FrontendServiceServer).WatchAssignments(m, &grpc.GenericServerStream[WatchAssignmentsRequest, WatchAssignmentsResponse]{ServerStream: stream}) +} + +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type FrontendService_WatchAssignmentsServer = grpc.ServerStreamingServer[WatchAssignmentsResponse] + +func _FrontendService_AcknowledgeBackfill_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AcknowledgeBackfillRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FrontendServiceServer).AcknowledgeBackfill(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: FrontendService_AcknowledgeBackfill_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FrontendServiceServer).AcknowledgeBackfill(ctx, req.(*AcknowledgeBackfillRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FrontendService_CreateBackfill_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateBackfillRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FrontendServiceServer).CreateBackfill(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: FrontendService_CreateBackfill_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FrontendServiceServer).CreateBackfill(ctx, req.(*CreateBackfillRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FrontendService_DeleteBackfill_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteBackfillRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FrontendServiceServer).DeleteBackfill(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: FrontendService_DeleteBackfill_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FrontendServiceServer).DeleteBackfill(ctx, req.(*DeleteBackfillRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FrontendService_GetBackfill_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetBackfillRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FrontendServiceServer).GetBackfill(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: FrontendService_GetBackfill_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FrontendServiceServer).GetBackfill(ctx, req.(*GetBackfillRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FrontendService_UpdateBackfill_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateBackfillRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FrontendServiceServer).UpdateBackfill(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: FrontendService_UpdateBackfill_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FrontendServiceServer).UpdateBackfill(ctx, req.(*UpdateBackfillRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FrontendService_DeindexTicket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeindexTicketRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FrontendServiceServer).DeindexTicket(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: FrontendService_DeindexTicket_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FrontendServiceServer).DeindexTicket(ctx, req.(*DeindexTicketRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// FrontendService_ServiceDesc is the grpc.ServiceDesc for FrontendService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var FrontendService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "openmatch.FrontendService", + HandlerType: (*FrontendServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateTicket", + Handler: _FrontendService_CreateTicket_Handler, + }, + { + MethodName: "DeleteTicket", + Handler: _FrontendService_DeleteTicket_Handler, + }, + { + MethodName: "GetTicket", + Handler: _FrontendService_GetTicket_Handler, + }, + { + MethodName: "AcknowledgeBackfill", + Handler: _FrontendService_AcknowledgeBackfill_Handler, + }, + { + MethodName: "CreateBackfill", + Handler: _FrontendService_CreateBackfill_Handler, + }, + { + MethodName: "DeleteBackfill", + Handler: _FrontendService_DeleteBackfill_Handler, + }, + { + MethodName: "GetBackfill", + Handler: _FrontendService_GetBackfill_Handler, + }, + { + MethodName: "UpdateBackfill", + Handler: _FrontendService_UpdateBackfill_Handler, + }, + { + MethodName: "DeindexTicket", + Handler: _FrontendService_DeindexTicket_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "WatchAssignments", + Handler: _FrontendService_WatchAssignments_Handler, + ServerStreams: true, + }, + }, + Metadata: "openmatch/frontend.proto", +} diff --git a/gen/openmatch/openmatchconnect/frontend.connect.go b/gen/openmatch/openmatchconnect/frontend.connect.go index f207a19..9229123 100644 --- a/gen/openmatch/openmatchconnect/frontend.connect.go +++ b/gen/openmatch/openmatchconnect/frontend.connect.go @@ -92,7 +92,7 @@ type FrontendServiceClient interface { DeleteBackfill(context.Context, *connect.Request[openmatch.DeleteBackfillRequest]) (*connect.Response[emptypb.Empty], error) GetBackfill(context.Context, *connect.Request[openmatch.GetBackfillRequest]) (*connect.Response[openmatch.Backfill], error) UpdateBackfill(context.Context, *connect.Request[openmatch.UpdateBackfillRequest]) (*connect.Response[openmatch.Backfill], error) - // DeindexTickets removes the ticket from the matching candidates; + // DeindexTickets removes the ticket from the matching candidates. // unlike DeleteTicket, it does not delete the ticket body; // you can still get the Assignment with GetTicket after Deindex. DeindexTicket(context.Context, *connect.Request[openmatch.DeindexTicketRequest]) (*connect.Response[openmatch.DeindexTicketResponse], error) @@ -246,7 +246,7 @@ type FrontendServiceHandler interface { DeleteBackfill(context.Context, *connect.Request[openmatch.DeleteBackfillRequest]) (*connect.Response[emptypb.Empty], error) GetBackfill(context.Context, *connect.Request[openmatch.GetBackfillRequest]) (*connect.Response[openmatch.Backfill], error) UpdateBackfill(context.Context, *connect.Request[openmatch.UpdateBackfillRequest]) (*connect.Response[openmatch.Backfill], error) - // DeindexTickets removes the ticket from the matching candidates; + // DeindexTickets removes the ticket from the matching candidates. // unlike DeleteTicket, it does not delete the ticket body; // you can still get the Assignment with GetTicket after Deindex. DeindexTicket(context.Context, *connect.Request[openmatch.DeindexTicketRequest]) (*connect.Response[openmatch.DeindexTicketResponse], error) diff --git a/go.mod b/go.mod index c812d24..bcbe47c 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,8 @@ module github.com/castaneai/minimatch -go 1.22 +go 1.22.7 + +toolchain go1.22.9 require ( connectrpc.com/connect v1.17.0 @@ -14,8 +16,9 @@ require ( github.com/stretchr/testify v1.9.0 go.opentelemetry.io/otel v1.24.0 go.opentelemetry.io/otel/metric v1.24.0 - golang.org/x/net v0.23.0 - golang.org/x/sync v0.6.0 + golang.org/x/net v0.29.0 + golang.org/x/sync v0.8.0 + google.golang.org/grpc v1.68.0 google.golang.org/protobuf v1.34.2 ) @@ -30,8 +33,9 @@ require ( github.com/yuin/gopher-lua v1.1.1 // indirect go.opentelemetry.io/otel/trace v1.24.0 // indirect golang.org/x/exp v0.0.0-20220328175248-053ad81199eb // indirect - golang.org/x/sys v0.18.0 // indirect - golang.org/x/text v0.14.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 3a246b8..a934dd1 100644 --- a/go.sum +++ b/go.sum @@ -20,6 +20,8 @@ github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= @@ -57,15 +59,19 @@ go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= golang.org/x/exp v0.0.0-20220328175248-053ad81199eb h1:pC9Okm6BVmxEw76PUu0XUbOTQ92JX11hfvqTjAV3qxM= golang.org/x/exp v0.0.0-20220328175248-053ad81199eb/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE= -golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= -golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.68.0 h1:aHQeeJbo8zAkAa3pRzrVjZlbz6uSfeOXlJNQM0RAbz0= +google.golang.org/grpc v1.68.0/go.mod h1:fmSPC5AsjSBCK54MyHRx48kpOti1/jRfOlwEWywNjWA= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/loadtest/cmd/frontend/main.go b/loadtest/cmd/frontend/main.go index 41d2f70..e93d6f6 100644 --- a/loadtest/cmd/frontend/main.go +++ b/loadtest/cmd/frontend/main.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "log" + "net" "net/http" "os" "os/signal" @@ -19,6 +20,7 @@ import ( "github.com/redis/rueidis" "github.com/redis/rueidis/rueidislock" "github.com/redis/rueidis/rueidisotel" + "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/exporters/prometheus" @@ -26,6 +28,8 @@ import ( "golang.org/x/net/http2" "golang.org/x/net/http2/h2c" "golang.org/x/sync/errgroup" + "google.golang.org/grpc" + "google.golang.org/grpc/keepalive" "github.com/castaneai/minimatch" pb "github.com/castaneai/minimatch/gen/openmatch" @@ -44,6 +48,7 @@ type config struct { RedisAddrReadReplica string `envconfig:"REDIS_ADDR_READ_REPLICA"` Port string `envconfig:"PORT" default:"50504"` TicketCacheTTL time.Duration `envconfig:"TICKET_CACHE_TTL" default:"10s"` + UseGRPC bool `envconfig:"USE_GRPC" default:"false"` } func main() { @@ -60,6 +65,14 @@ func main() { store := statestore.NewFrontendStoreWithTicketCache(redisStore, ticketCache, statestore.WithTicketCacheTTL(conf.TicketCacheTTL)) + if conf.UseGRPC { + startFrontendWithGRPC(&conf, store) + } else { + startFrontendWithConnectRPC(&conf, store) + } +} + +func startFrontendWithConnectRPC(conf *config, store statestore.FrontendStore) { otelInterceptor, err := otelconnect.NewInterceptor(otelconnect.WithoutServerPeerAttributes()) if err != nil { log.Fatalf("failed to create otelconnect interceptor: %+v", err) @@ -77,7 +90,7 @@ func main() { defer cancel() eg := new(errgroup.Group) eg.Go(func() error { - log.Printf("frontend service is listening on %s...", addr) + log.Printf("frontend service (Connect RPC) is listening on %s...", addr) if err := server.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) { return err } @@ -96,6 +109,43 @@ func main() { } } +func startFrontendWithGRPC(conf *config, store statestore.FrontendStore) { + serverOpts := []grpc.ServerOption{ + grpc.KeepaliveParams(keepalive.ServerParameters{ + MaxConnectionIdle: 3 * time.Second, + Time: 1 * time.Second, + Timeout: 5 * time.Second, + }), + grpc.StatsHandler(otelgrpc.NewServerHandler()), + } + sv := grpc.NewServer(serverOpts...) + pb.RegisterFrontendServiceServer(sv, minimatch.NewFrontendGPRCService(store)) + + addr := fmt.Sprintf(":%s", conf.Port) + lis, err := net.Listen("tcp", addr) + if err != nil { + log.Fatalf("failed to listen gRPC server via %s: %+v", addr, err) + } + + // start frontend server + ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGTERM, os.Interrupt) + defer cancel() + eg := new(errgroup.Group) + eg.Go(func() error { + log.Printf("frontend service (gRPC) is listening on %s...", addr) + return sv.Serve(lis) + }) + + // wait for stop signal + <-ctx.Done() + log.Printf("shutting down frontend service...") + // shutdown gracefully + sv.GracefulStop() + if err := eg.Wait(); err != nil { + log.Fatalf("failed to serve gRPC server: %+v", err) + } +} + func newRedisStateStore(conf *config) (statestore.FrontendStore, error) { copt := rueidis.ClientOption{ InitAddress: []string{conf.RedisAddr}, diff --git a/loadtest/go.mod b/loadtest/go.mod index 70990ef..b7516ff 100644 --- a/loadtest/go.mod +++ b/loadtest/go.mod @@ -1,8 +1,8 @@ module github.com/castaneai/minimatch/loadtest -go 1.22 +go 1.22.7 -toolchain go1.22.0 +toolchain go1.22.9 replace github.com/castaneai/minimatch => ../ @@ -16,13 +16,14 @@ require ( github.com/prometheus/client_golang v1.17.0 github.com/redis/rueidis v1.0.31 github.com/redis/rueidis/rueidisotel v1.0.31 - go.opentelemetry.io/otel v1.31.0 + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.57.0 + go.opentelemetry.io/otel v1.32.0 go.opentelemetry.io/otel/exporters/prometheus v0.44.0 - go.opentelemetry.io/otel/metric v1.31.0 + go.opentelemetry.io/otel/metric v1.32.0 go.opentelemetry.io/otel/sdk/metric v1.31.0 golang.org/x/net v0.30.0 golang.org/x/sync v0.8.0 - google.golang.org/grpc v1.67.1 + google.golang.org/grpc v1.68.0 open-match.dev/open-match v1.8.1 ) @@ -33,7 +34,7 @@ require ( github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/google/uuid v1.6.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.2 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect @@ -44,11 +45,11 @@ require ( github.com/sethvargo/go-retry v0.2.4 // indirect github.com/yuin/gopher-lua v1.1.1 // indirect go.opentelemetry.io/otel/sdk v1.31.0 // indirect - go.opentelemetry.io/otel/trace v1.31.0 // indirect + go.opentelemetry.io/otel/trace v1.32.0 // indirect golang.org/x/exp v0.0.0-20220328175248-053ad81199eb // indirect golang.org/x/sys v0.26.0 // indirect golang.org/x/text v0.19.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect google.golang.org/protobuf v1.35.1 // indirect ) diff --git a/loadtest/go.sum b/loadtest/go.sum index 86c2060..cdca2b0 100644 --- a/loadtest/go.sum +++ b/loadtest/go.sum @@ -28,10 +28,8 @@ github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre github.com/golang/glog v1.2.2 h1:1+mZ9upx1Dh6FmUTFR1naJ77miKiXgALjWOZ3NVFPmY= github.com/golang/glog v1.2.2/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= @@ -66,18 +64,20 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M= github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw= -go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= -go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.57.0 h1:qtFISDHKolvIxzSs0gIaiPUPR0Cucb0F2coHC7ZLdps= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.57.0/go.mod h1:Y+Pop1Q6hCOnETWTW4NROK/q1hv50hM7yDaUTjG8lp8= +go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= +go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= go.opentelemetry.io/otel/exporters/prometheus v0.44.0 h1:08qeJgaPC0YEBu2PQMbqU3rogTlyzpjhCI2b58Yn00w= go.opentelemetry.io/otel/exporters/prometheus v0.44.0/go.mod h1:ERL2uIeBtg4TxZdojHUwzZfIFlUIjZtxubT5p4h1Gjg= -go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= -go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= +go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M= +go.opentelemetry.io/otel/metric v1.32.0/go.mod h1:jH7CIbbK6SH2V2wE16W05BHCtIDzauciCRLoc/SyMv8= go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk= go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0= go.opentelemetry.io/otel/sdk/metric v1.31.0 h1:i9hxxLJF/9kkvfHppyLL55aW7iIJz4JjxTeYusH7zMc= go.opentelemetry.io/otel/sdk/metric v1.31.0/go.mod h1:CRInTMVvNhUKgSAMbKyTMxqOBC0zgyxzW55lZzX43Y8= -go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= -go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= +go.opentelemetry.io/otel/trace v1.32.0 h1:WIC9mYrXf8TmY/EXuULKc8hR17vE+Hjv2cssQDe03fM= +go.opentelemetry.io/otel/trace v1.32.0/go.mod h1:+i4rkvCraA+tG6AzwloGaCtkx53Fa+L+V8e9a7YvhT8= golang.org/x/exp v0.0.0-20220328175248-053ad81199eb h1:pC9Okm6BVmxEw76PUu0XUbOTQ92JX11hfvqTjAV3qxM= golang.org/x/exp v0.0.0-20220328175248-053ad81199eb/go.mod h1:lgLbSvA5ygNOMpwM/9anMpWVlVJ7Z+cHWq/eFuinpGE= golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= @@ -90,15 +90,12 @@ golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 h1:wKguEg1hsxI2/L3hUYrpo1RVi48K+uTyzKqprwLXsb8= -google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 h1:QCqS/PdaHTSWGvupk2F/ehwHtGc0/GYkT+3GAcR1CCc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= -google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= -google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= -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/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1:hjSy6tcFQZ171igDaN5QHOw2n6vx40juYbC/x67CEhc= +google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 h1:XVhgTWWV3kGQlwJHR3upFWZeTsei6Oks1apkZSeonIE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= +google.golang.org/grpc v1.68.0 h1:aHQeeJbo8zAkAa3pRzrVjZlbz6uSfeOXlJNQM0RAbz0= +google.golang.org/grpc v1.68.0/go.mod h1:fmSPC5AsjSBCK54MyHRx48kpOti1/jRfOlwEWywNjWA= google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/loadtest/skaffold.yaml b/loadtest/skaffold.yaml index adb4a8c..d48a868 100644 --- a/loadtest/skaffold.yaml +++ b/loadtest/skaffold.yaml @@ -38,6 +38,8 @@ deploy: value: "10.23.1.11:6379" - name: REDIS_ADDR_READ_REPLICA value: "10.23.1.20:6379" + - name: USE_GRPC + value: "false" backend.deployment.replicas: 1 backend.deployment.env: - name: REDIS_ADDR