-
Notifications
You must be signed in to change notification settings - Fork 33
fix(sql): handle commit/rollback error when tracing transcation #40
Conversation
How about add the error message to the span and close it even the |
I think we should consider separating the span, because as you mentioned in the codes, if there is connection leak(commit error, but no rollback called) or rollback fails, the span wouldn't be closed as expected, which is unexpected. The tracing system is designed to tell the truth, rather than not working as well as original codes. You could check the SkyWalking Java agent's JDBC plugin, commit and rollback have there own spans, then no panic and always presents the complete trace. |
e25b8a1
to
46eb55c
Compare
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.
LGTM, wait for @arugal
Please hold this PR, we consider using separate
|
You could calculate the whole time by using tag or log in the span, such as commit or rollback. Also, the backend provides the logic endpoint concept(logic name + duration in tags) for you to measure things like this.
You could make the choice whether in this PR or through another one. |
Now, sql plugin will close a span when commit/rollback returns error, it may call
span.End()
repeatly and cause a panic, we want return thedatabase/sql
errors to the upper instead of get a panic.Add defer function to handle the return error and will not call
span.End()
when error is not nilfix #38