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

fix(logger): middleware stores initial persistent attributes correctly #1329

Merged
merged 2 commits into from
Feb 27, 2023

Conversation

dreamorosi
Copy link
Contributor

@dreamorosi dreamorosi commented Feb 25, 2023

Description of your changes

In #1328 it was reported that the Logger middleware injectLambdaContext was not clearing correctly the state and potentially leaking attributes set during an execution in the subsequent one.

Prior to this PR the middleware was improperly storing the initial persistent attributes of each logger instance passed to the middleware. This caused issues when clearing the state after each invocation, since the initial persistent attributes were now unusable.

This PR fixes the issue and adds new unit tests. Once merged this PR will close #1328.

Once merged, this PR closes #1328.

How to verify this change

See checks under the PR as well as integration test run here. New unit tests were added to demonstrate the fix & avoid future regressions.

Related issues, RFCs

Issue number: #1328

PR status

Is this ready for review?: YES
Is it a breaking change?: NO

Checklist

  • My changes meet the tenets criteria
  • I have performed a self-review of my own code
  • I have commented my code where necessary, particularly in areas that should be flagged with a TODO, or hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding changes to the examples
  • My changes generate no new warnings
  • The code coverage hasn't decreased
  • I have added tests that prove my change is effective and works
  • New and existing unit tests pass locally and in Github Actions
  • Any dependent changes have been merged and published
  • The PR title follows the conventional commit semantics

Breaking change checklist

  • I have documented the migration process
  • I have added, implemented necessary warnings (if it can live side by side)

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

@dreamorosi dreamorosi self-assigned this Feb 25, 2023
@pull-request-size pull-request-size bot added the size/L PRs between 100-499 LOC label Feb 25, 2023
@github-actions github-actions bot added the bug Something isn't working label Feb 25, 2023
@dreamorosi dreamorosi marked this pull request as ready for review February 26, 2023 01:06
Copy link
Contributor

@am29d am29d left a comment

Choose a reason for hiding this comment

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

🚢

@dreamorosi dreamorosi merged commit 6b32304 into main Feb 27, 2023
@dreamorosi dreamorosi deleted the fix/logger/clearState branch February 27, 2023 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working size/L PRs between 100-499 LOC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Log state not cleared before logging event in middleware
2 participants