sonatype-lift[bot] commented on code in PR #211:
URL: https://github.com/apache/skywalking-python/pull/211#discussion_r889070656
##########
skywalking/plugins/sw_psycopg2.py:
##########
@@ -128,3 +128,53 @@ def connect(*args, **kwargs):
_connect = psycopg2.connect
psycopg2.connect = connect
+
+ try: # try to instrument register_type which will fail if it gets a
wrapped cursor or connection
+ from psycopg2._psycopg import register_type as _register_type
+
+ def register_type(c, conn_or_curs):
+ if isinstance(conn_or_curs, ProxyConnection):
+ conn_or_curs = conn_or_curs._self_conn
+ elif isinstance(conn_or_curs, ProxyCursor):
+ conn_or_curs = conn_or_curs._self_cur
+
+ return _register_type(c, conn_or_curs)
+
+ try:
+ import psycopg2._ipaddress
+
+ if psycopg2._ipaddress.register_type is _register_type:
+ psycopg2._ipaddress.register_type = register_type
+
+ except Exception:
Review Comment:
I've recorded this as ignored for this pull request. If you change your
mind, just comment `@sonatype-lift unignore`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]