Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warning when lambda function may timeout #379

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

imjoehaines
Copy link
Contributor

Goal

Adds a notify for lambda functions when they are likely to timeout — by default this happens 1 second before the timeout occurs but can be configured with the new lambda_timeout_notify_ms option:

@bugsnag.aws_lambda_handler(lambda_timeout_notify_ms=2000)
def my_handler(event, context):
    pass

There's some complexity here because the notify happens off of the main thread so any thread-local data wouldn't be present in the event. In order to include all of the relevant information (e.g. metadata, breadcrumbs, feature flags) we need to manually copy it over into the timer thread

@imjoehaines imjoehaines force-pushed the lambda-timeout-warning branch from 4659366 to 387dd97 Compare April 5, 2024 12:42
@imjoehaines imjoehaines merged commit ea44bd4 into next Apr 8, 2024
20 checks passed
@imjoehaines imjoehaines deleted the lambda-timeout-warning branch April 8, 2024 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants