Skip to content

Commit

Permalink
Fix #74 - DB API exception when arguments are not string
Browse files Browse the repository at this point in the history
  • Loading branch information
dlopes7 committed Jun 22, 2023
1 parent a12a08a commit 7c90d89
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions autodynatrace/wrappers/dbapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class TracedCursor(wrapt.ObjectProxy):
def __init__(self, cursor, db_info):
super(TracedCursor, self).__init__(cursor)
self.db_info = db_info
self.db_info = f"{db_info}"
self._self_last_execute_operation = None
self._original_cursor = cursor

Expand All @@ -21,7 +21,12 @@ def _trace_method(self, method, query, *args, **kwargs):
except Exception:
pass
logger.debug("Tracing Database Call '{}' to {}".format(str(query), self.db_info))
with sdk.trace_sql_database_request(self.db_info, query):

try:
with sdk.trace_sql_database_request(self.db_info, f"{query}"):
return method(*args, **kwargs)
except Exception as e:
logger.warning(f"Error instrumenting database: {e}")
return method(*args, **kwargs)

def executemany(self, query, *args, **kwargs):
Expand Down

0 comments on commit 7c90d89

Please sign in to comment.