@@ -106,7 +106,7 @@ type ocConn struct {
106106func (c ocConn ) Ping (ctx context.Context ) (err error ) {
107107 if c .options .Ping && (c .options .AllowRoot || trace .FromContext (ctx ) != nil ) {
108108 var span * trace.Span
109- ctx , span = trace .StartSpan (ctx , "sql:ping" )
109+ ctx , span = trace .StartSpan (ctx , "sql:ping" , trace . WithSpanKind ( trace . SpanKindClient ) )
110110 if len (c .options .DefaultAttributes ) > 0 {
111111 span .AddAttributes (c .options .DefaultAttributes ... )
112112 }
@@ -135,7 +135,7 @@ func (c ocConn) Exec(query string, args []driver.Value) (res driver.Result, err
135135 return exec .Exec (query , args )
136136 }
137137
138- ctx , span := trace .StartSpan (context .Background (), "sql:exec" )
138+ ctx , span := trace .StartSpan (context .Background (), "sql:exec" , trace . WithSpanKind ( trace . SpanKindClient ) )
139139 attrs := make ([]trace.Attribute , 0 , len (c .options .DefaultAttributes )+ 2 )
140140 attrs = append (attrs , c .options .DefaultAttributes ... )
141141 attrs = append (
@@ -177,9 +177,9 @@ func (c ocConn) ExecContext(ctx context.Context, query string, args []driver.Nam
177177
178178 var span * trace.Span
179179 if parentSpan == nil {
180- ctx , span = trace .StartSpan (ctx , "sql:exec" )
180+ ctx , span = trace .StartSpan (ctx , "sql:exec" , trace . WithSpanKind ( trace . SpanKindClient ) )
181181 } else {
182- _ , span = trace .StartSpan (ctx , "sql:exec" )
182+ _ , span = trace .StartSpan (ctx , "sql:exec" , trace . WithSpanKind ( trace . SpanKindClient ) )
183183 }
184184 attrs := append ([]trace.Attribute (nil ), c .options .DefaultAttributes ... )
185185 if c .options .Query {
@@ -211,7 +211,7 @@ func (c ocConn) Query(query string, args []driver.Value) (rows driver.Rows, err
211211 return queryer .Query (query , args )
212212 }
213213
214- ctx , span := trace .StartSpan (context .Background (), "sql:query" )
214+ ctx , span := trace .StartSpan (context .Background (), "sql:query" , trace . WithSpanKind ( trace . SpanKindClient ) )
215215 attrs := make ([]trace.Attribute , 0 , len (c .options .DefaultAttributes )+ 2 )
216216 attrs = append (attrs , c .options .DefaultAttributes ... )
217217 attrs = append (
@@ -254,9 +254,9 @@ func (c ocConn) QueryContext(ctx context.Context, query string, args []driver.Na
254254
255255 var span * trace.Span
256256 if parentSpan == nil {
257- ctx , span = trace .StartSpan (ctx , "sql:query" )
257+ ctx , span = trace .StartSpan (ctx , "sql:query" , trace . WithSpanKind ( trace . SpanKindClient ) )
258258 } else {
259- _ , span = trace .StartSpan (ctx , "sql:query" )
259+ _ , span = trace .StartSpan (ctx , "sql:query" , trace . WithSpanKind ( trace . SpanKindClient ) )
260260 }
261261 attrs := append ([]trace.Attribute (nil ), c .options .DefaultAttributes ... )
262262 if c .options .Query {
@@ -285,7 +285,7 @@ func (c ocConn) QueryContext(ctx context.Context, query string, args []driver.Na
285285
286286func (c ocConn ) Prepare (query string ) (stmt driver.Stmt , err error ) {
287287 if c .options .AllowRoot {
288- _ , span := trace .StartSpan (context .Background (), "sql:prepare" )
288+ _ , span := trace .StartSpan (context .Background (), "sql:prepare" , trace . WithSpanKind ( trace . SpanKindClient ) )
289289 attrs := make ([]trace.Attribute , 0 , len (c .options .DefaultAttributes )+ 1 )
290290 attrs = append (attrs , c .options .DefaultAttributes ... )
291291 attrs = append (attrs , attrMissingContext )
@@ -321,7 +321,7 @@ func (c *ocConn) PrepareContext(ctx context.Context, query string) (stmt driver.
321321 var span * trace.Span
322322 attrs := append ([]trace.Attribute (nil ), c .options .DefaultAttributes ... )
323323 if c .options .AllowRoot || trace .FromContext (ctx ) != nil {
324- ctx , span = trace .StartSpan (ctx , "sql:prepare" )
324+ ctx , span = trace .StartSpan (ctx , "sql:prepare" , trace . WithSpanKind ( trace . SpanKindClient ) )
325325 if c .options .Query {
326326 attrs = append (attrs , trace .StringAttribute ("sql.query" , query ))
327327 }
@@ -365,10 +365,10 @@ func (c *ocConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx,
365365 }()
366366 if ctx == nil || ctx == context .TODO () {
367367 ctx = context .Background ()
368- _ , span = trace .StartSpan (ctx , "sql:begin_transaction" )
368+ _ , span = trace .StartSpan (ctx , "sql:begin_transaction" , trace . WithSpanKind ( trace . SpanKindClient ) )
369369 attrs = append (attrs , attrMissingContext )
370370 } else {
371- _ , span = trace .StartSpan (ctx , "sql:begin_transaction" )
371+ _ , span = trace .StartSpan (ctx , "sql:begin_transaction" , trace . WithSpanKind ( trace . SpanKindClient ) )
372372 }
373373 defer span .End ()
374374
@@ -405,7 +405,7 @@ type ocResult struct {
405405
406406func (r ocResult ) LastInsertId () (id int64 , err error ) {
407407 if r .options .LastInsertID {
408- _ , span := trace .StartSpan (r .ctx , "sql:last_insert_id" )
408+ _ , span := trace .StartSpan (r .ctx , "sql:last_insert_id" , trace . WithSpanKind ( trace . SpanKindClient ) )
409409 if len (r .options .DefaultAttributes ) > 0 {
410410 span .AddAttributes (r .options .DefaultAttributes ... )
411411 }
@@ -421,7 +421,7 @@ func (r ocResult) LastInsertId() (id int64, err error) {
421421
422422func (r ocResult ) RowsAffected () (cnt int64 , err error ) {
423423 if r .options .RowsAffected {
424- _ , span := trace .StartSpan (r .ctx , "sql:rows_affected" )
424+ _ , span := trace .StartSpan (r .ctx , "sql:rows_affected" , trace . WithSpanKind ( trace . SpanKindClient ) )
425425 if len (r .options .DefaultAttributes ) > 0 {
426426 span .AddAttributes (r .options .DefaultAttributes ... )
427427 }
@@ -447,7 +447,7 @@ func (s ocStmt) Exec(args []driver.Value) (res driver.Result, err error) {
447447 return s .parent .Exec (args )
448448 }
449449
450- ctx , span := trace .StartSpan (context .Background (), "sql:exec" )
450+ ctx , span := trace .StartSpan (context .Background (), "sql:exec" , trace . WithSpanKind ( trace . SpanKindClient ) )
451451 attrs := make ([]trace.Attribute , 0 , len (s .options .DefaultAttributes )+ 2 )
452452 attrs = append (attrs , s .options .DefaultAttributes ... )
453453 attrs = append (
@@ -492,7 +492,7 @@ func (s ocStmt) Query(args []driver.Value) (rows driver.Rows, err error) {
492492 return s .parent .Query (args )
493493 }
494494
495- ctx , span := trace .StartSpan (context .Background (), "sql:query" )
495+ ctx , span := trace .StartSpan (context .Background (), "sql:query" , trace . WithSpanKind ( trace . SpanKindClient ) )
496496 attrs := make ([]trace.Attribute , 0 , len (s .options .DefaultAttributes )+ 2 )
497497 attrs = append (attrs , s .options .DefaultAttributes ... )
498498 attrs = append (
@@ -532,9 +532,9 @@ func (s ocStmt) ExecContext(ctx context.Context, args []driver.NamedValue) (res
532532
533533 var span * trace.Span
534534 if parentSpan == nil {
535- ctx , span = trace .StartSpan (ctx , "sql:exec" )
535+ ctx , span = trace .StartSpan (ctx , "sql:exec" , trace . WithSpanKind ( trace . SpanKindClient ) )
536536 } else {
537- _ , span = trace .StartSpan (ctx , "sql:exec" )
537+ _ , span = trace .StartSpan (ctx , "sql:exec" , trace . WithSpanKind ( trace . SpanKindClient ) )
538538 }
539539 attrs := append ([]trace.Attribute (nil ), s .options .DefaultAttributes ... )
540540 if s .options .Query {
@@ -569,9 +569,9 @@ func (s ocStmt) QueryContext(ctx context.Context, args []driver.NamedValue) (row
569569
570570 var span * trace.Span
571571 if parentSpan == nil {
572- ctx , span = trace .StartSpan (ctx , "sql:query" )
572+ ctx , span = trace .StartSpan (ctx , "sql:query" , trace . WithSpanKind ( trace . SpanKindClient ) )
573573 } else {
574- _ , span = trace .StartSpan (ctx , "sql:query" )
574+ _ , span = trace .StartSpan (ctx , "sql:query" , trace . WithSpanKind ( trace . SpanKindClient ) )
575575 }
576576 attrs := append ([]trace.Attribute (nil ), s .options .DefaultAttributes ... )
577577 if s .options .Query {
@@ -610,7 +610,7 @@ func (r ocRows) Columns() []string {
610610
611611func (r ocRows ) Close () (err error ) {
612612 if r .options .RowsClose {
613- _ , span := trace .StartSpan (r .ctx , "sql:rows_close" )
613+ _ , span := trace .StartSpan (r .ctx , "sql:rows_close" , trace . WithSpanKind ( trace . SpanKindClient ) )
614614 if len (r .options .DefaultAttributes ) > 0 {
615615 span .AddAttributes (r .options .DefaultAttributes ... )
616616 }
@@ -626,7 +626,7 @@ func (r ocRows) Close() (err error) {
626626
627627func (r ocRows ) Next (dest []driver.Value ) (err error ) {
628628 if r .options .RowsNext {
629- _ , span := trace .StartSpan (r .ctx , "sql:rows_next" )
629+ _ , span := trace .StartSpan (r .ctx , "sql:rows_next" , trace . WithSpanKind ( trace . SpanKindClient ) )
630630 if len (r .options .DefaultAttributes ) > 0 {
631631 span .AddAttributes (r .options .DefaultAttributes ... )
632632 }
@@ -653,7 +653,7 @@ type ocTx struct {
653653}
654654
655655func (t ocTx ) Commit () (err error ) {
656- _ , span := trace .StartSpan (t .ctx , "sql:commit" )
656+ _ , span := trace .StartSpan (t .ctx , "sql:commit" , trace . WithSpanKind ( trace . SpanKindClient ) )
657657 if len (t .options .DefaultAttributes ) > 0 {
658658 span .AddAttributes (t .options .DefaultAttributes ... )
659659 }
@@ -667,7 +667,7 @@ func (t ocTx) Commit() (err error) {
667667}
668668
669669func (t ocTx ) Rollback () (err error ) {
670- _ , span := trace .StartSpan (t .ctx , "sql:rollback" )
670+ _ , span := trace .StartSpan (t .ctx , "sql:rollback" , trace . WithSpanKind ( trace . SpanKindClient ) )
671671 if len (t .options .DefaultAttributes ) > 0 {
672672 span .AddAttributes (t .options .DefaultAttributes ... )
673673 }
0 commit comments