-
Notifications
You must be signed in to change notification settings - Fork 33
Conversation
Hi @kagaya85 please update the license header :) |
Now, the if user use methods with context that contains span context, like type Tx struct {
*sql.Tx
db *DB
span go2sky.Span
ctx context.Context
}
func (tx *Tx) Exec(query string, args ...interface{}) (sql.Result, error) {
return tx.ExecContext(tx.ctx, query, args)
}
func (tx *Tx) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) {
if id := go2sky.SpanID(ctx); id == go2sky.EmptySpanID {
// if ctx do not contain parent span, use transaction ctx instead
ctx = tx.ctx
}
span, err := createSpan(ctx, tx.db.tracer, tx.db.opts, "execute")
if err != nil {
return nil, err
}
defer span.End()
...
return res, err
} |
@arugal For the previous implementation, is it possible to keep it as a new plugin which based on |
Good idea, we can do this in a new PR, after the current PR is merged. |
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.
Add go2sky plugin for
database/sql
This PR is still WIP and may need sufficient tests before merge
Because this is a new plugin, we may need to discuss some implementation details
Any comments or suggestions are welcome, thanks in advance