ext/psycopg2: Implement BaseInstrumentor interface#694
ext/psycopg2: Implement BaseInstrumentor interface#694codeboten merged 2 commits intoopen-telemetry:masterfrom
Conversation
4fb5eb9 to
832f604
Compare
|
Hello @cnnradams What error do you get when you
Hey, @cnnradams, what is the error you mention above? |
basically, you can't seem to assign new properties to objects that were originally defined in C (same issue happens with sqlite3, does not happen with mysql since its connection was defined in python) |
| connection = connect_method(*args, **kwargs) | ||
| self.get_connection_attributes(connection) | ||
| return TracedConnectionProxy(connection, self) | ||
| return get_traced_connection_proxy(connection, self) |
There was a problem hiding this comment.
Any reason for these wrapper functions?
There was a problem hiding this comment.
yes - see my above comment. tl;dr: Can't assign new properties to the psycopg2 connection object
ext/opentelemetry-ext-grpc/src/opentelemetry/ext/grpc/grpcext/_interceptor.py
Outdated
Show resolved
Hide resolved
| trace_integration() | ||
| cnx = psycopg2.connect(database="test") | ||
| self.assertIsNotNone(cnx.cursor_factory) | ||
| class TestPostgresqlIntegration(TestBase): |
There was a problem hiding this comment.
Good job using the TestBase!
832f604 to
0d1d543
Compare
codeboten
left a comment
There was a problem hiding this comment.
LGTM! Thanks for the PR
Since the psycopg2 connection object can't have properties added to it (for example,
self._db_api_integration = db_api_integrationthrows an error), I instead closed these properties around the tracing wrappers.Resolves #633