@@ -94,14 +94,22 @@ func do(
9494 return attempts , nil
9595}
9696
97- func (c * Client ) Do (ctx context.Context , op query.Operation , opts ... options.DoOption ) error {
97+ func (c * Client ) Do (ctx context.Context , op query.Operation , opts ... options.DoOption ) (err error ) {
98+ var (
99+ onDone = trace .QueryOnDo (c .config .Trace (), & ctx ,
100+ stack .FunctionID ("github.com/ydb-platform/ydb-go-sdk/3/internal/query.(*Client).Do" ),
101+ )
102+ attempts int
103+ )
104+ defer func () {
105+ onDone (attempts , err )
106+ }()
107+
98108 select {
99109 case <- c .done :
100110 return xerrors .WithStackTrace (errClosedClient )
101111 default :
102- onDone := trace .QueryOnDo (c .config .Trace (), & ctx , stack .FunctionID ("" ))
103- attempts , err := do (ctx , c .pool , op , c .config .Trace (), opts ... )
104- onDone (attempts , err )
112+ attempts , err = do (ctx , c .pool , op , c .config .Trace (), opts ... )
105113
106114 return err
107115 }
@@ -149,22 +157,31 @@ func doTx(
149157 return attempts , nil
150158}
151159
152- func (c * Client ) DoTx (ctx context.Context , op query.TxOperation , opts ... options.DoTxOption ) error {
160+ func (c * Client ) DoTx (ctx context.Context , op query.TxOperation , opts ... options.DoTxOption ) (err error ) {
161+ var (
162+ onDone = trace .QueryOnDoTx (c .config .Trace (), & ctx ,
163+ stack .FunctionID ("github.com/ydb-platform/ydb-go-sdk/3/internal/query.(*Client).DoTx" ),
164+ )
165+ attempts int
166+ )
167+ defer func () {
168+ onDone (attempts , err )
169+ }()
170+
153171 select {
154172 case <- c .done :
155173 return xerrors .WithStackTrace (errClosedClient )
156174 default :
157- onDone := trace .QueryOnDoTx (c .config .Trace (), & ctx , stack .FunctionID ("" ))
158- attempts , err := doTx (ctx , c .pool , op , c .config .Trace (), opts ... )
159- onDone (attempts , err )
175+ attempts , err = doTx (ctx , c .pool , op , c .config .Trace (), opts ... )
160176
161177 return err
162178 }
163179}
164180
165181func New (ctx context.Context , balancer balancer , cfg * config.Config ) * Client {
166182 onDone := trace .QueryOnNew (cfg .Trace (), & ctx ,
167- stack .FunctionID ("github.com/ydb-platform/ydb-go-sdk/3/internal/query.New" ))
183+ stack .FunctionID ("github.com/ydb-platform/ydb-go-sdk/3/internal/query.New" ),
184+ )
168185 defer onDone ()
169186
170187 client := & Client {
0 commit comments