update for latest micro and requestid changes
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
df45b9e0bb
commit
87785d978a
8
conn.go
8
conn.go
@ -103,7 +103,7 @@ func (w *wrapperConn) BeginTx(ctx context.Context, opts driver.TxOptions) (drive
|
||||
span.AddLabels("db.method", "BeginTx")
|
||||
name := getQueryName(ctx)
|
||||
span.AddLabels("db.statement", name)
|
||||
if id, ok := ctx.Value(requestid.XRequestIDKey).(string); ok {
|
||||
if id, ok := ctx.Value(requestid.XRequestIDKey{}).(string); ok {
|
||||
span.AddLabels("x-request-id", id)
|
||||
}
|
||||
labels := []string{labelMethod, "BeginTx", labelQuery, name}
|
||||
@ -181,7 +181,7 @@ func (w *wrapperConn) PrepareContext(ctx context.Context, query string) (driver.
|
||||
span.AddLabels("db.method", "PrepareContext")
|
||||
name := getQueryName(ctx)
|
||||
span.AddLabels("db.statement", name)
|
||||
if id, ok := ctx.Value(requestid.XRequestIDKey).(string); ok {
|
||||
if id, ok := ctx.Value(requestid.XRequestIDKey{}).(string); ok {
|
||||
span.AddLabels("x-request-id", id)
|
||||
}
|
||||
labels := []string{labelMethod, "PrepareContext", labelQuery, name}
|
||||
@ -260,7 +260,7 @@ func (w *wrapperConn) ExecContext(ctx context.Context, query string, args []driv
|
||||
span.AddLabels("db.method", "ExecContext")
|
||||
name := getQueryName(ctx)
|
||||
span.AddLabels("db.statement", name)
|
||||
if id, ok := ctx.Value(requestid.XRequestIDKey).(string); ok {
|
||||
if id, ok := ctx.Value(requestid.XRequestIDKey{}).(string); ok {
|
||||
span.AddLabels("x-request-id", id)
|
||||
}
|
||||
defer span.Finish()
|
||||
@ -382,7 +382,7 @@ func (w *wrapperConn) QueryContext(ctx context.Context, query string, args []dri
|
||||
span.AddLabels("db.method", "QueryContext")
|
||||
name := getQueryName(ctx)
|
||||
span.AddLabels("db.statement", name)
|
||||
if id, ok := ctx.Value(requestid.XRequestIDKey).(string); ok {
|
||||
if id, ok := ctx.Value(requestid.XRequestIDKey{}).(string); ok {
|
||||
span.AddLabels("x-request-id", id)
|
||||
}
|
||||
defer span.Finish()
|
||||
|
11
go.mod
11
go.mod
@ -3,6 +3,13 @@ module go.unistack.org/micro-wrapper-sql/v3
|
||||
go 1.20
|
||||
|
||||
require (
|
||||
go.unistack.org/micro-wrapper-requestid/v3 v3.8.7
|
||||
go.unistack.org/micro/v3 v3.10.25
|
||||
go.unistack.org/micro-wrapper-requestid/v3 v3.8.10
|
||||
go.unistack.org/micro/v3 v3.10.57
|
||||
)
|
||||
|
||||
require (
|
||||
golang.org/x/sys v0.19.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect
|
||||
google.golang.org/grpc v1.63.2 // indirect
|
||||
google.golang.org/protobuf v1.33.0 // indirect
|
||||
)
|
||||
|
25
go.sum
25
go.sum
@ -1,10 +1,15 @@
|
||||
github.com/imdario/mergo v0.3.14/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
|
||||
github.com/silas/dag v0.0.0-20211117232152-9d50aa809f35/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I=
|
||||
go.unistack.org/micro-wrapper-requestid/v3 v3.8.7 h1:gXyiO7gPT0wNE7XEJIrwS2Y4cqylbeBMmlNYGwIS3io=
|
||||
go.unistack.org/micro-wrapper-requestid/v3 v3.8.7/go.mod h1:W92jAyoOoTFgGXgYu26BZi+R+IwJVH5N+BPnnp0NuiY=
|
||||
go.unistack.org/micro/v3 v3.10.19/go.mod h1:XIArw29f0b3uvF4cq96X/nQt2f0J2OGnjh8J+DBbC0s=
|
||||
go.unistack.org/micro/v3 v3.10.25 h1:A0epdZHOqjnXx103wwFhPKgmvVVbScvfbmn3HmHz1wE=
|
||||
go.unistack.org/micro/v3 v3.10.25/go.mod h1:ALkeXpqChYDjx8KPi7tz9mmIyOnob6nlNswsg8BnZjQ=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
go.unistack.org/micro-wrapper-requestid/v3 v3.8.10 h1:9QZy6w1HU2RCppZ1t8wJsDg1pk9RbvzUFYurq3Ai29Y=
|
||||
go.unistack.org/micro-wrapper-requestid/v3 v3.8.10/go.mod h1:3tY5+DwQM7l07chnpu/Wzwnne/ZV75VsUwXR54/WYzo=
|
||||
go.unistack.org/micro/v3 v3.10.57 h1:VxG7Cs7kBOgxgQlP+K8TvTxIgh2pmqAwmAaKdTAQNtQ=
|
||||
go.unistack.org/micro/v3 v3.10.57/go.mod h1:erMgt3Bl7vQQ0e9UpQyR5NlLiZ9pKeEJ9+1tfYFaqUg=
|
||||
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
|
||||
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
|
||||
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda h1:LI5DOvAxUPMv/50agcLLoo+AdWc1irS9Rzz4vPuD1V4=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY=
|
||||
google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM=
|
||||
google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA=
|
||||
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
|
||||
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
|
4
stmt.go
4
stmt.go
@ -148,7 +148,7 @@ func (w *wrapperStmt) ExecContext(ctx context.Context, args []driver.NamedValue)
|
||||
if len(args) > 0 {
|
||||
span.AddLabels("db.args", fmt.Sprintf("%v", namedValueToLabels(args)))
|
||||
}
|
||||
if id, ok := ctx.Value(requestid.XRequestIDKey).(string); ok {
|
||||
if id, ok := ctx.Value(requestid.XRequestIDKey{}).(string); ok {
|
||||
span.AddLabels("x-request-id", id)
|
||||
}
|
||||
labels := []string{labelMethod, "ExecContext", labelQuery, name}
|
||||
@ -221,7 +221,7 @@ func (w *wrapperStmt) QueryContext(ctx context.Context, args []driver.NamedValue
|
||||
if len(args) > 0 {
|
||||
span.AddLabels("db.args", fmt.Sprintf("%v", namedValueToLabels(args)))
|
||||
}
|
||||
if id, ok := ctx.Value(requestid.XRequestIDKey).(string); ok {
|
||||
if id, ok := ctx.Value(requestid.XRequestIDKey{}).(string); ok {
|
||||
span.AddLabels("x-request-id", id)
|
||||
}
|
||||
labels := []string{labelMethod, "QueryContext", labelQuery, name}
|
||||
|
Loading…
x
Reference in New Issue
Block a user