-
Notifications
You must be signed in to change notification settings - Fork 626
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
Default SQLite3 cursor is not instrumented #3082
Comments
This happens because the implementation of execute is in C: https://github.com/python/cpython/blob/c91ccbe4ac0ec15c503521f539b3528db85871b4/Modules/_sqlite/connection.c#L1803-L1824 |
I think it might be from DB-API integration's TracedCursorProxy wrapping It could be a non-trivial fix for the latter to be added directly to DB-API integration, or to a subclass in the sqlite3 instrumentor (latter possibly requiring more subclasses/overrides to work). But anyone is welcome to give it a try 🙂 I've created a small docs update PR to encourage use of explicit cursors ( I've also appended a "PRs" section to OP to prevent automated issue closing if multiple PRs. |
@xrmx Can you reopen this issue? Explaining why this is an issue doesn't solve the issue... |
That would be wrong anyway. This specific for |
Then one could try to subclass the connection proxy in the sqlite3 instrumentor as I had also suggested in |
Describe your environment
OS: (e.g, Ubuntu)
Python version: (e.g., Python 3.8.10)
Package version: (e.g., 0.46.0)
What happened?
The default
sqlite3.Cursor
is not instrumented.Steps to Reproduce
Expected Result
I would expect a span to be created for the table creation.
Actual Result
The span was not created.
Instead, if you do...
Additional context
The documentation should be updated... The code there doesn't run as is...
https://opentelemetry-python-contrib.readthedocs.io/en/latest/instrumentation/sqlite3/sqlite3.html
It should create the table first!
Would you like to implement a fix?
None
PRs
connection.execute
The text was updated successfully, but these errors were encountered: