-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tracing: use context aware database methods #1071
tracing: use context aware database methods #1071
Conversation
Signed-off-by: Amir Aslaminejad <[email protected]>
Signed-off-by: Amir Aslaminejad <[email protected]>
Signed-off-by: Amir Aslaminejad <[email protected]>
Signed-off-by: Amir Aslaminejad <[email protected]>
if err != nil { | ||
return sqlcon.HandleError(err) | ||
} | ||
|
||
if _, err := m.db.Exec( | ||
if _, err := tx.ExecContext( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a bug I believe. I fixed it since I was knee deep in the code at this point already.
m.db.Exec
is not going to be done in the TX created above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah definitely!
@@ -169,7 +171,7 @@ func (m *SQLManager) CreateForcedObfuscatedAuthenticationSession(ctx context.Con | |||
return sqlcon.HandleError(err) | |||
} | |||
|
|||
if _, err := m.db.NamedExec( | |||
if _, err := tx.NamedExec( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here 🐛
Perfect! |
This PR continues on our efforts of context propagation by using the associated context aware methods in the sqlx package.
This is necessary for when we wrap the db driver with the tracing API, we will start getting spans out of the box 😉.
Furthermore, using these methods comes with the added benefit that database drivers that support context cancellation will be able to quit early if there is no hope of completing a query/tx.
Review: @aeneasr