Skip to content

Commit c0b0746

Browse files
committed
Merge remote-tracking branch 'origin/main' into chore/cicd/examplesTests
2 parents 74d4abe + 697a775 commit c0b0746

File tree

25 files changed

+1118
-786
lines changed

25 files changed

+1118
-786
lines changed

.husky/pre-push

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4+
npm run lerna-lint
45
npm run test

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# AWS Lambda Powertools TypeScript
1+
# AWS Lambda Powertools (TypeScript)
22

33
| ⚠️ **WARNING: Do not use this library in production** ⚠️ |
44
|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
@@ -11,13 +11,12 @@ A suite of TypeScript utilities for AWS Lambda functions to ease adopting best p
1111

1212
> **An AWS Developer Acceleration (DevAx) initiative by Specialist Solution Architects | aws-devax-open-source@amazon.com**
1313
14-
### Features
14+
## Features
1515

1616
* **[Tracer](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/tracer/)** - Utilities to trace Lambda function handlers, and both synchronous and asynchronous functions
1717
* **[Logger](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/logger/)** - Structured logging made easier, and a middleware to enrich log items with key details of the Lambda context
1818
* **[Metrics](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/metrics/)** - Custom Metrics created asynchronously via CloudWatch Embedded Metric Format (EMF)
1919

20-
2120
## Getting started
2221

2322
Find the complete project's [documentation here](https://awslabs.github.io/aws-lambda-powertools-typescript).
@@ -36,20 +35,19 @@ Each TypeScript utility is installed as standalone NPM package.
3635
### Examples
3736

3837
* [CDK](https://github.com/awslabs/aws-lambda-powertools-typescript/tree/main/examples/cdk)
39-
* [Tracer](https://github.com/awslabs/aws-lambda-powertools-typescript/tree/main/packages/tracing/examples)
38+
* [Tracer](https://github.com/awslabs/aws-lambda-powertools-typescript/tree/main/examples/cdk/lib)
4039
* [Logger](https://github.com/awslabs/aws-lambda-powertools-typescript/tree/main/packages/logger/examples)
4140
* [Metrics](https://github.com/awslabs/aws-lambda-powertools-typescript/tree/main/packages/metrics/examples)
4241

4342
## Credits
4443

4544
* Credits for the Lambda Powertools idea go to [DAZN](https://github.com/getndazn) and their [DAZN Lambda Powertools](https://github.com/getndazn/dazn-lambda-powertools/).
4645

47-
4846
## Connect
4947

50-
* **AWS Developers Slack**: `#lambda-powertools`** - **[Invite, if you don't have an account](https://join.slack.com/t/awsdevelopers/shared_invite/zt-yryddays-C9fkWrmguDv0h2EEDzCqvw)**
48+
* **AWS Developers Slack**: `#lambda-powertools` - **[Invite, if you don't have an account](https://join.slack.com/t/awsdevelopers/shared_invite/zt-yryddays-C9fkWrmguDv0h2EEDzCqvw)**
5149
* **Email**: aws-lambda-powertools-feedback@amazon.com
5250

5351
## License
5452

55-
This library is licensed under the MIT-0 License. See the LICENSE file.
53+
This library is licensed under the MIT-0 License. See the LICENSE file.

docs/core/metrics.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,12 @@ You can flush metrics automatically using one of the following methods:
274274
* [Middy-compatible](https://github.com/middyjs/middy){target=_blank} middleware
275275
* class decorator
276276

277-
Using the Middy middleware or decorator will **automatically validate, serialize, and flush** all your metrics. During metrics validation, if no metrics are provided then a warning will be logged, but no exception will be raised.
277+
Using the Middy middleware or decorator will **automatically validate, serialize, and flush** all your metrics. During metrics validation, if no metrics are provided then a warning will be logged, but no exception will be thrown.
278278
If you do not use the middleware or decorator, you have to flush your metrics manually.
279279

280280

281281
!!! warning "Metric validation"
282-
If metrics are provided, and any of the following criteria are not met, a **`RangeError`** exception will be raised:
282+
If metrics are provided, and any of the following criteria are not met, a **`RangeError`** exception will be thrown:
283283

284284
* Maximum of 9 dimensions
285285
* Namespace is set only once (or none)
@@ -433,7 +433,7 @@ The `logMetrics` decorator of the metrics utility can be used when your Lambda h
433433

434434
#### Throwing a RangeError when no metrics are emitted
435435

436-
If you want to ensure that at least one metric is emitted before you flush them, you can use the `raiseOnEmptyMetrics` parameter and pass it to the middleware or decorator:
436+
If you want to ensure that at least one metric is emitted before you flush them, you can use the `throwOnEmptyMetrics` parameter and pass it to the middleware or decorator:
437437

438438
```typescript hl_lines="11"
439439
import { Metrics, MetricUnits, logMetrics } from '@aws-lambda-powertools/metrics';
@@ -446,7 +446,7 @@ If you want to ensure that at least one metric is emitted before you flush them,
446446
}
447447

448448
export const handler = middy(lambdaHandler)
449-
.use(logMetrics(metrics, { raiseOnEmptyMetrics: true }));
449+
.use(logMetrics(metrics, { throwOnEmptyMetrics: true }));
450450
```
451451

452452
### Capturing a cold start invocation as metric

docs/index.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ Each TypeScript utility is installed as standalone NPM package.
4545

4646
[Installation guide for the **Metrics** utility](./core/metrics.md#getting-started)
4747

48-
4948
## Environment variables
5049

5150
!!! info
@@ -63,19 +62,17 @@ Each TypeScript utility is installed as standalone NPM package.
6362
| **POWERTOOLS_LOG_DEDUPLICATION_DISABLED** | Disables log deduplication filter protection to use Pytest Live Log feature | [Logger](./core/logger) | `false` |
6463
| **LOG_LEVEL** | Sets logging level | [Logger](./core/logger) | `INFO` |
6564

66-
6765
## Examples
6866

6967
* [CDK](https://github.com/awslabs/aws-lambda-powertools-typescript/tree/main/examples/cdk){target="_blank"}
70-
* [Tracer](https://github.com/awslabs/aws-lambda-powertools-typescript/tree/main/packages/tracing/examples){target="_blank"}
68+
* [Tracer](https://github.com/awslabs/aws-lambda-powertools-typescript/tree/main/examples/cdk/lib){target="_blank"}
7169
* [Logger](https://github.com/awslabs/aws-lambda-powertools-typescript/tree/main/packages/logger/examples){target="_blank"}
7270
* [Metrics](https://github.com/awslabs/aws-lambda-powertools-typescript/tree/main/packages/metrics/examples){target="_blank"}
7371

7472
## Credits
7573

7674
* 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"}.
7775

78-
7976
## Connect
8077

8178
* **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"}

examples/cdk/lib/example-function.MyFunction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const handler = async (event: unknown, context: Context): Promise<void> =
3434

3535
// ### Experiment with Metrics
3636
metrics.captureColdStartMetric();
37-
metrics.raiseOnEmptyMetrics();
37+
metrics.throwOnEmptyMetrics();
3838
metrics.setDefaultDimensions({ environment: 'example', type: 'standardFunction' });
3939
metrics.addMetric('test-metric', MetricUnits.Count, 10);
4040

package-lock.json

Lines changed: 77 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
"devDependencies": {
4646
"@types/aws-lambda": "^8.10.72",
4747
"@types/jest": "^27.0.0",
48-
"@types/lodash": "^4.14.168",
4948
"@types/node": "^17.0.0",
5049
"@typescript-eslint/eslint-plugin": "^5.5.0",
5150
"@typescript-eslint/parser": "^5.5.0",

packages/commons/README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# AWS Lambda Powertools TypeScript
1+
# AWS Lambda Powertools (TypeScript)
22

33
| ⚠️ **WARNING: Do not use this library in production** ⚠️ |
44
|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
@@ -11,13 +11,12 @@ A suite of TypeScript utilities for AWS Lambda functions to ease adopting best p
1111

1212
> **An AWS Developer Acceleration (DevAx) initiative by Specialist Solution Architects | aws-devax-open-source@amazon.com**
1313
14-
### Features
14+
## Features
1515

1616
* **[Tracer](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/tracer/)** - Utilities to trace Lambda function handlers, and both synchronous and asynchronous functions
1717
* **[Logger](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/logger/)** - Structured logging made easier, and a middleware to enrich log items with key details of the Lambda context
1818
* **[Metrics](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/metrics/)** - Custom Metrics created asynchronously via CloudWatch Embedded Metric Format (EMF)
1919

20-
2120
## Getting started
2221

2322
Find the complete project's [documentation here](https://awslabs.github.io/aws-lambda-powertools-typescript).
@@ -44,10 +43,9 @@ Each TypeScript utility is installed as standalone NPM package.
4443

4544
* Credits for the Lambda Powertools idea go to [DAZN](https://github.com/getndazn) and their [DAZN Lambda Powertools](https://github.com/getndazn/dazn-lambda-powertools/).
4645

47-
4846
## Connect
4947

50-
* **AWS Developers Slack**: `#lambda-powertools`** - **[Invite, if you don't have an account](https://join.slack.com/t/awsdevelopers/shared_invite/zt-yryddays-C9fkWrmguDv0h2EEDzCqvw)**
48+
* **AWS Developers Slack**: `#lambda-powertools`- **[Invite, if you don't have an account](https://join.slack.com/t/awsdevelopers/shared_invite/zt-yryddays-C9fkWrmguDv0h2EEDzCqvw)**
5149
* **Email**: aws-lambda-powertools-feedback@amazon.com
5250

5351
## License

packages/logger/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# AWS Lambda Powertools TypeScript
1+
# AWS Lambda Powertools (TypeScript)
22

33
| ⚠️ **WARNING: Do not use this library in production** ⚠️ |
44
|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
@@ -11,7 +11,7 @@ A suite of TypeScript utilities for AWS Lambda functions to ease adopting best p
1111

1212
> **An AWS Developer Acceleration (DevAx) initiative by Specialist Solution Architects | aws-devax-open-source@amazon.com**
1313
14-
### Features
14+
## Features
1515

1616
* **[Tracer](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/tracer/)** - Utilities to trace Lambda function handlers, and both synchronous and asynchronous functions
1717
* **[Logger](https://awslabs.github.io/aws-lambda-powertools-typescript/latest/core/logger/)** - Structured logging made easier, and a middleware to enrich log items with key details of the Lambda context
@@ -44,10 +44,9 @@ Each TypeScript utility is installed as standalone NPM package.
4444

4545
* Credits for the Lambda Powertools idea go to [DAZN](https://github.com/getndazn) and their [DAZN Lambda Powertools](https://github.com/getndazn/dazn-lambda-powertools/).
4646

47-
4847
## Connect
4948

50-
* **AWS Developers Slack**: `#lambda-powertools`** - **[Invite, if you don't have an account](https://join.slack.com/t/awsdevelopers/shared_invite/zt-yryddays-C9fkWrmguDv0h2EEDzCqvw)**
49+
* **AWS Developers Slack**: `#lambda-powertools`- **[Invite, if you don't have an account](https://join.slack.com/t/awsdevelopers/shared_invite/zt-yryddays-C9fkWrmguDv0h2EEDzCqvw)**
5150
* **Email**: aws-lambda-powertools-feedback@amazon.com
5251

5352
## License

0 commit comments

Comments
 (0)