github.com/grahambrereton-form3/tilt@v0.10.18/internal/options/grpc.go (about) 1 package options 2 3 import ( 4 "github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc" 5 "github.com/opentracing/opentracing-go" 6 "google.golang.org/grpc" 7 ) 8 9 // 1024 MB 10 const MaxMsgSize int = 1024 * 1024 * 1024 11 12 func MaxMsgDial() []grpc.DialOption { 13 return []grpc.DialOption{ 14 grpc.WithDefaultCallOptions( 15 grpc.MaxCallSendMsgSize(MaxMsgSize), 16 grpc.MaxCallRecvMsgSize(MaxMsgSize), 17 ), 18 } 19 } 20 21 func TracingInterceptorsDial(t opentracing.Tracer) []grpc.DialOption { 22 return []grpc.DialOption{ 23 grpc.WithUnaryInterceptor(otgrpc.OpenTracingClientInterceptor(t)), 24 grpc.WithStreamInterceptor(otgrpc.OpenTracingStreamClientInterceptor(t)), 25 } 26 } 27 28 func MaxMsgServer() []grpc.ServerOption { 29 return []grpc.ServerOption{ 30 grpc.MaxRecvMsgSize(MaxMsgSize), 31 grpc.MaxSendMsgSize(MaxMsgSize), 32 } 33 } 34 35 func TracingInterceptorsServer(t opentracing.Tracer) []grpc.ServerOption { 36 return []grpc.ServerOption{ 37 grpc.UnaryInterceptor(otgrpc.OpenTracingServerInterceptor(t)), 38 grpc.StreamInterceptor(otgrpc.OpenTracingStreamServerInterceptor(t)), 39 } 40 }