Skip to content

Commit a8706ff

Browse files
authored
Assure register_json gets original args (#205)
1 parent e4e0ca4 commit a8706ff

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

instana/instrumentation/psycopg2.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ def register_type_with_instana(wrapped, instance, args, kwargs):
2525

2626
return wrapped(*args_clone, **kwargs)
2727

28+
@wrapt.patch_function_wrapper('psycopg2._json', 'register_json')
29+
def register_json_with_instana(wrapped, instance, args, kwargs):
30+
if 'conn_or_curs' in kwargs:
31+
if hasattr(kwargs['conn_or_curs'], '__wrapped__'):
32+
kwargs['conn_or_curs'] = kwargs['conn_or_curs'].__wrapped__
33+
34+
return wrapped(*args, **kwargs)
35+
2836
logger.debug("Instrumenting psycopg2")
2937
except ImportError:
3038
pass

0 commit comments

Comments
 (0)