-
Notifications
You must be signed in to change notification settings - Fork 647
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
conn.commit() raise InterfaceError because connection instrument wrapper has no _sock member #1353
Comments
@ocelotl I'm having this same issue and it appears to be caused by #1097 This may also be the cause of #1213 Also, should this be changed?
|
PyMySQL specific # file: PyMySQL/pymysql/connections.py
class Connection:
# ...
# class attribute
_sock = None
# ...
def __init__(self):
# ...
# instance attribute
# self._sock assigned to new socket by self.connect()
# ... _sock is a class attribute, also an instance attribute, which is used by the method connection.commit and connection.close and others Before #1097 # file: opentelemetry-instrumentation-dbapi/src/opentelemetry/instrumentation/dbapi/__init__.py
class TracedConnectionProxy(wrapt.ObjectProxy):
def __init__(self, connection, *args, **kwargs):
wrapt.ObjectProxy.__init__(self, connection) accessing self._sock via wrapt.ObjectProxy to the underlying instance attribute connection._sock, which is good. After #1097 class TracedConnectionProxy(type(connection), _TracedConnectionProxy):
def __init__(self, connection):
self._connection = connection self._sock is the class attribute Connection._sock (by inheriting type(connection)), which is bad, because Connection._sock is None |
@srikanthccv Any thoughts here? |
Will look into this, thanks for reporting ✌️ |
@ocelotl Would be great if the fix could make it in to the next release. I (and I'm sure many others) am blocked from upgrading until this is fixed. |
Fixes open-telemetry#1353 Also: Fix the check for the connection already being instrumented in instrument_connection() Add tests for commit() and rollback() Add a couple missing docstring items. Add basepython to docker-tests to fix running the tests on macOS.
Fixes open-telemetry#1353 Also: Fix the check for the connection already being instrumented in instrument_connection() Add tests for commit() and rollback() Add a couple missing docstring items. Add basepython to docker-tests to fix running the tests on macOS.
Fixes open-telemetry#1353 Also: Fix the check for the connection already being instrumented in instrument_connection() Add tests for commit() and rollback() Add a couple missing docstring items. Add basepython to docker-tests to fix running the tests on macOS.
Fixes open-telemetry#1353 Also: Fix the check for the connection already being instrumented in instrument_connection() Add tests for commit() and rollback() Add a couple missing docstring items. Add basepython to docker-tests to fix running the tests on macOS.
Fixes open-telemetry#1353 Also: Fix the check for the connection already being instrumented in instrument_connection() Add tests for commit() and rollback() Add a couple missing docstring items. Add basepython to docker-tests to fix running the tests on macOS.
Fixes open-telemetry#1353 Also: Fix the check for the connection already being instrumented in instrument_connection() Add tests for commit() and rollback() Add a couple missing docstring items. Add basepython to docker-tests to fix running the tests on macOS.
Fixes open-telemetry#1353 Also: Fix the check for the connection already being instrumented in instrument_connection() Add tests for commit() and rollback() Add a couple missing docstring items. Add basepython to docker-tests to fix running the tests on macOS.
Fixes open-telemetry#1353 Also: Fix the check for the connection already being instrumented in instrument_connection() Add tests for commit() and rollback() Add a couple missing docstring items. Add basepython to docker-tests to fix running the tests on macOS.
Fixes #1353 Also: Fix the check for the connection already being instrumented in instrument_connection() Add tests for commit() and rollback() Add a couple missing docstring items. Add basepython to docker-tests to fix running the tests on macOS.
…emetry#1424) Fixes open-telemetry#1353 Also: Fix the check for the connection already being instrumented in instrument_connection() Add tests for commit() and rollback() Add a couple missing docstring items. Add basepython to docker-tests to fix running the tests on macOS.
…emetry#1424) Fixes open-telemetry#1353 Also: Fix the check for the connection already being instrumented in instrument_connection() Add tests for commit() and rollback() Add a couple missing docstring items. Add basepython to docker-tests to fix running the tests on macOS.
Describe your environment Describe any aspect of your environment relevant to the problem, including your Python version, platform, version numbers of installed dependencies, information about your cloud hosting provider, etc. If you're reporting a problem with a specific version of a library in this repo, please check whether the problem has been fixed on main.
instrumentation version: opentelemetry-instrumentation-pymysql 0.33b0
Steps to reproduce
When using
opentelemetry-instrument
command to automatically instrument pymysqlCurrent bandaid solution:
Tracing down the stack will show that on line 792 of the
pymysql/connections/.py
, the Exception will be thrown because self now refers to the wrapper instead of the internal connection object:If I do not instrument pymysql then this will not happen.
The text was updated successfully, but these errors were encountered: