github aws-powertools/powertools-lambda-python v3.6.0

11 hours ago

Summary

In this release, we are thrilled to announce new features and improvements:

  • Customizable masking capabilities with the erase method in Data Masking utility
  • Ability to disable metrics flush via environment variables
  • New Event Source Data Classes for API Gateway Authorizer Response WebSocket
  • New method to the Logger class to clear appended keys at any point during the execution of your Lambda invocation

Special thanks to @philiptzou, for improving type annotations in our OpenAPI utility! ⭐

Custom masking support for Data Masking

Docs

You can now configure advanced masking options when using erase method in the Data Masking utility. This feature provides granular control to protect sensitive information while maintaining data readability and structure.

The new options to use with erase :

  • Dynamic Mask: Preserves text length and structure by replacing characters with *
  • Custom Mask: Apply simple pattern like "XX-XX"
  • Regex Mask: Advanced pattern-based masking for complex data formats
  • Field-specific Allows different masking rules for different data fields

data_masking_new

Disable flushing metrics using environment variables

Docs

You can now set the POWERTOOLS_METRICS_DISABLES environment variable to control the metrics output. This is useful when you want to silent metrics in a non-production environment. When POWERTOOLS_DEV is enabled, the metrics are also suppressed, but you can always override it by setting POWERTOOLS_METRICS_DISABLED=false when you want to continue emitting metrics while in dev mode.

image

Support for API Gateway Authorizer Response WebSocket

Docs

You can now use the new APIGatewayAuthorizerResponseWebSocket class to handle authorization policies for WebSocket APIs.

image

Clearing all appended keys with clear_state() method

Docs

We have added a new clear_state() to Logger to easily remove any temporary keys you have added. This is useful when you add multiple custom keys conditionally or when you emit canonical or wide logs.

image

Changes

🌟New features and non-breaking changes

📜 Documentation updates

🐛 Bug and hot fixes

🔧 Maintenance

This release was made possible by the following contributors:

@anafalcao, @dependabot[bot], @dreamorosi, @github-actions[bot], @leandrodamascena, @philiptzou, dependabot[bot] and github-actions[bot]

Don't miss a new powertools-lambda-python release

NewReleases is sending notifications on new releases.