@@ -53,7 +53,6 @@ func (c *conn) Address() string {
5353type conn struct {
5454 mtx sync.RWMutex
5555 config Config // ro access
56- grpcDialOptions []grpc.DialOption
5756 cc * grpc.ClientConn
5857 done chan struct {}
5958 endpoint endpoint.Endpoint // ro access
@@ -200,7 +199,11 @@ func (c *conn) take(ctx context.Context) (cc *grpc.ClientConn, err error) {
200199 // three slashes in "ydb:///" is ok. It needs for good parse scheme in grpc resolver.
201200 address := "ydb:///" + c .endpoint .Address ()
202201
203- cc , err = grpc .DialContext (ctx , address , c .grpcDialOptions ... )
202+ cc , err = grpc .DialContext (ctx , address , append (
203+ []grpc.DialOption {
204+ grpc .WithStatsHandler (statsHandler {}),
205+ }, c .config .GrpcDialOptions ()... ,
206+ )... )
204207 if err != nil {
205208 err = xerrors .WithStackTrace (
206209 xerrors .Retryable (
@@ -461,20 +464,11 @@ func withOnTransportError(onTransportError func(ctx context.Context, cc Conn, ca
461464}
462465
463466func newConn (e endpoint.Endpoint , config Config , opts ... option ) * conn {
464- grpcDialOptions := config .GrpcDialOptions ()
465- grpcDialOptions = append (
466- append (
467- make ([]grpc.DialOption , 0 , len (grpcDialOptions )+ 1 ),
468- statsHandlerOption ,
469- ),
470- grpcDialOptions ... ,
471- )
472467 c := & conn {
473- grpcDialOptions : grpcDialOptions ,
474- state : uint32 (Created ),
475- endpoint : e ,
476- config : config ,
477- done : make (chan struct {}),
468+ state : uint32 (Created ),
469+ endpoint : e ,
470+ config : config ,
471+ done : make (chan struct {}),
478472 }
479473 for _ , o := range opts {
480474 if o != nil {
@@ -493,8 +487,6 @@ var _ stats.Handler = statsHandler{}
493487
494488type statsHandler struct {}
495489
496- var statsHandlerOption = grpc .WithStatsHandler (statsHandler {})
497-
498490func (statsHandler ) TagRPC (ctx context.Context , _ * stats.RPCTagInfo ) context.Context {
499491 return ctx
500492}
0 commit comments