diff --git a/README.md b/README.md
index 5801e8be03..e108b25411 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,10 @@
# AWS Lambda Powertools for TypeScript
-A suite of utilities for AWS Lambda functions to ease the adoption of best practices such as tracing, structured logging, custom metrics, and more.
+A suite of utilities for AWS Lambda functions to ease the adoption of best practices such as tracing, structured logging, custom metrics, and more.
+
You can use the library in both TypeScript and JavaScript code bases.
-AWS Lambda Powertools for [Python](https://github.com/awslabs/aws-lambda-powertools-python) and AWS Lambda Powertools for [Java](https://github.com/awslabs/aws-lambda-powertools-java) are also available).
+
+AWS Lambda Powertools for [Python](https://github.com/awslabs/aws-lambda-powertools-python) and AWS Lambda Powertools for [Java](https://github.com/awslabs/aws-lambda-powertools-java) are also available.
**[📜 Documentation](https://awslabs.github.io/aws-lambda-powertools-typescript/)** | **[NPM](https://www.npmjs.com/org/aws-lambda-powertools)** | **[Roadmap](https://github.com/awslabs/aws-lambda-powertools-roadmap/projects/1)** | **[Examples](https://github.com/awslabs/aws-lambda-powertools-typescript/tree/main/examples)** | **[Serverless TypeScript Demo](https://github.com/aws-samples/serverless-typescript-demo)**
@@ -65,7 +67,7 @@ If you are interested in contributing to this project, please refer to our [Cont
## Roadmap
The roadmap of Powertools is driven by customers’ demand.
-Help us prioritize upcoming functionalities or utilities by [upvoting existing RFCs and feature requests](https://github.com/awslabs/aws-lambda-powertools-typescript/issues), or [creating new ones[(https://github.com/awslabs/aws-lambda-powertools-typescript/issues/new/choose), in this GitHub repository.
+Help us prioritize upcoming functionalities or utilities by [upvoting existing RFCs and feature requests](https://github.com/awslabs/aws-lambda-powertools-typescript/issues), or [creating new ones](https://github.com/awslabs/aws-lambda-powertools-typescript/issues/new/choose), in this GitHub repository.
## Connect
@@ -78,4 +80,4 @@ Credits for the Lambda Powertools idea go to [DAZN](https://github.com/getndazn)
## License
-This library is licensed under the MIT-0 License. See the LICENSE file.
+This library is licensed under the MIT-0 License. See the [LICENSE](https://github.com/awslabs/aws-lambda-powertools-typescript/blob/main/LICENSE) file.
diff --git a/docs/Dockerfile b/docs/Dockerfile
index 7bf267f4f3..7084973a1f 100644
--- a/docs/Dockerfile
+++ b/docs/Dockerfile
@@ -1,2 +1,2 @@
FROM squidfunk/mkdocs-material
-RUN pip install mkdocs-git-revision-date-plugin
+RUN pip install mkdocs-git-revision-date-plugin mkdocs-glightbox
diff --git a/docs/core/logger.md b/docs/core/logger.md
index 520773dcc8..9aa3c8c4a8 100644
--- a/docs/core/logger.md
+++ b/docs/core/logger.md
@@ -13,6 +13,13 @@ Logger provides an opinionated logger with output structured as JSON.
* Appending additional keys to structured logs at any point in time.
* Providing a custom log formatter (Bring Your Own Formatter) to output logs in a structure compatible with your organization’s Logging RFC.
+
+
+
+
+ Logger showcase - Log attributes
+
+
## Getting started
### Installation
@@ -25,7 +32,7 @@ npm install @aws-lambda-powertools/logger
### Usage
-The `Logger` utility must always be instantiated outside of the Lambda handler. In doing this, subsequent invocations processed by the same instance of your function can reuse these resources. This saves cost by reducing function run time. In addition, `Logger` can keep track of a cold start and inject the appropriate fields into logs.
+The `Logger` utility must always be instantiated outside the Lambda handler. By doing this, subsequent invocations processed by the same instance of your function can reuse these resources. This saves cost by reducing function run time. In addition, `Logger` can keep track of a cold start and inject the appropriate fields into logs.
=== "handler.ts"
@@ -45,10 +52,10 @@ The library requires two settings. You can set them as environment variables, or
These settings will be used across all logs emitted:
-Setting | Description | Environment variable | Constructor parameter
-------------------------------------------------- |------------------------------------------------------------------------------------------------------------------| ------------------------------------------------- | -------------------------------------------------
-**Logging level** | Sets how verbose Logger should be (INFO, by default). Supported values are: `DEBUG`, `INFO`, `WARN`, `ERROR` | `LOG_LEVEL` | `logLevel`
-**Service name** | Sets the name of service of which the Lambda function is part of, that will be present across all log statements | `POWERTOOLS_SERVICE_NAME` | `serviceName`
+| Setting | Description | Environment variable | Constructor parameter |
+|-------------------|------------------------------------------------------------------------------------------------------------------|---------------------------|-----------------------|
+| **Logging level** | Sets how verbose Logger should be (INFO, by default). Supported values are: `DEBUG`, `INFO`, `WARN`, `ERROR` | `LOG_LEVEL` | `logLevel` |
+| **Service name** | Sets the name of service of which the Lambda function is part of, that will be present across all log statements | `POWERTOOLS_SERVICE_NAME` | `serviceName` |
For a **complete list** of supported environment variables, refer to [this section](./../index.md#environment-variables).
@@ -87,15 +94,15 @@ For a **complete list** of supported environment variables, refer to [this secti
Your Logger will include the following keys to your structured logging (default log formatter):
-Key | Example | Note
-------------------------------------------------- | ------------------------------------------------- | ---------------------------------------------------------------------------------
-**level**: `string` | `INFO` | Logging level set for the Lambda function"s invocation
-**message**: `string` | `Query performed to DynamoDB` | A descriptive, human-readable representation of this log item
-**sampling_rate**: `float` | `0.1` | When enabled, it prints all the logs of a percentage of invocations, e.g. 10%
-**service**: `string` | `serverlessAirline` | A unique name identifier of the service this Lambda function belongs to, by default `service_undefined`
-**timestamp**: `string` | `2011-10-05T14:48:00.000Z` | Timestamp string in simplified extended ISO format (ISO 8601)
-**xray_trace_id**: `string` | `1-5759e988-bd862e3fe1be46a994272793` | X-Ray Trace ID. This value is always presented in Lambda environment, whether [tracing is enabled](https://docs.aws.amazon.com/lambda/latest/dg/services-xray.html){target="_blank"} or not. Logger will always log this value.
-**error**: `Object` | `{ name: "Error", location: "/my-project/handler.ts:18", message: "Unexpected error #1", stack: "[stacktrace]"}` | Optional - An object containing information about the Error passed to the logger
+| Key | Example | Note |
+|-----------------------------|------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| **level**: `string` | `INFO` | Logging level set for the Lambda function"s invocation |
+| **message**: `string` | `Query performed to DynamoDB` | A descriptive, human-readable representation of this log item |
+| **sampling_rate**: `float` | `0.1` | When enabled, it prints all the logs of a percentage of invocations, e.g. 10% |
+| **service**: `string` | `serverlessAirline` | A unique name identifier of the service this Lambda function belongs to, by default `service_undefined` |
+| **timestamp**: `string` | `2011-10-05T14:48:00.000Z` | Timestamp string in simplified extended ISO format (ISO 8601) |
+| **xray_trace_id**: `string` | `1-5759e988-bd862e3fe1be46a994272793` | X-Ray Trace ID. This value is always presented in Lambda environment, whether [tracing is enabled](https://docs.aws.amazon.com/lambda/latest/dg/services-xray.html){target="_blank"} or not. Logger will always log this value. |
+| **error**: `Object` | `{ name: "Error", location: "/my-project/handler.ts:18", message: "Unexpected error #1", stack: "[stacktrace]"}` | Optional - An object containing information about the Error passed to the logger |
### Capturing Lambda context info
@@ -111,27 +118,11 @@ Key | Example
**function_arn**: `string` | `arn:aws:lambda:eu-west-1:123456789012:function:shopping-cart-api-lambda-prod-eu-west-1`
**function_request_id**: `string` | `c6af9ac6-7b61-11e6-9a41-93e812345678`
-=== "Manual"
-
- ```typescript hl_lines="7"
- import { Logger } from '@aws-lambda-powertools/logger';
-
- const logger = new Logger();
-
- export const handler = async (_event, context): Promise => {
-
- logger.addContext(context);
-
- logger.info('This is an INFO log with some context');
-
- };
- ```
-
=== "Middy Middleware"
!!! tip "Using Middy for the first time?"
You can install Middy by running `npm i @middy/core`.
- Learn more about [its usage and lifecycle in the official Middy documentation](https://github.com/middyjs/middy#usage){target="_blank"}.
+ Learn more about [its usage and lifecycle in the official Middy documentation](https://middy.js.org/docs/intro/getting-started){target="_blank"}.
```typescript hl_lines="1-2 10-11"
import { Logger, injectLambdaContext } from '@aws-lambda-powertools/logger';
@@ -167,6 +158,21 @@ Key | Example
export const myFunction = new Lambda();
export const handler = myFunction.handler;
```
+=== "Manual"
+
+ ```typescript hl_lines="7"
+ import { Logger } from '@aws-lambda-powertools/logger';
+
+ const logger = new Logger();
+
+ export const handler = async (_event, context): Promise => {
+
+ logger.addContext(context);
+
+ logger.info('This is an INFO log with some context');
+
+ };
+ ```
In each case, the printed log will look like this:
@@ -189,7 +195,7 @@ In each case, the printed log will look like this:
#### Log incoming event
-When debugging in non-production environments, you can instruct Logger to log the incoming event with the middleware/decorator parameter `logEvent` or via POWERTOOLS_LOGGER_LOG_EVENT env var set to `true`.
+When debugging in non-production environments, you can instruct Logger to log the incoming event with the middleware/decorator parameter `logEvent` or via `POWERTOOLS_LOGGER_LOG_EVENT` env var set to `true`.
???+ warning
This is disabled by default to prevent sensitive info being logged
diff --git a/docs/core/metrics.md b/docs/core/metrics.md
index 0cc7b04d1b..b2ed48ca24 100644
--- a/docs/core/metrics.md
+++ b/docs/core/metrics.md
@@ -14,6 +14,13 @@ These metrics can be visualized through [Amazon CloudWatch Console](https://cons
* Metrics are created asynchronously by the CloudWatch service. You do not need any custom stacks, and there is no impact to Lambda function latency.
* Creating a one-off metric with different dimensions.
+
+
+
+
+ Metrics showcase - Metrics Explorer
+
+
## Terminologies
If you're new to Amazon CloudWatch, there are two terminologies you must be aware of before using this utility:
@@ -26,6 +33,7 @@ If you're new to Amazon CloudWatch, there are two terminologies you must be awar
Metric terminology, visually explained
+
## Getting started
### Installation
@@ -58,10 +66,10 @@ The library requires two settings. You can set them as environment variables, or
These settings will be used across all metrics emitted:
-Setting | Description | Environment variable | Constructor parameter
-------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- | -------------------------------------------------
-**Metric namespace** | Logical container where all metrics will be placed e.g. `serverlessAirline` | `POWERTOOLS_METRICS_NAMESPACE` | `namespace`
-**Service** | Optionally, sets **service** metric dimension across all metrics e.g. `payment` | `POWERTOOLS_SERVICE_NAME` | `serviceName`
+| Setting | Description | Environment variable | Constructor parameter |
+|----------------------|---------------------------------------------------------------------------------|--------------------------------|-----------------------|
+| **Metric namespace** | Logical container where all metrics will be placed e.g. `serverlessAirline` | `POWERTOOLS_METRICS_NAMESPACE` | `namespace` |
+| **Service** | Optionally, sets **service** metric dimension across all metrics e.g. `payment` | `POWERTOOLS_SERVICE_NAME` | `serviceName` |
For a **complete list** of supported environment variables, refer to [this section](./../index.md#environment-variables).
@@ -221,7 +229,7 @@ You can add default dimensions to your metrics by passing them as parameters in
!!! tip "Using Middy for the first time?"
You can install Middy by running `npm i @middy/core`.
- Learn more about [its usage and lifecycle in the official Middy documentation](https://github.com/middyjs/middy#usage){target="_blank"}.
+ Learn more about [its usage and lifecycle in the official Middy documentation](https://middy.js.org/docs/intro/getting-started){target="_blank"}.
```typescript hl_lines="1-2 11 13"
import { Metrics, MetricUnits, logMetrics } from '@aws-lambda-powertools/metrics';
@@ -292,24 +300,24 @@ If you do not use the middleware or decorator, you have to flush your metrics ma
* Namespace is set only once (or none)
* Metric units must be [supported by CloudWatch](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html)
-#### Manually
-
-You can manually flush the metrics with `publishStoredMetrics` as follows:
+#### Middy middleware
-!!! warning
- Metrics, dimensions and namespace validation still applies.
+See below an example of how to automatically flush metrics with the Middy-compatible `logMetrics` middleware.
=== "handler.ts"
- ```typescript hl_lines="7"
- import { Metrics, MetricUnits } from '@aws-lambda-powertools/metrics';
+ ```typescript hl_lines="1-2 7 10-11"
+ import { Metrics, MetricUnits, logMetrics } from '@aws-lambda-powertools/metrics';
+ import middy from '@middy/core';
const metrics = new Metrics({ namespace: 'serverlessAirline', serviceName: 'orders' });
- export const handler = async (_event: any, _context: any): Promise => {
- metrics.addMetric('successfulBooking', MetricUnits.Count, 10);
- metrics.publishStoredMetrics();
+ const lambdaHandler = async (_event: any, _context: any): Promise => {
+ metrics.addMetric('successfulBooking', MetricUnits.Count, 1);
};
+
+ export const handler = middy(lambdaHandler)
+ .use(logMetrics(metrics));
```
=== "Example CloudWatch Logs excerpt"
@@ -321,7 +329,7 @@ You can manually flush the metrics with `publishStoredMetrics` as follows:
"Timestamp": 1592234975665,
"CloudWatchMetrics": [
{
- "Namespace": "successfulBooking",
+ "Namespace": "serverlessAirline",
"Dimensions": [
[
"service"
@@ -333,31 +341,34 @@ You can manually flush the metrics with `publishStoredMetrics` as follows:
"Unit": "Count"
}
]
- }
- ]
},
"service": "orders"
}
```
-#### Middy middleware
+#### Using the class decorator
-See below an example of how to automatically flush metrics with the Middy-compatible `logMetrics` middleware.
+!!! info
+ Decorators can only be attached to a class declaration, method, accessor, property, or parameter. Therefore, if you prefer to write your handler as a standard function rather than a Class method, check the [middleware](#using-a-middleware) or [manual](#manually) method sections instead.
+ See the [official TypeScript documentation](https://www.typescriptlang.org/docs/handbook/decorators.html) for more details.
+
+The `logMetrics` decorator of the metrics utility can be used when your Lambda handler function is implemented as method of a Class.
=== "handler.ts"
- ```typescript hl_lines="1-2 7 10-11"
- import { Metrics, MetricUnits, logMetrics } from '@aws-lambda-powertools/metrics';
- import middy from '@middy/core';
+ ```typescript hl_lines="8"
+ import { Metrics, MetricUnits } from '@aws-lambda-powertools/metrics';
+ import { LambdaInterface } from '@aws-lambda-powertools/commons';
const metrics = new Metrics({ namespace: 'serverlessAirline', serviceName: 'orders' });
- const lambdaHandler = async (_event: any, _context: any): Promise => {
- metrics.addMetric('successfulBooking', MetricUnits.Count, 1);
- };
+ export class MyFunction implements LambdaInterface {
- export const handler = middy(lambdaHandler)
- .use(logMetrics(metrics));
+ @metrics.logMetrics()
+ public async handler(_event: any, _context: any): Promise {
+ metrics.addMetric('successfulBooking', MetricUnits.Count, 1);
+ }
+ }
```
=== "Example CloudWatch Logs excerpt"
@@ -369,7 +380,7 @@ See below an example of how to automatically flush metrics with the Middy-compat
"Timestamp": 1592234975665,
"CloudWatchMetrics": [
{
- "Namespace": "serverlessAirline",
+ "Namespace": "successfulBooking",
"Dimensions": [
[
"service"
@@ -386,29 +397,24 @@ See below an example of how to automatically flush metrics with the Middy-compat
}
```
-#### Using the class decorator
+#### Manually
-!!! info
- Decorators can only be attached to a class declaration, method, accessor, property, or parameter. Therefore, if you prefer to write your handler as a standard function rather than a Class method, check the [middleware](#using-a-middleware) or [manual](#manually) method sections instead.
- See the [official TypeScript documentation](https://www.typescriptlang.org/docs/handbook/decorators.html) for more details.
+You can manually flush the metrics with `publishStoredMetrics` as follows:
-The `logMetrics` decorator of the metrics utility can be used when your Lambda handler function is implemented as method of a Class.
+!!! warning
+Metrics, dimensions and namespace validation still applies.
=== "handler.ts"
- ```typescript hl_lines="8"
+ ```typescript hl_lines="7"
import { Metrics, MetricUnits } from '@aws-lambda-powertools/metrics';
- import { LambdaInterface } from '@aws-lambda-powertools/commons';
const metrics = new Metrics({ namespace: 'serverlessAirline', serviceName: 'orders' });
- export class MyFunction implements LambdaInterface {
-
- @metrics.logMetrics()
- public async handler(_event: any, _context: any): Promise {
- metrics.addMetric('successfulBooking', MetricUnits.Count, 1);
- }
- }
+ export const handler = async (_event: any, _context: any): Promise => {
+ metrics.addMetric('successfulBooking', MetricUnits.Count, 10);
+ metrics.publishStoredMetrics();
+ };
```
=== "Example CloudWatch Logs excerpt"
@@ -432,6 +438,8 @@ The `logMetrics` decorator of the metrics utility can be used when your Lambda h
"Unit": "Count"
}
]
+ }
+ ]
},
"service": "orders"
}
diff --git a/docs/core/tracer.md b/docs/core/tracer.md
index f613e9731e..8a2b798e18 100644
--- a/docs/core/tracer.md
+++ b/docs/core/tracer.md
@@ -13,7 +13,12 @@ Tracer is an opinionated thin wrapper for [AWS X-Ray SDK for Node.js](https://gi
* Supporting tracing AWS SDK v2 and v3 via AWS X-Ray SDK for Node.js.
* Auto-disable tracing when not running in the Lambda environment.
-
+
+
+
+
+ Tracer showcase - Handler Annotations
+
## Getting started
@@ -92,45 +97,12 @@ The `Tracer` utility is instantiated outside of the Lambda handler. In doing thi
You can quickly start by importing the `Tracer` class, initialize it outside the Lambda handler, and instrument your function.
-=== "Manual"
-
- ```typescript hl_lines="6 8-9 12-13 19 22 26 28"
- import { Tracer } from '@aws-lambda-powertools/tracer';
-
- const tracer = new Tracer({ serviceName: 'serverlessAirline' });
-
- export const handler = async (_event: any, context: any): Promise => {
- const segment = tracer.getSegment(); // This is the facade segment (the one that is created by AWS Lambda)
- // Create subsegment for the function & set it as active
- const subsegment = segment.addNewSubsegment(`## ${process.env._HANDLER}`);
- tracer.setSegment(subsegment);
-
- // Annotate the subsegment with the cold start & serviceName
- tracer.annotateColdStart();
- tracer.addServiceNameAnnotation();
-
- let res;
- try {
- /* ... */
- // Add the response as metadata
- tracer.addResponseAsMetadata(res, process.env._HANDLER);
- } catch (err) {
- // Add the error as metadata
- tracer.addErrorAsMetadata(err as Error);
- throw err;
- } finally {
- // Close subsegment (the AWS Lambda one is closed automatically)
- subsegment.close();
- // Set back the facade segment as active again
- tracer.setSegment(segment);
- }
-
- return res;
- };
- ```
-
=== "Middy Middleware"
+ !!! tip "Using Middy for the first time?"
+ You can install Middy by running `npm i @middy/core`.
+ Learn more about [its usage and lifecycle in the official Middy documentation](https://middy.js.org/docs/intro/getting-started){target="_blank"}.
+
```typescript hl_lines="1-2 11 13"
import { Tracer, captureLambdaHandler } from '@aws-lambda-powertools/tracer';
import middy from '@middy/core'; // (1)
@@ -173,6 +145,43 @@ You can quickly start by importing the `Tracer` class, initialize it outside the
export const handlerClass = new Lambda();
export const handler = handlerClass.handler;
```
+=== "Manual"
+
+ ```typescript hl_lines="6 8-9 12-13 19 22 26 28"
+ import { Tracer } from '@aws-lambda-powertools/tracer';
+
+ const tracer = new Tracer({ serviceName: 'serverlessAirline' });
+
+ export const handler = async (_event: any, context: any): Promise => {
+ const segment = tracer.getSegment(); // This is the facade segment (the one that is created by AWS Lambda)
+ // Create subsegment for the function & set it as active
+ const subsegment = segment.addNewSubsegment(`## ${process.env._HANDLER}`);
+ tracer.setSegment(subsegment);
+
+ // Annotate the subsegment with the cold start & serviceName
+ tracer.annotateColdStart();
+ tracer.addServiceNameAnnotation();
+
+ let res;
+ try {
+ /* ... */
+ // Add the response as metadata
+ tracer.addResponseAsMetadata(res, process.env._HANDLER);
+ } catch (err) {
+ // Add the error as metadata
+ tracer.addErrorAsMetadata(err as Error);
+ throw err;
+ } finally {
+ // Close subsegment (the AWS Lambda one is closed automatically)
+ subsegment.close();
+ // Set back the facade segment as active again
+ tracer.setSegment(segment);
+ }
+
+ return res;
+ };
+ ```
+
When using the `captureLambdaHandler` decorator or middleware, Tracer performs these additional tasks to ease operations:
@@ -213,10 +222,39 @@ When using the `captureLambdaHandler` decorator or middleware, Tracer performs t
};
```
+
+
+ Tracer showcase - Handler Metadata
+
+
### Methods
You can trace other Class methods using the `captureMethod` decorator or any arbitrary function using manual instrumentation.
+=== "Decorator"
+
+ ```typescript hl_lines="8"
+ import { Tracer } from '@aws-lambda-powertools/tracer';
+ import { LambdaInterface } from '@aws-lambda-powertools/commons';
+
+ const tracer = new Tracer({ serviceName: 'serverlessAirline' });
+
+ class Lambda implements LambdaInterface {
+ // Decorate your class method
+ @tracer.captureMethod()
+ public getChargeId(): string {
+ /* ... */
+ return 'foo bar';
+ }
+
+ public async handler(_event: any, _context: any): Promise {
+ /* ... */
+ }
+ }
+
+ export const myFunction = new Lambda();
+ export const handler = myFunction.handler;
+ ```
=== "Manual"
```typescript hl_lines="6 8-9 15 18 23 25"
@@ -256,30 +294,6 @@ You can trace other Class methods using the `captureMethod` decorator or any arb
};
```
-=== "Decorator"
-
- ```typescript hl_lines="8"
- import { Tracer } from '@aws-lambda-powertools/tracer';
- import { LambdaInterface } from '@aws-lambda-powertools/commons';
-
- const tracer = new Tracer({ serviceName: 'serverlessAirline' });
-
- class Lambda implements LambdaInterface {
- // Decorate your class method
- @tracer.captureMethod()
- public getChargeId(): string {
- /* ... */
- return 'foo bar';
- }
-
- public async handler(_event: any, _context: any): Promise {
- /* ... */
- }
- }
-
- export const myFunction = new Lambda();
- export const handler = myFunction.handler;
- ```
### Patching AWS SDK clients
diff --git a/docs/index.md b/docs/index.md
index 1fc986ce70..7e799cb193 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -4,6 +4,7 @@ description: AWS Lambda Powertools for TypeScript
---
AWS Lambda Powertools for TypeScript provides a suite of utilities for AWS Lambda functions running on the Node.js runtime, to ease the adoption of best practices such as tracing, structured logging, custom metrics, and more.
+
You can use the library in both TypeScript and JavaScript code bases.
## Tenets
@@ -36,6 +37,7 @@ Install all three core utilities at once with this single command:
npm install @aws-lambda-powertools/logger @aws-lambda-powertools/tracer @aws-lambda-powertools/metrics
```
+
Or refer to the installation guide of each utility:
[Installation guide for the **Tracer** utility](./core/tracer.md#getting-started)
@@ -49,8 +51,10 @@ Or refer to the installation guide of each utility:
You can instrument your code with Powertools in three different ways:
* **Middy** middleware. It is the best choice if your existing code base relies on the [Middy](https://middy.js.org/docs/) middleware engine. Powertools offers compatible Middy middleware to make this integration seamless.
-* **Method decorator**. Use [TypeScript method decorators](https://www.typescriptlang.org/docs/handbook/decorators.html#method-decorators) if you prefer writing your business logic using TypeScript Classes. If you aren’t using Classes, this requires the most significant refactoring.
-* **Manually**. It provides the most granular control. It’s the most verbose approach, with the added benefit of no additional dependency and no refactoring to [TypeScript Classes](https://www.typescriptlang.org/docs/handbook/classes.html).
+* **Method decorator**. Use [TypeScript method decorators](https://www.typescriptlang.org/docs/handbook/decorators.html#method-decorators) if you prefer writing your business logic using [TypeScript Classes](https://www.typescriptlang.org/docs/handbook/classes.html). If you aren’t using Classes, this requires the most significant refactoring.
+* **Manually**. It provides the most granular control. It’s the most verbose approach, with the added benefit of no additional dependency and no refactoring to TypeScript Classes.
+
+The examples in this documentation will feature all the approaches described above, when applicable.
## Environment variables
@@ -79,11 +83,25 @@ You can instrument your code with Powertools in three different ways:
The [Serverless TypeScript Demo](https://github.com/aws-samples/serverless-typescript-demo) shows how to use Lambda Powertools for TypeScript.
You can find instructions on how to deploy and load test this application in the [repository](https://github.com/aws-samples/serverless-typescript-demo).
-## Credits
+## Contribute
+
+If you are interested in contributing to this project, please refer to our [Contributing Guidelines](https://github.com/awslabs/aws-lambda-powertools-typescript/blob/main/CONTRIBUTING.md).
+
+## Roadmap
-* Credits for the Lambda Powertools idea go to [DAZN](https://github.com/getndazn){target="_blank"} and their [DAZN Lambda Powertools](https://github.com/getndazn/dazn-lambda-powertools/){target="_blank"}.
+The roadmap of Powertools is driven by customers’ demand.
+Help us prioritize upcoming functionalities or utilities by [upvoting existing RFCs and feature requests](https://github.com/awslabs/aws-lambda-powertools-typescript/issues), or [creating new ones](https://github.com/awslabs/aws-lambda-powertools-typescript/issues/new/choose), in this GitHub repository.
## Connect
* **AWS Developers Slack**: `#lambda-powertools` - [Invite, if you don't have an account](https://join.slack.com/t/awsdevelopers/shared_invite/zt-yryddays-C9fkWrmguDv0h2EEDzCqvw){target="_blank"}
* **Email**: aws-lambda-powertools-feedback@amazon.com
+
+## Credits
+
+Credits for the Lambda Powertools idea go to [DAZN](https://github.com/getndazn){target="_blank"} and their [DAZN Lambda Powertools](https://github.com/getndazn/dazn-lambda-powertools/){target="_blank"}.
+
+## License
+
+This library is licensed under the MIT-0 License. See the [LICENSE](https://github.com/awslabs/aws-lambda-powertools-typescript/blob/main/LICENSE) file.
+
diff --git a/docs/media/logger_utility_showcase.png b/docs/media/logger_utility_showcase.png
new file mode 100644
index 0000000000..2421690dec
Binary files /dev/null and b/docs/media/logger_utility_showcase.png differ
diff --git a/docs/media/metrics_utility_showcase.png b/docs/media/metrics_utility_showcase.png
new file mode 100644
index 0000000000..265d6042e2
Binary files /dev/null and b/docs/media/metrics_utility_showcase.png differ
diff --git a/docs/media/tracer_utility_showcase.png b/docs/media/tracer_utility_showcase.png
index 55d7d5d0bf..2d0763a156 100644
Binary files a/docs/media/tracer_utility_showcase.png and b/docs/media/tracer_utility_showcase.png differ
diff --git a/docs/media/tracer_utility_showcase_2.png b/docs/media/tracer_utility_showcase_2.png
new file mode 100644
index 0000000000..5e78e760a2
Binary files /dev/null and b/docs/media/tracer_utility_showcase_2.png differ
diff --git a/docs/requirements.txt b/docs/requirements.txt
index af763ebab6..33e6747563 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -1,3 +1,4 @@
mike==1.1.2
mkdocs-material==8.3.6
mkdocs-git-revision-date-plugin==0.3.2
+mkdocs-glightbox==0.1.6
\ No newline at end of file
diff --git a/mkdocs.yml b/mkdocs.yml
index def0989f10..6b429558d9 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -75,6 +75,7 @@ copyright: Copyright © 2022 Amazon Web Services
plugins:
- git-revision-date
- search
+ - glightbox
extra_css:
- stylesheets/extra.css
diff --git a/packages/logger/README.md b/packages/logger/README.md
index 5801e8be03..c9df4fb55e 100644
--- a/packages/logger/README.md
+++ b/packages/logger/README.md
@@ -1,8 +1,10 @@
# AWS Lambda Powertools for TypeScript
-A suite of utilities for AWS Lambda functions to ease the adoption of best practices such as tracing, structured logging, custom metrics, and more.
+A suite of utilities for AWS Lambda functions to ease the adoption of best practices such as tracing, structured logging, custom metrics, and more.
+
You can use the library in both TypeScript and JavaScript code bases.
-AWS Lambda Powertools for [Python](https://github.com/awslabs/aws-lambda-powertools-python) and AWS Lambda Powertools for [Java](https://github.com/awslabs/aws-lambda-powertools-java) are also available).
+
+AWS Lambda Powertools for [Python](https://github.com/awslabs/aws-lambda-powertools-python) and AWS Lambda Powertools for [Java](https://github.com/awslabs/aws-lambda-powertools-java) are also available.
**[📜 Documentation](https://awslabs.github.io/aws-lambda-powertools-typescript/)** | **[NPM](https://www.npmjs.com/org/aws-lambda-powertools)** | **[Roadmap](https://github.com/awslabs/aws-lambda-powertools-roadmap/projects/1)** | **[Examples](https://github.com/awslabs/aws-lambda-powertools-typescript/tree/main/examples)** | **[Serverless TypeScript Demo](https://github.com/aws-samples/serverless-typescript-demo)**
@@ -65,7 +67,7 @@ If you are interested in contributing to this project, please refer to our [Cont
## Roadmap
The roadmap of Powertools is driven by customers’ demand.
-Help us prioritize upcoming functionalities or utilities by [upvoting existing RFCs and feature requests](https://github.com/awslabs/aws-lambda-powertools-typescript/issues), or [creating new ones[(https://github.com/awslabs/aws-lambda-powertools-typescript/issues/new/choose), in this GitHub repository.
+Help us prioritize upcoming functionalities or utilities by [upvoting existing RFCs and feature requests](https://github.com/awslabs/aws-lambda-powertools-typescript/issues), or [creating new ones](https://github.com/awslabs/aws-lambda-powertools-typescript/issues/new/choose), in this GitHub repository.
## Connect
@@ -78,4 +80,4 @@ Credits for the Lambda Powertools idea go to [DAZN](https://github.com/getndazn)
## License
-This library is licensed under the MIT-0 License. See the LICENSE file.
+This library is licensed under the MIT-0 License. See the LICENSE file.
\ No newline at end of file
diff --git a/packages/metrics/README.md b/packages/metrics/README.md
index 5801e8be03..ee693b3eb9 100644
--- a/packages/metrics/README.md
+++ b/packages/metrics/README.md
@@ -1,8 +1,10 @@
# AWS Lambda Powertools for TypeScript
-A suite of utilities for AWS Lambda functions to ease the adoption of best practices such as tracing, structured logging, custom metrics, and more.
+A suite of utilities for AWS Lambda functions to ease the adoption of best practices such as tracing, structured logging, custom metrics, and more.
+
You can use the library in both TypeScript and JavaScript code bases.
-AWS Lambda Powertools for [Python](https://github.com/awslabs/aws-lambda-powertools-python) and AWS Lambda Powertools for [Java](https://github.com/awslabs/aws-lambda-powertools-java) are also available).
+
+AWS Lambda Powertools for [Python](https://github.com/awslabs/aws-lambda-powertools-python) and AWS Lambda Powertools for [Java](https://github.com/awslabs/aws-lambda-powertools-java) are also available.
**[📜 Documentation](https://awslabs.github.io/aws-lambda-powertools-typescript/)** | **[NPM](https://www.npmjs.com/org/aws-lambda-powertools)** | **[Roadmap](https://github.com/awslabs/aws-lambda-powertools-roadmap/projects/1)** | **[Examples](https://github.com/awslabs/aws-lambda-powertools-typescript/tree/main/examples)** | **[Serverless TypeScript Demo](https://github.com/aws-samples/serverless-typescript-demo)**
@@ -65,7 +67,7 @@ If you are interested in contributing to this project, please refer to our [Cont
## Roadmap
The roadmap of Powertools is driven by customers’ demand.
-Help us prioritize upcoming functionalities or utilities by [upvoting existing RFCs and feature requests](https://github.com/awslabs/aws-lambda-powertools-typescript/issues), or [creating new ones[(https://github.com/awslabs/aws-lambda-powertools-typescript/issues/new/choose), in this GitHub repository.
+Help us prioritize upcoming functionalities or utilities by [upvoting existing RFCs and feature requests](https://github.com/awslabs/aws-lambda-powertools-typescript/issues), or [creating new ones](https://github.com/awslabs/aws-lambda-powertools-typescript/issues/new/choose), in this GitHub repository.
## Connect
diff --git a/packages/tracer/README.md b/packages/tracer/README.md
index 5801e8be03..ee693b3eb9 100644
--- a/packages/tracer/README.md
+++ b/packages/tracer/README.md
@@ -1,8 +1,10 @@
# AWS Lambda Powertools for TypeScript
-A suite of utilities for AWS Lambda functions to ease the adoption of best practices such as tracing, structured logging, custom metrics, and more.
+A suite of utilities for AWS Lambda functions to ease the adoption of best practices such as tracing, structured logging, custom metrics, and more.
+
You can use the library in both TypeScript and JavaScript code bases.
-AWS Lambda Powertools for [Python](https://github.com/awslabs/aws-lambda-powertools-python) and AWS Lambda Powertools for [Java](https://github.com/awslabs/aws-lambda-powertools-java) are also available).
+
+AWS Lambda Powertools for [Python](https://github.com/awslabs/aws-lambda-powertools-python) and AWS Lambda Powertools for [Java](https://github.com/awslabs/aws-lambda-powertools-java) are also available.
**[📜 Documentation](https://awslabs.github.io/aws-lambda-powertools-typescript/)** | **[NPM](https://www.npmjs.com/org/aws-lambda-powertools)** | **[Roadmap](https://github.com/awslabs/aws-lambda-powertools-roadmap/projects/1)** | **[Examples](https://github.com/awslabs/aws-lambda-powertools-typescript/tree/main/examples)** | **[Serverless TypeScript Demo](https://github.com/aws-samples/serverless-typescript-demo)**
@@ -65,7 +67,7 @@ If you are interested in contributing to this project, please refer to our [Cont
## Roadmap
The roadmap of Powertools is driven by customers’ demand.
-Help us prioritize upcoming functionalities or utilities by [upvoting existing RFCs and feature requests](https://github.com/awslabs/aws-lambda-powertools-typescript/issues), or [creating new ones[(https://github.com/awslabs/aws-lambda-powertools-typescript/issues/new/choose), in this GitHub repository.
+Help us prioritize upcoming functionalities or utilities by [upvoting existing RFCs and feature requests](https://github.com/awslabs/aws-lambda-powertools-typescript/issues), or [creating new ones](https://github.com/awslabs/aws-lambda-powertools-typescript/issues/new/choose), in this GitHub repository.
## Connect