update for latest micro and requestid changes

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2024-04-11 01:55:55 +03:00
parent df45b9e0bb
commit 87785d978a
4 changed files with 30 additions and 18 deletions

View File

@@ -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()