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

Bump aws-lambda-powertools[parser] from 2.41.0 to 3.8.0 #347

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Mar 7, 2025

Bumps aws-lambda-powertools[parser] from 2.41.0 to 3.8.0.

Release notes

Sourced from aws-lambda-powertools[parser]'s releases.

v3.8.0

Summary

We are excited to announce a new feature in Logger: Logger buffering. This new feature allows you to buffer logs for a specific invocation, and flush them automatically on error or manually as needed.

A special thanks to Ollie Saul and James Saull from Dotelastic for their instrumental input on this new feature!

⭐ Also, huge thanks to our new contributors: @​tiagohconte and @​speshak.

New Log Buffering feature

Docs

You can now enable log buffering by passing buffer_config when initializing a new Logger instance. This feature allows you to:

  • Buffer logs at the WARNING, INFO, and DEBUG levels
  • Automatically flush logs on error or manually as needed
  • Reduce CloudWatch costs by decreasing the number of emitted log messages

buffer1

Configuration options

Option Description Default
max_bytes Maximum size of the buffer in bytes 20480
buffer_at_verbosity Minimum log level to buffer (more verbose levels are also buffered) DEBUG
flush_on_error_log Whether to flush buffer when an error is logged True

When log buffering is enabled, you can now pass a new opt-in flush_buffer_on_uncaught_error flag to the inject_lambda_context() decorator. When enabled, 1/ we'll intercept any raised exception, 2/ flush the buffer, and 3/ re-raise your original exception. This enables you to have detailed logs from your application when you need them the most.

buffer3

For detailed explanations with diagrams, please refer to our comprehensive documentation.

Buffering FAQs

Q: Does the buffer persist across Lambda invocations? A: No, each Lambda invocation has its own buffer. The buffer is initialized when the Lambda function is invoked and is cleared after the function execution completes or when flushed manually.

Q: Are my logs buffered during cold starts? A: No. We never buffer logs during cold starts to ensure all logs from this phase are immediately available for debugging.

Q: How can I prevent log buffering from consuming excessive memory? A: You can limit the size of the buffer by setting the max_bytes option in the LoggerBufferConfig constructor parameter. This will ensure that the buffer does not grow indefinitely and consume excessive memory.

Q: What happens if the log buffer reaches its maximum size? A: Older logs are removed from the buffer to make room for new logs. This means that if the buffer is full, you may lose some logs if they are not flushed before the buffer reaches its maximum size. When this happens, we emit a warning when flushing the buffer to indicate that some logs have been dropped.

... (truncated)

Changelog

Sourced from aws-lambda-powertools[parser]'s changelog.

[v3.8.0] - 2025-03-07

Bug Fixes

  • event_handler: revert regression when validating response (#6234)

Maintenance

  • version bump

[v3.7.0] - 2025-02-25

Bug Fixes

  • logger: correctly pick powertools or custom handler in custom environments (#6083)
  • openapi: validate response serialization when falsy (#6119)
  • parser: fix data types for sourceIPAddress and sequencer fields in S3RecordModel Model (#6154)
  • parser: fix EventBridgeModel when working with scheduled events (#6134)
  • security: fix encryption_context handling in data masking operations (#6074)

Documentation

  • roadmap: update roadmap (#6077)

Features

  • batch: raise exception for invalid batch event (#6088)
  • event_handler: add support for defining OpenAPI examples in parameters (#6086)
  • layers: add new comercial region ap-southeast-7 and mx-central-1 (#6109)
  • parser: Event source dataclasses for IoT Core Registry Events (#6123)
  • parser: Add IoT registry events models (#5892)

Maintenance

  • version bump
  • ci: new pre-release 3.6.1a9 (#6157)
  • ci: new pre-release 3.6.1a8 (#6152)
  • ci: new pre-release 3.6.1a4 (#6120)
  • ci: new pre-release 3.6.1a3 (#6107)
  • ci: new pre-release 3.6.1a0 (#6084)
  • ci: new pre-release 3.6.1a5 (#6124)
  • ci: new pre-release 3.6.1a7 (#6139)
  • ci: new pre-release 3.6.1a1 (#6090)
  • ci: new pre-release 3.6.1a6 (#6132)
  • ci: new pre-release 3.6.1a2 (#6098)
  • ci: remove python3.8 runtime when bootstrapping a new region (#6101)
  • deps: bump squidfunk/mkdocs-material from f5bcec4 to 2615302 in /docs (#6135)
  • deps: bump squidfunk/mkdocs-material from c62453b to f5bcec4 in /docs (#6087)
  • deps: bump actions/upload-artifact from 4.6.0 to 4.6.1 (#6144)
  • deps: bump aws-actions/configure-aws-credentials from 4.0.3 to 4.1.0 (#6082)

... (truncated)

Upgrade guide

Sourced from aws-lambda-powertools[parser]'s upgrade guide.


title: Upgrade guide description: Guide to update between major Powertools for AWS Lambda (Python) versions

Migrate to v3 from v2

!!! info "We strongly encourage you to migrate to v3. However, if you still need to upgrade from v1 to v2, you can find the upgrade guide."

We've made minimal breaking changes to make your transition to v3 as smooth as possible.

Quick summary

Area Change Code change required
Pydantic We have removed support for Pydantic v1 No
Parser We have replaced DynamoDBStreamModel AttributeValue with native Python types Yes
Parser We no longer export Pydantic objects from parser.pydantic. Yes
Lambda layer Lambda layers are now compiled according to the specific Python version and architecture No
Event Handler We have deprecated the get_header_value function. Yes
Batch Processor @batch_processor and @async_batch_processor decorators are now deprecated Yes
Event Source Data Classes We have updated default values for optional fields. Yes
Parameters The default cache TTL is now set to 5 minutes No
Parameters The config parameter is deprecated in favor of boto_config Yes
JMESPath Functions The extract_data_from_envelope function is deprecated in favor of query Yes
Types file We have removed the type imports from the shared/types.py file Yes

First Steps

Before you start, we suggest making a copy of your current working project or create a new branch with git.

  1. Upgrade Python to at least v3.9.
  2. Ensure you have the latest version via Lambda Layer or PyPi{target="_blank"}.
  3. Review the following sections to confirm if you need to make changes to your code.

Drop support for Pydantic v1

!!! note "No code changes required"

As of June 30, 2024, Pydantic v1 has reached its end-of-life, and we have discontinued support for this version. We now exclusively support Pydantic v2.

Use Pydantic v2 Migration Guide{target="_blank"} to migrate your custom Pydantic models to v2.

DynamoDBStreamModel in parser

!!! info "This also applies if you're using DynamoDB BatchProcessor{target="_blank"}."

DynamoDBStreamModel now returns native Python types when you access DynamoDB records through Keys, NewImage, and OldImage attributes.

... (truncated)

Commits
  • 16a866f chore: version bump
  • 9775975 fix(event_handler): revert regression when validating response (#6234)
  • 76b4d8f feat(logger): add logger buffer feature (#6060)
  • 4b84e93 chore(ci): new pre-release 3.7.1a7 (#6233)
  • 5a26c50 chore(deps-dev): bump boto3-stubs from 1.37.6 to 1.37.7 (#6231)
  • baac824 chore(deps-dev): bump aws-cdk from 2.1002.0 to 2.1003.0 (#6232)
  • a5a07c0 chore(ci): changelog rebuild (#6230)
  • 5eba5ed chore(ci): new pre-release 3.7.1a6 (#6229)
  • 9031d3c chore(deps-dev): bump jinja2 from 3.1.5 to 3.1.6 (#6224)
  • 0214bcc chore(deps-dev): bump boto3-stubs from 1.37.5 to 1.37.6 (#6227)
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [aws-lambda-powertools[parser]](https://github.com/aws-powertools/powertools-lambda-python) from 2.41.0 to 3.8.0.
- [Release notes](https://github.com/aws-powertools/powertools-lambda-python/releases)
- [Changelog](https://github.com/aws-powertools/powertools-lambda-python/blob/develop/CHANGELOG.md)
- [Upgrade guide](https://github.com/aws-powertools/powertools-lambda-python/blob/develop/docs/upgrade.md)
- [Commits](aws-powertools/powertools-lambda-python@v2.41.0...v3.8.0)

---
updated-dependencies:
- dependency-name: aws-lambda-powertools[parser]
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Copy link
Contributor Author

dependabot bot commented on behalf of github Mar 7, 2025

The following labels could not be found: dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants