-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Provide Lambda context in event object #1044
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1044 +/- ##
==========================================
+ Coverage 95.47% 95.47% +<.01%
==========================================
Files 27 27
Lines 4488 4489 +1
Branches 563 563
==========================================
+ Hits 4285 4286 +1
Misses 131 131
Partials 72 72
Continue to review full report at Codecov.
|
Thanks for the pull request, taking a look now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, let's get one more person to review this.
@@ -1047,7 +1048,7 @@ def _extract_attributes(self, event_dict): | |||
|
|||
def __iter__(self): | |||
for record in self._event_dict['Records']: | |||
yield SQSRecord(record) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realize we have to do this because SQSRecord
subclasses BaseLambdaEvent
, but I wonder if we need this attribute on child events. You can always access it from the parent event.context
attribute.
I suppose there's not really any downsides to passing this through all the child events that are created. We'll also have to do this when we implement dynamodbstream/kinesis events, which have a similar pattern.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Fixes #856.
Adds a
context
attribute for theevent
argument of Cloudwatch, S3, SNS and SQS Lambda handlers, as suggested in the issue discussion. That can be used for logging or other purposes:By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.