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

Wrap incoming extension events in a struct #394

Merged
merged 1 commit into from
Jan 8, 2022

Conversation

calavera
Copy link
Contributor

@calavera calavera commented Jan 8, 2022

Signed-off-by: David Calavera david.calavera@gmail.com

Issue #, if available:

Fixes #392

Description of changes:

This new structure can be used to pass additional information to the extension in each invocation, like the extension id that the Runtime assigns to the extension when it's initialized.

I'm not super keen in cloning the id in every event, but if I start messing with lifetimes, the extension trait becomes much more complicated to implement. I think this is good enough to fix the current issue, and we can iterate on it if it really becomes a problem before making the crate more stable.

By submitting this pull request

  • I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • I confirm that I've made a best effort attempt to update all relevant documentation.

Sorry, something went wrong.

This new structure can be used to pass additional information to the extension in each invocation, like the extension id that the Runtime assigns to the extension when it's initialized.

Signed-off-by: David Calavera <david.calavera@gmail.com>
Copy link
Contributor

@bahildebrand bahildebrand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@bahildebrand bahildebrand merged commit d7b7aa7 into awslabs:master Jan 8, 2022
@tannerntannern
Copy link

@calavera Correct me if I'm wrong, but I'm not sure this actually resolves the linked issue. According to the Lambda Logs API docs (emphasis mine):

To subscribe to receive logs, you need the extension identifier (Lambda-Extension-Identifier). First register the extension to receive the extension identifier. Then subscribe to the Logs API during initialization. After the initialization phase completes, Lambda does not process subscription requests.

As I understand it, accessing the extension id during an invoke event and subscribing to the Logs API at that point would be too late (not sure if that was the intended path). Subscribing to the Logs API must happen between extension registration and the first call to /event/next, which still doesn't appear to be possible.

To clarify, I don't think this is a bad change. The Lambda Logs API also sends back the extension id in the response headers for the /event/next endpoint, so if anything these changes bring us more in line with the actual AWS APIs. I don't think we can say #392 is resolved however.

@calavera calavera mentioned this pull request Jan 8, 2022
@nmoutschen nmoutschen added the 0.5 label Feb 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lambda Logs API?
4 participants