Skip to content

Commit c6ee1db

Browse files
committed
Do not call AddAttributes when there are no attributes
1 parent e7675b6 commit c6ee1db

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

driver.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,11 @@ func (c *ocConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx,
347347

348348
var span *trace.Span
349349
attrs := append([]trace.Attribute(nil), c.options.DefaultAttributes...)
350-
defer span.AddAttributes(attrs...)
350+
defer func() {
351+
if len(attrs) > 0 {
352+
span.AddAttributes(attrs...)
353+
}
354+
}()
351355
if ctx == nil || ctx == context.TODO() {
352356
ctx = context.Background()
353357
_, span = trace.StartSpan(ctx, "sql:begin_transaction")

0 commit comments

Comments
 (0)