-
Notifications
You must be signed in to change notification settings - Fork 402
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
Logger clear_state flip removing structure keys #1084
Comments
Thank you @alexanderluiscampino for filing a high quality bug reporting -- We'll look into this week and release a patch release once as soon as we can. Thank you |
Reproduced and found the regression was introduced in 1.25.3 when fixing a custom formatter. Tests were insufficient for clear_state=True hence we didn't catch it -- working on better tests and will make a release by EOD the latest. |
This is now released under 1.25.6 version! |
Thanks to your super high quality bug report we managed to reproduce and improved tests as part of the fix - the latest version 1.25.6 has this fix now. Lambda Layers upcoming version 16 will take a few hours to be available in multiple AWS commercial regions. |
@heitorlessa, I'm seeing some problems which I'm guess is connected to this as well. I've been trying to change the default location format by doing: Saw in the contribution guide that external contributions are de-prioritized for now, so will not create a PR. But something like the following could perhaps work? Switch the following from to self.keys_combined = {**self._build_default_keys(), **kwargs}
self.log_format.update(**self.keys_combined) and switch to def clear_state(self):
self.log_format = dict.fromkeys(self.log_record_order)
self.log_format.update(**self.keys_combined) |
Edit: wording as I reopened the issue. Will try to reproduce tomorrow morning before shift starts Hey @eliasbrange! For bugs we can reproduce, we welcome the PRs ;) This seemed like an easy fix for custom formatters at first, but it continues to cause edge cases that our tests were not covering clear_state well enough - my apologies. I'm with customers until Thursday evening, but if you could make a PR with tests, I'll gladly accept it (and enrich if necessary) Thank you 🙏 |
@heitorlessa PR is up and running! #1095 |
Just merged - I plan to have a patch release out today with this fix. |
Sweet, thanks for the quick review! |
This is now released under 1.25.7 version! |
Layers version 17 should be out in 2h max across all regions we support
…On Fri, 8 Apr 2022 at 18:47, github-actions[bot] ***@***.***> wrote:
Closed #1084
<#1084>.
—
Reply to this email directly, view it on GitHub
<#1084 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZPQBBDITGSN2HCL2LM55TVEBPLRANCNFSM5R7OMZXA>
.
You are receiving this because you were mentioned.Message ID:
<awslabs/aws-lambda-powertools-python/issue/1084/issue_event/6397900290@
github.com>
|
Using the
clear_state
argument in the logger decorator for lambda handlers is destroying the default structured keys.What were you trying to accomplish?
Just trying to get some lambda logs with custom keys, which ideally would be cleaned up after each warm call, such that those custom key values do not trickle to the next invocation.
Expected Behavior
Using the clear_state argument should not remove the default structured keys. Those should remain fixed. Only custom keys should be removed upon new invocation.
Current Behavior
Currently, default structured keys are being removed from the get-go.
Steps to Reproduce (for bugs)
First, this:
Output:
Now this
clear_state=True
Output:
Environment
The text was updated successfully, but these errors were encountered: