Skip to content
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

To enable trace when transaction commit or rollback in jdbc #11517

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tkmsaaaam
Copy link

Contribute for #10381

To enable trace when transaction commit or rollback in jdbc.

like below
image

To enable trace when transaction commit or rollback in jdbc.
@tkmsaaaam tkmsaaaam requested a review from a team June 1, 2024 12:54
@github-actions github-actions bot added the test native This label can be applied to PRs to trigger them to run native tests label Jun 1, 2024
@laurit
Copy link
Contributor

laurit commented Jun 3, 2024

There are a few things to consider with this instrumentation. Firstly it only updates the jdbc library instrumentation, ideally we'd like to have the same features in the library instrumentation and the javaagent instrumentation. Secondly the implementation assumes that calling Connection.commit() executes sql COMMIT statement, which I suspect isn't always true. It is an internal detail of the driver that depends on the database, it might as well execute COMMIT TRANSACTION instead. https://stackoverflow.com/questions/5248649/jdbc-commit-what-happens-behind-the-scenes suggests that for sql server it is executing IF @@TRANCOUNT > 0 COMMIT TRAN (note that the linked stack overflow question is quite old). If we don't know what statement is really executed perhaps we shouldn't fill db.statement at all? @trask do you any suggestions for this? Does the spec provide guidelines for something like this?

@trask
Copy link
Member

trask commented Jun 6, 2024

hi @tkmsaaaam! can you put this behavior behind an experimental feature flag for now, and open an issue in https://github.com/open-telemetry/semantic-conventions about how to model commit and rollback in database semantic conventions?

@tkmsaaaam
Copy link
Author

hi @tkmsaaaam! can you put this behavior behind an experimental feature flag for now, and open an issue in https://github.com/open-telemetry/semantic-conventions about how to model commit and rollback in database semantic conventions?

Thank you for your review. I opened the issue. open-telemetry/semantic-conventions#1134

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test native This label can be applied to PRs to trigger them to run native tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants