Attach AWS serverless timeout warning logs to debug mode
Problem Statement
For the normal python sdk, we usually only output logging with debug=True, but with the AWSLambdaIntegration() the timeout warnings are logged regardless of whether debug is on or not.
We may want to keep it consistent and attach the serverless logs to debug mode as well.
Solution Brainstorm
Maybe either attach the logging to debug mode, or add an another option to the integration to output logs or not.
Hey @Fwang36 Thanks for reporting this!
One thing to consider: If people add the AWS Layer to their function (instrumenting their Lambda function without changing their code) they can not set the DEBUG=True flag, thus would never see the timeout warning.
Maybe we should add an env var to the layer instrumentation to enable/disable the debug flag in sentry.init().
As the users can set the timeout_warnings option I will close this issue.
@antonpirker - Behavior will be unchanged?
@antonpirker - I agree that a single line with the warning should get written to the log, but I'd think that unless the debug flag is set, that should be the only line written there.
Current Logged Messages without Debug flag set:
Exception in thread Thread-1: Traceback (most recent call last): File "/var/lang/lib/python3.9/threading.py", line 980, in _bootstrap_inner self.run() File "/opt/python/sentry_sdk/integrations/threading.py", line 100, in run return _run_old_run_func() File "/opt/python/sentry_sdk/integrations/threading.py", line 95, in _run_old_run_func reraise(*_capture_exception()) File "/opt/python/sentry_sdk/utils.py", line 1690, in reraise raise value File "/opt/python/sentry_sdk/integrations/threading.py", line 93, in _run_old_run_func return old_run_func(self, *a, **kw) File "/opt/python/sentry_sdk/utils.py", line 1449, in run raise ServerlessTimeoutWarning( sentry_sdk.utils.ServerlessTimeoutWarning: WARNING : Function is expected to get timed out. Configured timeout duration = 5 seconds.
Expected Logged Messages without Debug flag set:
sentry_sdk.utils.ServerlessTimeoutWarning: WARNING : Function is expected to get timed out. Configured timeout duration = 5 seconds.
Should I reopen this ticket or create a new one?