Releases: aws-powertools/powertools-lambda-python
v1.5.0
Changes
SQS batch processing utility
Add a new utility to handle partial failures when processing batches of SQS messages in Lambda. The default behaviour with Lambda - SQS is to return all messages to the queue when there is a failure during processing. This utility provides functionality to handle failures individually at the message level, and avoid re-processing messages. Thanks to @gmcrocetti who contributed this utility.
Integration with CloudWatch ServiceLens
The xray_trace_id
key is now added to log output when tracing is active. This enables the log correlation functionality in ServiceLens to work with applications using powertools.
Static types for Lambda context object
You can now import a static type for the Lambda context object from this library. Thanks to @Nr18 for the implementation.
Control order of logging output
You can now change the order of the fields output by the logger. Thanks to @michaelbrewer for the implementation.
Automatically deserialize parameters
Thanks to @michaelbrewer, the parameters utility can now automatically decide how to deserialize parameter values (json/base64) based on the key name.
Documentation improvements
Lots of improvements made to the documentation. Thanks to the community contributors: @Nr18 for adding a troubleshooting section, @michaelbrewer and @bls20AWS for several housekeeping contributions.
🌟 Minor Changes
- fix(logging): Don't include
json_default
in logs (#132) by @michaelbrewer - chore(batch): Housekeeping for recent changes (#157) by @michaelbrewer
📜 Documentation updates
- chore: fix typos, docstrings and type hints (#154) by @michaelbrewer
- docs: add description where to find the layer arn (#145) by @am29d
- docs: new section "Migrating from other Loggers" (#148) by @heitorlessa
- docs: minor edit to letter case part 2 (#142) by @michaelbrewer
- docs: minor edit to letter case (#141) by @bls20AWS
- docs: fix log sampling percentage wording (#135) by @pankajagrawal16
🐛 Bug and hot fixes
- fix: batch processing util (#155) by @cakepietoast
This release was made possible by the following contributors:
@Nr18, @am29d, @bls20AWS, @cakepietoast, @gmcrocetti, @heitorlessa, @michaelbrewer and @pankajagrawal16
v1.4.0
Changes
Official Lambda Layer
We now provide an official Lambda Layer via AWS Serverless Application Repository (SAR) App. SAR App follows semantic versioning, and it is synchronized with what's published on PyPi.
SAR App | ARN |
---|---|
aws-lambda-powertools-python-layer | arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer |
A big thanks to @am29d for the implementation, and to Keith Rosario, a long standing contributor, and beta customer, who created the first Layers through his KLayers project - Lambda Layers for Python on GitHub before.
Auto-complete for SSMProvider on Parameters utility
Thanks to @michaelbrewer, SSMProvider within Parameters utility now have decrypt
and recursive
parameters correctly defined to support autocompletion.
Tracer support to not capture response as metadata
For customers returning sensitive information from their methods and Lambda handlers, Tracer decorators capture_method
and capture_lambda_handler
now support capture_response=False
parameter to override this behaviour.
Cold start metric bugfix
This release ensures Metrics utility creates a Cold Start metric with dedicated CloudWatch dimensions function_name
and service
to explicitly separate Application metrics from System metrics.
Previously, when capturing cold start metric via capture_cold_start_metric
parameter, we would add ColdStart
metric to an existing metric set along with function_name
as a dimension. This caused the problem of Application metrics having data points in two separate metrics with the same name, since one of them would have an additional function_name
dimension in the event of a cold start.
Minor improvements to docs
Content in Tracer and Logger have been reordered to match what customers are looking for. Tracer docs have less main sections to improve navigation, a new section named Patching Modules, and a note for customers capturing sensitive information they might not want Tracer to capture it.
🌟 Minor Changes
- feat: add workflow to trigger external pipeline for publishing lambda layers (#129) by @am29d
- feat: option to disallow tracer to capture response as metadata (#128) by @heitorlessa
📜 Documentation updates
- docs: readability improvements (#130) by @heitorlessa
🐛 Bug and hot fixes
- fix: split cold start metric from application metrics to prevent duplicate app metrics (#126) by @heitorlessa
- fix(ssm): Make decrypt an explicit option and refactoring (#123) by @michaelbrewer
This release was made possible by the following contributors:
v1.3.1
Changes
Fixed issue with capture_method returning not working properly when the decorated function made us of context managers during its execution.
Patch
- fix(capture_method): should yield inside with for generator method using a context manager (#124) by @michaelbrewer
Chore
- chore(deps): bump elliptic from 6.5.2 to 6.5.3 in /docs (#120) by @dependabot
- chore(deps): bump prismjs from 1.20.0 to 1.21.0 in /docs (#121) by @dependabot
This release was made possible by the following contributors:
@cakepietoast, @dependabot, @heitorlessa and @michaelbrewer
v1.3.0
Changes
Add a new utility to fetch and cache parameter values from AWS Systems Manager Parameter Store, AWS Secrets Manager or Amazon DynamoDB. It also provides a base class to create your parameter provider implementation.
Retrieve values from Systems Manager Parameter Store:
from aws_lambda_powertools.utilities import parameters
def handler(event, context):
# Retrieve a single parameter
value = parameters.get_parameter("/my/parameter")
# Retrieve multiple parameters from a path prefix recursively
# This returns a dict with the parameter name as key
values = parameters.get_parameters("/my/path/prefix")
for k, v in values.items():
print(f"{k}: {v}")
Retrieve secrets from AWS Secrets Managers:
from aws_lambda_powertools.utilities import parameters
def handler(event, context):
# Retrieve a single secret
value = parameters.get_secret("my-secret")
- chore: bump version to 1.3.0 (#122) by @nmoutschen
🌟 Minor Changes
- feat: add parameter utility (#96) by @nmoutschen
This release was made possible by the following contributors:
v1.2.0
Changes
The Tracer capture_method decorator can now be used to capture execution of generator functions, including context managers.
- chore: bump version to 1.2.0 (#119) by @cakepietoast
🌟 Minor Changes
- feat: add support for tracing of generators using capture_method decorator (#113) by @cakepietoast
This release was made possible by the following contributors:
@cakepietoast
v1.1.3
Changes
Fix logged messages being emitted twice, once structured and once unstructured - We now remove the root logger handler set by Lambda during initialization.
Patch
- fix: remove root logger handler set by Lambda #115 (#116) by @heitorlessa
Chore
- chore: bump to 1.1.3 (#117) by @heitorlessa
This release was made possible by the following contributors:
v1.1.2
Changes
Minor patch to improve Tracer documentation on reusability, and ensures PyCharm/VSCode Jedi Language Server can autocomplete log statements for Logger
.
- chore: bump version to 1.1.2 (#111) by @heitorlessa
- improv: logger autocomplete for PyCharm (#110) by @heitorlessa
📜 Documentation updates
- docs: clarify Tracer auto_patch as per #108 (#109) by @heitorlessa
This release was made possible by the following contributors:
v1.1.1
Changes
Fix Logger regression introduced in 1.1.0 when using int
for setting log level, for example Logger(level=logging.INFO)
.
Patch
- fix: regression 104 and revert docstring (#106) by @heitorlessa
- fix: regression 104 (#105) by @heitorlessa
Chore
- chore: trigger docs on new release (#102) (#103) by @heitorlessa
- chore: trigger docs on new release (#102) by @heitorlessa
This release was made possible by the following contributors:
@heitorlessa, and big thanks to @zroger for spotting and raising this regression
v1.1.0
Changes
This release add support for reusing Logger
across multiple files in your code base via the new child
parameter 🎉🎉🎉
Child Loggers will be named after the convention {service}.{filename}
- It now follows the Python Logging inheritance mechanics. Here's a code excerpt to demonstrate how this feature looks like:
app.py - Your typical parent logger will be at your Lambda function handler
# POWERTOOLS_SERVICE_NAME: "payment"
import shared # Creates a child logger named "payment.shared"
from aws_lambda_powertools import Logger
logger = Logger()
def handler(event, context):
shared.inject_payment_id(event) # highlight-line
logger.structure_logs(append=True, order_id=event["order_id"]) # highlight-line
...
shared.py - You can use Logger(child=True)
to explicit tell Logger this should be the child
# POWERTOOLS_SERVICE_NAME: "payment"
from aws_lambda_powertools import Logger
logger = Logger(child=True) # highlight-line
def inject_payment_id(event):
logger.structure_logs(append=True, payment_id=event["payment_id"])
🌟 Minor Changes
- feat: logger inheritance (#99) by @heitorlessa
Chore
- chore(deps): bump lodash from 4.17.15 to 4.17.19 in /docs (#93) by @dependabot
This release was made possible by the following contributors:
v1.0.2
Changes
This release allows the latest version of X-Ray SDK (2.6.0) to be installed, and no longer locks to the previous version (2.5.0).
Chore
- chore: bump to 1.0.2 (#90) by @heitorlessa
- chore: support aws-xray-sdk >=2.5.0 till <3.0.0 (#89) by @Nr18
This release was made possible by the following contributors:
@Nr18 and @heitorlessa