dynatrace-oss / OneAgent-SDK-Python-AutoInstrumentation

autodynatrace, a python library that implements automatic instrumentation using the OneAgent SDK for Python
Other
62 stars 28 forks source link

App crashed while instrumenting/Tracing psycopg2 query #75

Open ConnectWise-Lalit opened 1 year ago

ConnectWise-Lalit commented 1 year ago

In Our App it is expected that DataError may occur for few cases which is acceptable for us and we skip those without breaking the functionality But we have observed that with this DataError Exception our app crashes in autodynatrace/wrappers/psycopg2/wrapper.py in execute how can we make sure autodynatrace skips such Errors and keep our functionality intact without breaking application flow

Attaching the stack trace of the error crashed while Tracing psycopg2 query

image

dlopes7 commented 1 year ago

The DataError exception is thrown by psycopg2, not by autodynatrace.

Is the exception NOT thrown when not using autodynatrace? How are you executing this bad query so I can try to reproduce?

Because from my point of view you just need to have a try/catch for these exceptions, with or without the instrumentation, please let me know what I am missing here.

If autodynatrace were to catch this exception and ignore it, how would you know that this query is a bad query?