Releases: aws-powertools/powertools-lambda-typescript
v1.0.0
Changes
With this release, we move from release candidate to General Availability 🎉🎉🎉!
This means APIs for the core utilities Tracer, Logger, and Metrics are now stable and they are ready to be used in AWS Lambda functions written in JavaScript and TypeScript running in production.
Quick links: 📜Documentation | NPM | Feature request | Bug Report
Tracer
🤩 Key features 🤩
- Auto capture cold start and service name as annotations, and responses or full exceptions as metadata
- Auto-disable when not running in AWS Lambda environment
- Automatically trace HTTP(s) clients and generate segments for each request
- Support tracing functions via decorators, middleware, and manual instrumentation
- Support tracing AWS SDK v2 and v3 via AWS X-Ray SDK for Node.js
import { Tracer, captureLambdaHandler } from '@aws-lambda-powertools/tracer';
// Using Middy for the first time? Learn more at https://middy.js.org
import middy from '@middy/core';
const tracer = new Tracer();
const lambdaHandler = async (_event: any, _context: any): Promise<void> => {
/* ... */
};
// Wrap the handler with middy
export const handler = middy(lambdaHandler)
// Use the middleware by passing the Tracer instance as a parameter
.use(captureLambdaHandler(tracer));
Logger
🤩 Key features 🤩
- Capture key fields from Lambda context, cold start and structure logging output as JSON
- Log Lambda event when instructed (disabled by default)
- Log sampling prints all the logs for a percentage of invocations (disabled by default)
- Append additional keys to structured log at any point in time
import { Logger, injectLambdaContext } from '@aws-lambda-powertools/logger';
// Using Middy for the first time? Learn more at https://middy.js.org
import middy from '@middy/core';
const logger = new Logger();
const lambdaHandler = async (_event: any, _context: any): Promise<void> => {
logger.info('This is an INFO log with some context');
};
// Wrap the handler with middy
export const handler = middy(lambdaHandler)
.use(injectLambdaContext(logger));
Metrics
🤩 Key features 🤩
- Aggregate up to 100 metrics using a single CloudWatch EMF object (large JSON blob)
- Validate against common metric definitions mistakes (metric unit, values, max dimensions, max metrics, etc)
- Metrics are created asynchronously by CloudWatch service, no custom stacks needed
- Context manager to create a one off metric with a different dimension
import { Metrics, MetricUnits, logMetrics } from '@aws-lambda-powertools/metrics';
import middy from '@middy/core';
const metrics = new Metrics({ namespace: 'myApplication' });
const lambdaHandler = async (_event: any, _context: any): Promise<void> => {
metrics.addMetric('successfulBooking', MetricUnits.Count, 1);
};
// Wrap the handler with middy
export const handler = middy(lambdaHandler)
.use(logMetrics(metrics));
Samples and Starters
https://github.com/awslabs/aws-lambda-powertools-typescript/tree/main/examples
https://github.com/aws-samples/serverless-typescript-demo
🌟Special thank you
We'd like to extend our gratitude to the following people who helped with contributions, feedbacks, and their opinions while we were in developer preview:
@heitorlessa, @AWSDB, @SH4DY, @okoskine, @goverdhan07, @JavierMendozaGomez, @bahrmichael, @alan-churley, @alex-m-aws, @kozub, @roman-boiko, @willfarrell, @lmammino
v0.12.0-rc.1
Summary
In this release candidate version we have made some updates to the documentation to clarify the settings needed for the Tracer utility to work as well as fixing some bugs in both Tracer and Logger that emerged during the testing phase that we have been running in the past weeks.
Changes
- Revert "build: bump lerna (#1014)" (#1018) by @saragerion
- Revert "chore(release): v0.12.0-rc.0 [skip ci]" (#1017) by @saragerion
🌟New features and non-breaking changes
- feat(tracer): auto disable when running inside amplify mock (#1010) by @dreamorosi
📜 Documentation updates
- docs: added note about active tracing (#1011) by @dreamorosi
- docs: update docs to reflect RC status (#1009) by @dreamorosi
🐛 Bug and hot fixes
- fix(tracer): capture method throws errors correctly (#1016) by @dreamorosi
- fix(logger): POWERTOOLS_LOGGER_LOG_EVENT precedence is respected (#1015) by @dreamorosi
🔧 Maintenance
- build(dev-deps): bump lerna from 4.x to 5.x (#1014) by @dreamorosi
- build(deps): bump parse-url from 6.0.0 to 6.0.2 (#1013) by @dependabot
This release was made possible by the following contributors:
v0.11.1-rc.0
Summary
With this release, we move from beta developer preview to Release Candidate (RC) 🎉 🎉 🎉
In this stage we are looking to gather as much feedback as possible as well as discovering unknown unknowns that might have slipped through the unit and integration test cases we have implemented so far.
We consider the Logger, Metrics, and Tracer utilities complete in terms of features but we anticipate that there might be some additional releases between now and the General Availability release to fix any bug or issue that are found.
Over the next few weeks we encourage all of you to try the new RC release(s) and let us know what you think as well as reporting any issue or sharp edge that you might find. We will be doing the same and test-drive the utilities in some non-trivial workloads.
Finally, we want to take a moment to thank you all for the patience and the enthusiasm towards the project that we have seen so far. We know that we have a long way to go and we look forward to see what you will do with AWS Powertools for TypeScript; now go build 🔧!
Changes
🔧 Maintenance
- chore: updated rc release flow (#1005) by @dreamorosi
This release was made possible by the following contributors:
v0.11.0
Summary
This release introduces 2 main features for the Logger utility: clear state functionality, and log event.
Clear state
The Logger utility is commonly initialized in the global scope, outside the handler function.
When you attach persistent log attributes through the persistentLogAttributes
constructor option or via the appendKeys
, addPersistentLogAttributes
methods, this data is attached to the Logger instance.
Due to the Lambda Execution Context reuse, this means those persistent log attributes may be reused across invocations.
This PR introduces a new flag that developers can enable to "clear the state" across invocations.
If developers want to make sure that persistent attributes added inside the handler function code are not persisted across invocations, they can now set the parameter clearState
as true
in the injectLambdaContext
middleware or decorator.
Log event
This PR introduces a new functionality: logging Lambda events. Developers can opt in for this behaviour by one of the following methods:
- passing the parameter
logEvent
set totrue
to theinjectLambdaContext
middleware - passing the parameter
logEvent
set totrue
to theinjectLambdaContext
decorator - setting the env var
POWERTOOLS_LOGGER_LOG_EVENT
to through while using the injectLambdaContext middleware/decorator
Note that this functionality is only available when using a middleware or decorator.
The Lambda invocation will then print one log item with the following key-value pairs:
logLevel
INFOmessage
key with valueLambda invocation event
event
key with the current Lambda invocation event as value
Logging a Lambda event is very typical use of a logger in AWS Lambda. This logic aims to simplify and reduce the code that developers need to maintain.
Improvements
We disabled the dependabot updates in favour of periodic, manual dependencies upgrades as the current dependabot setup was disrupting the maintainers' focus and was polluting out PRs.
We also added a useful Github Action plugin that will comment the size of the utilities package so we can monitor it we are add code or dependencies.
Changes
- build: bump examples version (#928) by @dreamorosi
🌟New features and non-breaking changes
- Feat(logger): log event functionality (#1004) by @saragerion
- Feat(logger): add clear state functionality (#902) by @saragerion
🔧 Maintenance
- chore: disable dependabot for dependencies upgrades (#992) by @dreamorosi
- feat (build): Add package size check in PR workflow (#878) by @flochaz
- build(deps-dev): bump esbuild from 0.14.45 to 0.14.46 (#985) by @dependabot
- build(deps): bump aws-sdk from 2.1156.0 to 2.1157.0 (#984) by @dependabot
- build(deps-dev): bump typescript from 4.7.3 to 4.7.4 (#982) by @dependabot
- build(deps-dev): bump eslint from 8.17.0 to 8.18.0 (#983) by @dependabot
- build(deps-dev): bump @types/node from 17.0.42 to 18.0.0 (#973) by @dependabot
- build(deps-dev): bump esbuild from 0.14.43 to 0.14.45 (#971) by @dependabot
- build(deps): bump aws-sdk from 2.1152.0 to 2.1156.0 (#976) by @dependabot
- build(deps): bump mkdocs-material from 8.3.3 to 8.3.6 in /docs (#981) by @dependabot
- build(deps-dev): bump @typescript-eslint/parser from 5.27.1 to 5.28.0 (#968) by @dependabot
- build(deps-dev): bump @typescript-eslint/eslint-plugin from 5.27.1 to 5.28.0 (#969) by @dependabot
- build(deps): bump broken Depdendabot deps (#945) by @dreamorosi
- build(deps-dev): bump @types/node from 17.0.41 to 17.0.42 (#961) by @dependabot
- build(deps): bump @aws-sdk/client-sts from 3.100.0 to 3.105.0 (#948) by @dependabot
- build(deps-dev): bump typescript from 4.6.4 to 4.7.3 (#953) by @dependabot
- build(deps-dev): bump @typescript-eslint/eslint-plugin from 5.27.0 to 5.27.1 (#959) by @dependabot
- build(deps): bump @types/aws-lambda from 8.10.97 to 8.10.100 (#955) by @dependabot
- build(deps-dev): bump esbuild from 0.14.42 to 0.14.43 (#954) by @dependabot
- build(deps-dev): bump @typescript-eslint/parser from 5.27.0 to 5.27.1 (#958) by @dependabot
- build(deps): bump aws-sdk from 2.1148.0 to 2.1152.0 (#949) by @dependabot
- build(deps): bump mkdocs-material from 8.3.0 to 8.3.3 in /docs (#957) by @dependabot
- build(deps-dev): bump @commitlint/cli from 17.0.1 to 17.0.2 (#952) by @dependabot
- build(deps-dev): bump eslint from 8.16.0 to 8.17.0 (#950) by @dependabot
- build(deps-dev): bump @types/node from 17.0.38 to 17.0.41 (#960) by @dependabot
- build(deps): bump actions/setup-python from 3 to 4 (#947) by @dependabot
- build(deps-dev): bump ts-node from 10.8.0 to 10.8.1 (#946) by @dependabot
- build(deps-dev): bump @typescript-eslint/eslint-plugin from 5.26.0 to 5.27.0 (#940) by @dependabot
- build(deps-dev): bump typedoc from 0.22.15 to 0.22.17 (#935) by @dependabot
- build(deps): bump aws-cdk-lib from 2.25.0 to 2.27.0 (#942) by @dependabot
- build(deps-dev): bump @aws-cdk/cloudformation-diff from 2.25.0 to 2.27.0 (#937) by @dependabot
- build(deps): bump constructs from 10.1.19 to 10.1.25 (#933) by @dependabot
- build(deps-dev): bump cdk-assets from 2.25.0 to 2.27.0 (#931) by @dependabot
- build(deps-dev): bump @aws-cdk/cx-api from 2.25.0 to 2.27.0 (#929) by @dependabot
- build(deps): bump @aws-sdk/client-sts from 3.95.0 to 3.100.0 (#917) by @dependabot
- build(deps-dev): bump @types/node from 17.0.35 to 17.0.38 (#939) by @dependabot
- build(deps-dev): bump @typescript-eslint/parser from 5.26.0 to 5.27.0 (#943) by @dependabot
- build(deps-dev): bump esbuild from 0.14.40 to 0.14.42 (#941) by @dependabot
- build(deps): bump mkdocs-material from 8.2.15 to 8.3.0 in /docs (#944) by @dependabot
- build(deps): bump aws-sdk from 2.1140.0 to 2.1148.0 (#930) by @dependabot
This release was made possible by the following contributors:
@dependabot, @dependabot[bot], @dreamorosi, @flochaz and @saragerion
v0.10.0
Summary
This release adds support for the Node.js 16.x runtime that has recently been released for AWS Lambda, as well as extending support to the Node.js 12.x one by moving to es2019
as transpile target.
Additionally, this release introduces the option of removing persistent keys from a logger instance. This can be done using the newly introduced removeKeys
method that accepts as parameter an array of keys to be removed.
Changes
🌟New features and non-breaking changes
- feat(logger): add removeKeys functionality (#901) by @saragerion
- feat(all): nodejs16x support (#877) by @dreamorosi
📜 Documentation updates
- chore(examples): updated contributing & docs with SAM (#876) by @dreamorosi
🐛 Bug and hot fixes
- build(all): use es2019 target to support on Node12 (#925) by @ijemmy
- fix(commons): rename tests subfolder to samples to avoid being deleted by tools such as node-prune (#882) by @flochaz
🔧 Maintenance
- chore(examples): cleanup old examples (#903) by @dreamorosi
- build(deps): bump constructs from 10.1.12 to 10.1.19 (#920) by @dependabot
- build(deps-dev): bump @aws-cdk/cx-api from 2.24.1 to 2.25.0 (#913) by @dependabot
- build(deps-dev): bump @aws-cdk/cloudformation-diff from 2.24.1 to 2.25.0 (#911) by @dependabot
- build(deps-dev): bump cdk-assets from 2.24.1 to 2.25.0 (#907) by @dependabot
- build(deps): bump aws-cdk-lib from 2.24.1 to 2.25.0 (#904) by @dependabot
- build(deps-dev): bump @types/lodash.pickby from 4.6.6 to 4.6.7 (#914) by @dependabot
- build(deps-dev): bump @types/lodash.clonedeep from 4.5.6 to 4.5.7 (#906) by @dependabot
- build(deps-dev): bump esbuild from 0.14.39 to 0.14.40 (#905) by @dependabot
- build(deps-dev): bump ts-node from 10.7.0 to 10.8.0 (#908) by @dependabot
- build(deps-dev): bump eslint from 8.15.0 to 8.16.0 (#910) by @dependabot
- build(deps-dev): bump @typescript-eslint/parser from 5.25.0 to 5.26.0 (#918) by @dependabot
- build(deps-dev): bump @commitlint/cli from 17.0.0 to 17.0.1 (#919) by @dependabot
- build(deps-dev): bump @typescript-eslint/eslint-plugin from 5.25.0 to 5.26.0 (#922) by @dependabot
- build(deps-dev): bump axios from 0.27.1 to 0.27.2 (#923) by @dependabot
- chore(examples): updated contributing & docs with SAM (#876) by @dreamorosi
This release was made possible by the following contributors:
v0.9.1
Summary
@AWSDB introduces a change that relaxes the restrictions introduced by #614. In #565, we decided to restrict the additional logging data objects in their shape. It turned out, that this restriction prevents from logging of arbitrary objects, which is inconvenient.
In his change, type restrictions are removed, so it is now possible to specify any object as additional payload when calling the logger methods directly.
Changes
🐛 Bug and hot fixes
🔧 Maintenance
- build(deps): bump aws-sdk from 2.1134.0 to 2.1140.0 (#900) by @dependabot
- build(deps-dev): bump @aws-sdk/client-dynamodb from 3.58.0 to 3.95.0 (#891) by @dependabot
- build(deps-dev): bump @types/lodash.pickby from 4.6.6 to 4.6.7 (#892) by @dependabot
- build(deps-dev): bump @typescript-eslint/parser from 5.23.0 to 5.25.0 (#893) by @dependabot
- build(deps-dev): bump @typescript-eslint/eslint-plugin from 5.23.0 to 5.25.0 (#894) by @dependabot
- build(deps): bump constructs from 10.1.7 to 10.1.12 (#895) by @dependabot
- build(deps-dev): bump @types/lodash.merge from 4.6.6 to 4.6.7 (#896) by @dependabot
- build(deps-dev): bump axios from 0.27.1 to 0.27.2 (#897) by @dependabot
- build(deps): bump @aws-sdk/client-sts from 3.87.0 to 3.95.0 (#889) by @dependabot
- build(deps-dev): bump @commitlint/cli from 16.2.4 to 17.0.0 (#886) by @dependabot
- build(deps-dev): bump @types/node from 17.0.33 to 17.0.35 (#888) by @dependabot
- build(deps-dev): bump @types/lodash.clonedeep from 4.5.6 to 4.5.7 (#885) by @dependabot
- build(deps): bump aws-xray-sdk-core from 3.3.4 to 3.3.5 (#887) by @dependabot
- build(deps): bump mkdocs-material from 8.2.14 to 8.2.15 in /docs (#898) by @dependabot
This release was made possible by the following contributors:
@AWSDB, @dependabot and @dependabot[bot]
v0.9.0
Summary
This release introduces a range of new improvements.
SAM example
Thanks to @bpauwels's contribution, we now have a deployable example that relies on SAM CLI.
Now the folder examples/sam
contains source code and supporting files for a serverless application that you can deploy with the SAM CLI.
The application uses several AWS resources, including Lambda functions and an API Gateway API. These resources are defined in the template.yaml
file.
E2E tests improvements
@ijemmy worked on a refactor of our E2E tests, which are now more stable. Changes include but are not limited to: usage of Github Actions matrix, testing of Node.js runtime version 12 and 14, and unique stack names.
Correct record of xray_trace_id in log items
As reported by user @humanzz in #773 the Logger utility was not including the xray_trace_id
key in logs. This field is listed in the documentation as a standard key that should appear in each log.
xray_trace_id
is now correctly appearing in the logs.
Changes
🌟New features and non-breaking changes
- feat(examples): added sam example to workflows (#849) by @dreamorosi
📜 Documentation updates
🐛 Bug and hot fixes
- fix(actions): reintroduce token to checkout repo in release workflow (#848) by @dreamorosi
- fix(logger): add xray_trace_id to every log (#776) by @dreamorosi
- fix(actions): added back fetch-depth: 0 (#812) by @dreamorosi
- fix(actions): removed token from remaining actions (#805) by @dreamorosi
🔧 Maintenance
- build(deps): bump aws-cdk-lib from 2.23.0 to 2.24.1 (#874) by @dependabot
- build(deps-dev): bump @aws-cdk/cx-api from 2.23.0 to 2.24.1 (#873) by @dependabot
- build(deps-dev): bump @aws-cdk/cloudformation-diff from 2.23.0 to 2.24.1 (#871) by @dependabot
- build(deps-dev): bump cdk-assets from 2.23.0 to 2.24.1 (#868) by @dependabot
- build(deps-dev): bump @types/lodash.clonedeep from 4.5.6 to 4.5.7 (#870) by @dependabot
- build(deps-dev): bump @types/lodash.pickby from 4.6.6 to 4.6.7 (#869) by @dependabot
- build(deps-dev): bump @types/lodash.merge from 4.6.6 to 4.6.7 (#866) by @dependabot
- build(deps-dev): bump @aws-sdk/client-dynamodb from 3.58.0 to 3.87.0 (#872) by @dependabot
- build(deps): bump aws-sdk from 2.1133.0 to 2.1134.0 (#862) by @dependabot
- build(deps): bump aws-xray-sdk-core from 3.3.4 to 3.3.5 (#867) by @dependabot
- build(deps-dev): bump @types/node from 17.0.32 to 17.0.33 (#857) by @dependabot
- build(deps): bump release-drafter/release-drafter from 5.19.0 to 5.20.0 (#858) by @dependabot
- build(deps): bump mkdocs-material from 8.2.13 to 8.2.14 in /docs (#865) by @dependabot
- chore(tracer): rename package folder to tracer (#854) by @dreamorosi
- build(deps): bump constructs from 10.1.5 to 10.1.7 (#853) by @dependabot
- build(deps-dev): bump @types/node from 17.0.31 to 17.0.32 (#852) by @dependabot
- build(deps): bump aws-sdk from 2.1132.0 to 2.1133.0 (#851) by @dependabot
- build(deps-dev): bump esbuild from 0.14.38 to 0.14.39 (#850) by @dependabot
- fix(actions): reintroduce token to checkout repo in release workflow (#848) by @dreamorosi
- build(deps): bump aws-sdk from 2.1131.0 to 2.1132.0 (#847) by @dependabot
- build(deps-dev): bump @typescript-eslint/parser from 5.21.0 to 5.23.0 (#844) by @dependabot
- build(deps-dev): bump @aws-cdk/cloudformation-diff from 2.22.0 to 2.23.0 (#843) by @dependabot
- build(deps-dev): bump @typescript-eslint/eslint-plugin from 5.21.0 to 5.23.0 (#841) by @dependabot
- build(deps-dev): bump cdk-assets from 2.22.0 to 2.23.0 (#842) by @dependabot
- Add class documentation FunctionSegmentNotDefinedErrorunexpected and make end_time optional (#845) by @ijemmy
- build(deps-dev): bump @aws-cdk/cx-api from 2.22.0 to 2.23.0 (#840) by @dependabot
- build(deps): bump constructs from 10.0.127 to 10.1.5 (#839) by @dependabot
- build(deps): bump aws-cdk-lib from 2.22.0 to 2.23.0 (#838) by @dependabot
- build(deps-dev): bump @types/node from 17.0.30 to 17.0.31 (#837) by @dependabot
- build(deps): bump aws-sdk from 2.1124.0 to 2.1131.0 (#836) by @dependabot
- build(deps-dev): bump husky from 7.0.4 to 8.0.1 (#835) by @dependabot
- build(deps): bump @aws-sdk/client-sts from 3.80.0 to 3.87.0 (#834) by @dependabot
- build(deps-dev): bump @types/jest from 27.4.1 to 27.5.0 (#833) by @dependabot
- build(deps-dev): bump eslint from 8.14.0 to 8.15.0 (#832) by @dependabot
- build(deps): bump @types/aws-lambda from 8.10.95 to 8.10.97 (#831) by @dependabot
- test(all): switch to use GitHub strategy matrix and fix flaky tests (#828) by @ijemmy
- build(deps): bump mkdocs-material from 8.2.11 to 8.2.13 in /docs (#827) by @dependabot
- test(tracer): make e2e tests to follow the same convention in Logger and Metrics (#788) by @ijemmy
- build(deps-dev): bump typescript from 4.6.3 to 4.6.4 (#824) by @dependabot
- build(deps-dev): bump @aws-cdk/cloudformation-diff from 2.21.1 to 2.22.0 (#823) by @dependabot
- build(deps): bump constructs from 10.0.126 to 10.0.127 (#822) by @dependabot
- build(deps-dev): bump @commitlint/cli from 16.2.3 to 16.2.4 (#821) by @dependabot
- build(deps): bump aws-sdk from 2.1122.0 to 2.1124.0 (#819) by @dependabot
- build(deps-dev): bump cdk-assets from 2.21.1 to 2.22.0 (#820) by @dependabot
- build(deps): bump aws-cdk-lib from 2.21.1 to 2.22.0 (#818) by @dependabot
- build(deps-dev): bump @types/node from 17.0.27 to 17.0.30 (#817) by @dependabot
- build(deps): bump @aws-sdk/client-sts from 3.76.0 to 3.80.0 (#816) by @dependabot
- build(deps-dev): bump @aws-cdk/cx-api from 2.21.1 to 2.22.0 (#815) by @dependabot
- build(deps-dev): bump @typescript-eslint/eslint-plugin from 5.20.0 to 5.21.0 (#810) by @dependabot
- build(deps): bump constructs from 10.0.118 to 10.0.126 (#809) by @dependabot
- build(deps-dev): bump axios from 0.26.1 to 0.27.1 (#807) by @dependabot
- build(deps): bump aws-sdk from 2.1121.0 to 2.1122.0 (#813) by @dependabot
- build(deps-dev): bump @typescript-eslint/parser from 5.20.0 to 5.21.0 (#806) by @dependabot
- build(deps-dev): bump eslint from 8.13.0 to 8.14.0 (#804) by @dependabot
- build(deps): bump aws-cdk-lib from 2.20.0 to 2.21.1 (#803) by @dependabot
- build(deps): bump @types/aws-lambda from 8.10.93 to 8.10.95 (#801) by @dependabot
- build(deps-dev): bump esbuild from 0.14.36 to 0.14.38 (#800) by @dependabot
- build(deps-dev): bump @types/node from 17.0.26 to 17.0.27 (#808) by @dependabot
- build(deps-dev): bump @aws-cdk/cloudformation-diff from 2.20.0 to 2.21.1 (#802) by @dependabot
- build(deps-dev): bump @aws-cdk/cx-api from 2.20.0 to 2.21.1 (#799) by @dependabot
- build(deps): bump aws-sdk from 2.1116.0 to 2.1121.0 (#811) by @dependabot
- build(deps): bump @aws-sdk/client-sts from 3.72.0 to 3.76.0 (#797) by @dependabot
- build(deps): bump mkdocs-material from 8.2.7 to 8.2.11 in /docs (#798) by @dependabot
- build(deps-dev): bump cdk-assets from 2.20.0 to 2.21.1 (#794) by @dependabot
- fix(actions): added back fetch-depth: 0 (#812) by @dreamorosi
- build(deps-dev): bump @types/node from 17.0.24 to 17.0.26 (#795) by @dependabot
- fix(actions): removed token from remaining actions (#805) by @dreamorosi
- chore: updated depdendabot configs (#766) by @dreamorosi
- build(deps-dev): bump @typescript-eslint/eslint-plugin from 5.19.0 to 5.20.0 (#783) by @dependabot
- build(deps-dev): bump @typescript-eslint/parser from 5.19.0 to 5.20.0 (#782) by @dependabot
- build(deps): bump aws-sdk from 2.1115.0 to 2.1116.0 (#780) by @dependabot
- build(deps): bump constructs from 10.0.115 to 10.0.118 (#781) by @dependabot
- build(deps-dev): bump archiver from 5.3.0 to 5.3.1 (#779) by @dependabot
- build(deps): bump @aws-sdk/client-sts from 3.67.0 to 3.72.0 (#778) by @dependabot
- build(deps-dev): bump concurrently from 7.0.0 to 7.1.0 (#772) by @dependabot
- build(deps-dev): bump @aws-sdk/client-dynamodb from 3.58.0 to 3.67.0 (#771) by @dependabot
- build(deps): bump aws-sdk from 2.1114.0 to 2.1115.0 (#775) by @dependabot
- build(deps): bump constructs from 10.0.114 to 10.0.115 (#774) by @dependabot
- build(deps-dev): bump @types/node from 17.0.23 to 17.0.24 (#769) by @dependabot
- build(deps): bump aws-sdk from 2.1113.0 to 2.1114.0 (#770) by @dependabot
- build(deps): bump constructs from 10.0.113 to 10.0.114 (#768) by @dependabot
This release was made possible by the following contributors:
@bpauwels, @dependabot, @dependabot[bot], @dreamorosi and @ijemmy
v0.8.1
Summary
This is a patch release for those using Logger together with 3rd party providers like New Relic, Honeycomb, and others. This release ensures that all the log entries generated by the utility are valid JSON strings.
Logger emitting valid JSON strings
Before:
2022-04-08T10:58:44.811Z b6511ee9-4873-404e-b60c-a23cb45d3ff2 INFO {"cold_start":false,"function_arn":"arn:aws:lambda:eu-west-2:12345:function:test","function_memory_size":1024,"function_name":"test","function_request_id":"b6511ee9-4873-404e-b60c-a23cb45d3ff2","level":"INFO","message":"test message","service":"test","timestamp":"2022-04-08T10:58:44.811Z"}
After:
{"cold_start":false,"function_arn":"arn:aws:lambda:eu-west-2:12345:function:test","function_memory_size":1024,"function_name":"test","function_request_id":"b6511ee9-4873-404e-b60c-a23cb45d3ff2","level":"INFO","message":"test message","service":"test","timestamp":"2022-04-08T10:58:44.811Z"}
As detailed in the AWS Lambda docs:
The Node.js runtime logs the START, END, and REPORT lines for each invocation. It adds a timestamp, request ID, and log level to each entry logged by the function.
This behaviour is handy for those who have not adopted structured logging and that are using Amazon CloudWatch to store their logs as it adds context to each log entry without any extra code in the function.
For those who instead prefer to bring their logs elsewhere, and have decided to use JSON to format their logs, the presence of the prefix makes it harder to ingest and process the logs.
Starting with this release all the logs emitted by Logger won't have the prefix and will instead be a valid JSON that can be parsed as such.
Big shoutout to @olanb7 for reporting this on the #lambda-powertools
channel part of the AWS Developers Slack (Join here!)
Changes
🐛 Bug and hot fixes
- fix(logger): change logging to use stdout (#748) by @dreamorosi
🔧 Maintenance
- build(deps): bump constructs from 10.0.112 to 10.0.113 (#765) by @dependabot
- build(deps-dev): bump esbuild from 0.14.34 to 0.14.36 (#761) by @dependabot
- build(deps): bump aws-sdk from 2.1111.0 to 2.1113.0 (#764) by @dependabot
- build(deps-dev): bump @typescript-eslint/eslint-plugin from 5.18.0 to 5.19.0 (#763) by @dependabot
- build(deps): bump constructs from 10.0.110 to 10.0.112 (#760) by @dependabot
- build(deps-dev): bump @typescript-eslint/parser from 5.18.0 to 5.19.0 (#759) by @dependabot
- build(deps): bump @aws-sdk/client-sts from 3.58.0 to 3.67.0 (#758) by @dependabot
- build(deps-dev): bump typedoc from 0.22.14 to 0.22.15 (#757) by @dependabot
- build(deps): bump constructs from 10.0.108 to 10.0.110 (#754) by @dependabot
- build(deps-dev): bump eslint from 8.12.0 to 8.13.0 (#755) by @dependabot
- build(deps): bump aws-actions/stale-issue-cleanup from e9f9e34 to 5 (#753) by @dependabot
- build(deps): bump aws-sdk from 2.1110.0 to 2.1111.0 (#756) by @dependabot
- build(deps): bump actions/upload-artifact from 2 to 3 (#752) by @dependabot
- build(deps-dev): bump concurrently from 7.0.0 to 7.1.0 (#746) by @dependabot
This release was made possible by the following contributors:
v0.8.0
Summary
This release adds a new feature to the Tracer utility that allows you to automatically capture traces for HTTP requests without changing your code.
Capturing HTTP requests with Tracer
You can now use Tracer to capture requests to HTTP APIs. The utility automatically traces those calls and adds the API to the service graph as a downstream service.
Tracer patches the http
and https
modules from the standard library. This means that request libraries that are based on one of these modules should be instrumented automatically.
The service graph shown in the screenshot above was generated using the popular axios
library:
import { Tracer } from '@aws-lambda-powertools/tracer';
import axios from 'axios';
const tracer = new Tracer({ serviceName: 'serverlessAirline' });
export const handler = async (event: unknown, context: Context): Promise<void> => {
await axios.get('https://httpbin.org/status/200');
};
Translating to the following traces:
The feature is enabled by default and HTTP requests should be automatically start being traced once you upgrade @aws-lambda-powertools/tracer
to v0.8.0
or above.
You can opt-out by setting the POWERTOOLS_TRACER_CAPTURE_HTTPS_REQUESTS
environment variable to false
or by passing the captureHTTPSRequests: false
option to the Tracer constructor:
const tracer = new Tracer({
serviceName: 'serverlessAirline',
captureHTTPSRequests: false // Tracer won't capture any trace for your HTTP requests
});
Changes
🌟New features and non-breaking changes
- feat: added captureHTTPsRequest feature (#677) by @dreamorosi
🔧 Maintenance
- build(deps): bump aws-sdk from 2.1109.0 to 2.1110.0 (#744) by @dependabot
- build(deps-dev): bump @typescript-eslint/eslint-plugin from 5.17.0 to 5.18.0 (#743) by @dependabot
- build(deps): bump aws-cdk-lib from 2.19.0 to 2.20.0 (#742) by @dependabot
- build(deps-dev): bump @aws-cdk/cloudformation-diff from 2.19.0 to 2.20.0 (#741) by @dependabot
- build(deps-dev): bump cdk-assets from 2.19.0 to 2.20.0 (#740) by @dependabot
- build(deps-dev): bump eslint-plugin-import from 2.25.4 to 2.26.0 (#739) by @dependabot
- build(deps-dev): bump @aws-cdk/cx-api from 2.19.0 to 2.20.0 (#738) by @dependabot
- build(deps-dev): bump typedoc from 0.22.13 to 0.22.14 (#737) by @dependabot
- build(deps): bump constructs from 10.0.102 to 10.0.108 (#735) by @dependabot
- build(deps-dev): bump esbuild from 0.14.29 to 0.14.34 (#734) by @dependabot
- build(deps-dev): bump @typescript-eslint/parser from 5.17.0 to 5.18.0 (#725) by @dependabot
- build(deps-dev): bump eslint-import-resolver-typescript from 2.7.0 to 2.7.1 (#720) by @dependabot
- build(deps): bump aws-sdk from 2.1105.0 to 2.1109.0 (#736) by @dependabot
- build(deps-dev): bump @aws-sdk/client-dynamodb from 3.55.0 to 3.58.0 (#719) by @dependabot
This release was made possible by the following contributors:
v0.7.2
Summary
This is a maintenance release in which we have bumped several development dependencies. Our work on improving the confidence of our tests continues, we have extended our test matrix to more utilities as well as completely migrate the setup of the integration tests to aws-cdk-lib
.
📜 Documentation updates
- build(docs): updated docs dependencies (#688) by @dreamorosi
🔧 Maintenance
- build(deps-dev): bump cdk-assets from 2.18.0 to 2.19.0 (#718) by @dependabot
- build(deps): bump aws-sdk from 2.1104.0 to 2.1105.0 (#716) by @dependabot
- build(deps-dev): bump @aws-cdk/cx-api from 2.18.0 to 2.19.0 (#715) by @dependabot
- build(deps): bump aws-cdk-lib from 2.18.0 to 2.19.0 (#714) by @dependabot
- build(deps-dev): bump @aws-cdk/cloudformation-diff from 2.18.0 to 2.19.0 (#713) by @dependabot
- build(deps): bump constructs from 10.0.101 to 10.0.102 (#712) by @dependabot
- build(dev-deps): bump @types/jest (#717) by @dreamorosi
- build(dev-deps): bump jest in examples to latest (#711) by @dreamorosi
- build(deps): bump aws-cdk-lib from 2.17.0 to 2.18.0 (#710) by @dependabot
- build(deps): bump constructs from 10.0.92 to 10.0.101 (#709) by @dependabot
- build(deps-dev): bump eslint from 8.11.0 to 8.12.0 (#708) by @dependabot
- build(deps-dev): bump cdk-assets from 2.17.0 to 2.18.0 (#703) by @dependabot
- build(deps-dev): bump @aws-cdk/cloudformation-diff from 2.17.0 to 2.18.0 (#705) by @dependabot
- build(deps-dev): bump @aws-cdk/cx-api from 2.17.0 to 2.18.0 (#702) by @dependabot
- build(deps-dev): bump ts-jest from 27.1.3 to 27.1.4 (#706) by @dependabot
- build(deps): bump @aws-sdk/client-sts from 3.53.0 to 3.58.0 (#707) by @dependabot
- build(deps-dev): bump eslint-import-resolver-typescript from 2.5.0 to 2.7.0 (#701) by @dependabot
- build(deps-dev): bump @commitlint/cli from 16.2.1 to 16.2.3 (#704) by @dependabot
- build(deps-dev): bump jest-runner-groups from 2.1.0 to 2.2.0 (#700) by @dependabot
- build(deps-dev): bump @typescript-eslint/parser from 5.14.0 to 5.17.0 (#699) by @dependabot
- build(deps-dev): bump typescript from 4.6.2 to 4.6.3 (#698) by @dependabot
- build(deps): bump aws-sdk from 2.1092.0 to 2.1104.0 (#697) by @dependabot
- build(deps-dev): bump esbuild from 0.14.26 to 0.14.29 (#696) by @dependabot
- build(deps-dev): bump @typescript-eslint/eslint-plugin from 5.14.0 to 5.17.0 (#693) by @dependabot
- build(deps-dev): bump @types/node from 17.0.21 to 17.0.23 (#685) by @dependabot
- build(deps): bump hosted-git-info from 4.1.0 to 5.0.0 (#680) by @dependabot
- build(docs): updated docs dependencies (#688) by @dreamorosi
- build(deps): bump minimist from 1.2.5 to 1.2.6 in /examples/cdk (#686) by @dependabot
- build(deps): bump minimist from 1.2.5 to 1.2.6 (#687) by @dependabot
- test(common,logger,metrics): run e2e tests for metrics in both Node runtimes (#678) by @ijemmy
- test(all): move e2e tests to cdk v2 (#676) by @flochaz
This release was made possible by the following contributors:
@dreamorosi, @flochaz and @ijemmy