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

feat(logger): unwrap event from common models if asked to log #1778

Conversation

heitorlessa
Copy link
Contributor

@heitorlessa heitorlessa commented Dec 13, 2022

Issue number: #1773

Summary

Changes

Please provide a summary of what's being changed

Uses new extract_event_from_common_models so Logger can log incoming events that might be wrapped in common containers such as Event Source Data Classes, Pydantic/Parser BaseModels, and Dataclasses.

Previously, we'd only do so for Event Source Data Classes. The linked discussion led to a confusion due to both event_source and event_parser decorator mutating the event. This required decorators to be in the right order when using event_parser. This PR prevents this common mistake when authoring functions leading to an optimal cognitive load.

User experience

Please share what the user experience looks like before and after this change

Checklist

If your change doesn't seem to apply, please leave them unchecked.

Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@heitorlessa heitorlessa requested a review from a team as a code owner December 13, 2022 14:26
@heitorlessa heitorlessa requested review from leandrodamascena and removed request for a team December 13, 2022 14:26
@boring-cyborg boring-cyborg bot added the logger label Dec 13, 2022
@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Dec 13, 2022
@github-actions github-actions bot added the feature New feature or functionality label Dec 13, 2022
@heitorlessa heitorlessa removed the request for review from leandrodamascena December 13, 2022 14:28
@heitorlessa heitorlessa merged commit 25b347e into aws-powertools:develop Dec 13, 2022
@heitorlessa heitorlessa deleted the feat/logger-log-event-all-models branch December 13, 2022 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or functionality logger size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Documentation: How correctly log AWS Lambda event with lambda powertools when using @event_source
1 participant