func newGRPCBinding(ctx context.Context, tracer opentracing.Tracer, svc server.AddService, tracingLogger log.Logger) grpcBinding { return grpcBinding{ sum: grpc.NewServer( ctx, kitot.TraceServer(tracer, "sum")(makeSumEndpoint(svc)), servergrpc.DecodeSumRequest, servergrpc.EncodeSumResponse, grpc.ServerBefore(kitot.FromGRPCRequest(tracer, "", tracingLogger)), ), concat: grpc.NewServer( ctx, kitot.TraceServer(tracer, "concat")(makeConcatEndpoint(svc)), servergrpc.DecodeConcatRequest, servergrpc.EncodeConcatResponse, grpc.ServerBefore(kitot.FromGRPCRequest(tracer, "", tracingLogger)), ), } }
// MakeGRPCServer makes a set of endpoints available as a gRPC AddServer. func MakeGRPCServer(ctx context.Context, endpoints Endpoints, tracer stdopentracing.Tracer, logger log.Logger) pb.AddServer { options := []grpctransport.ServerOption{ grpctransport.ServerErrorLogger(logger), } return &grpcServer{ sum: grpctransport.NewServer( ctx, endpoints.SumEndpoint, DecodeGRPCSumRequest, EncodeGRPCSumResponse, append(options, grpctransport.ServerBefore(opentracing.FromGRPCRequest(tracer, "Sum", logger)))..., ), concat: grpctransport.NewServer( ctx, endpoints.ConcatEndpoint, DecodeGRPCConcatRequest, EncodeGRPCConcatResponse, append(options, grpctransport.ServerBefore(opentracing.FromGRPCRequest(tracer, "Concat", logger)))..., ), } }
func newGRPCBinding(ctx context.Context, svc server.AddService) grpcBinding { return grpcBinding{ sum: grpc.NewServer(ctx, makeSumEndpoint(svc), servergrpc.DecodeSumRequest, servergrpc.EncodeSumResponse), concat: grpc.NewServer(ctx, makeConcatEndpoint(svc), servergrpc.DecodeConcatRequest, servergrpc.EncodeConcatResponse), } }