github.com/instana/go-sensor@v1.62.2-0.20240520081010-4919868049e1/sql_queryer.go (about) 1 // (c) Copyright IBM Corp. 2023 2 3 package instana 4 5 import ( 6 "context" 7 "database/sql/driver" 8 9 otlog "github.com/opentracing/opentracing-go/log" 10 ) 11 12 // Queryer is deprecated since Go v1.8 13 14 type wQueryer struct { 15 driver.Queryer 16 connDetails DbConnDetails 17 sensor TracerLogger 18 } 19 20 func (conn *wQueryer) Query(query string, args []driver.Value) (driver.Rows, error) { 21 ctx := context.Background() 22 23 sp, dbKey := startSQLSpan(ctx, conn.connDetails, query, conn.sensor) 24 defer sp.Finish() 25 26 res, err := conn.Queryer.Query(query, args) 27 28 if err != nil && err != driver.ErrSkip { 29 sp.LogFields(otlog.Error(err)) 30 sp.SetTag(dbKey+".error", err.Error()) 31 } 32 33 return res, err 34 35 }