-
Notifications
You must be signed in to change notification settings - Fork 14
feat(rust): add second example using non-op internal extension, expand README #19
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
base: main
Are you sure you want to change the base?
Conversation
A couple updates: I do have a PR out to tokio for If we merge this with the TODO still in place, I can circle back and cut it over once it lands. I also have |
Capturing some offline discussion with bnusunny@:
I'm fine to put this PR on hold in anticipation of such a feature, if preferred. Or, I can backport usage of that new API once it is available. Up to you. |
Graceful shutdown hook PR: awslabs/aws-lambda-rust-runtime#982 |
…ew lambda-runtime helper, expand README, clean up cargo imports
@bnusunny this PR has been updated:
I could see an argument for ditching the external extension example entirely, but it's kind of nice to have somewhere where we show the signal handling inline in Rust code. Since, it is tucked away via the helper. I think probably including both is still nice. I've tested both internal and external extensions end to end, including sam build + deploy, invoking API Gateway via curl, and validating that cloudwatch logs shows the graceful shutdown hook firing. |
Note that the README links to the So, this should not be merged before that release goes out. I'll explicitly validate that the link is working at that time and drop a note here as such. |
Issue #, if available:
Closes: #1
Description of changes:
The current Rust example uses an external extension, CloudWatch Lambda Insights. It works fine, but it adds overhead if you don't need the extension since it requires a standalone process running. It also adds billing costs / cold start / etc.
Adding an additional example that uses an internal extension instead. I updated the README to discuss the difference between both.
Related PR on the
aws-lambda-rust-runtime
side:Testing
Each example has its own SAM template. I tested each end to end including deploy, sending traffic, validating the graceful shutdown in logs, etc. The two examples can co-exist in the same account without issue.
Note that graceful shutdown is not currently testable locally via
cargo lambda watch
, ref:cargo-lambda/cargo-lambda#850
Internal extension logs:
External extension logs:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.