@@ -94,16 +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 ,
103- stack .FunctionID ("" ),
104- )
105- attempts , err := do (ctx , c .pool , op , c .config .Trace (), opts ... )
106- onDone (attempts , err )
112+ attempts , err = do (ctx , c .pool , op , c .config .Trace (), opts ... )
107113
108114 return err
109115 }
@@ -151,16 +157,22 @@ func doTx(
151157 return attempts , nil
152158}
153159
154- 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+
155171 select {
156172 case <- c .done :
157173 return xerrors .WithStackTrace (errClosedClient )
158174 default :
159- onDone := trace .QueryOnDoTx (c .config .Trace (), & ctx ,
160- stack .FunctionID ("" ),
161- )
162- attempts , err := doTx (ctx , c .pool , op , c .config .Trace (), opts ... )
163- onDone (attempts , err )
175+ attempts , err = doTx (ctx , c .pool , op , c .config .Trace (), opts ... )
164176
165177 return err
166178 }
0 commit comments