Skip to content

Commit 3b99263

Browse files
dreamorosierikayao93antstanleyam29dshdq
authored
feat!: add ESM support & logger extensibility (#2117)
* feat(logger): Support for external observability providers (#1511) * Updated formatAttributes for additional parameters and LogItem return type * Updated the unit tests to pass with new formatter * Updated Powertool named objects to Powertools * Updated tests to match new naming consistency * Updated for tests for new naming consistency * Updated formatter for new design decisions * Update Logger for ephemeral attributes * Update bringYourOwnFormatter documentation to match new formatter --------- Co-authored-by: erikayao93 <[email protected]> * chore(logger): PowertoolsLogFormatter docstring and variable naming update (#1585) * Updated formatAttributes for additional parameters and LogItem return type * Updated the unit tests to pass with new formatter * Updated Powertool named objects to Powertools * Updated tests to match new naming consistency * Updated for tests for new naming consistency * Updated formatter for new design decisions * Update Logger for ephemeral attributes * Update bringYourOwnFormatter documentation to match new formatter * Fixed incorrect return type, renamed variable for consistency * feat(logger): Support for external observability providers (#1511) * Updated formatAttributes for additional parameters and LogItem return type * Updated the unit tests to pass with new formatter * Updated Powertool named objects to Powertools * Updated tests to match new naming consistency * Updated for tests for new naming consistency * Updated formatter for new design decisions * Update Logger for ephemeral attributes * Update bringYourOwnFormatter documentation to match new formatter --------- Co-authored-by: erikayao93 <[email protected]> * chore(logger): PowertoolsLogFormatter docstring and variable naming update (#1585) * Updated formatAttributes for additional parameters and LogItem return type * Updated the unit tests to pass with new formatter * Updated Powertool named objects to Powertools * Updated tests to match new naming consistency * Updated for tests for new naming consistency * Updated formatter for new design decisions * Update Logger for ephemeral attributes * Update bringYourOwnFormatter documentation to match new formatter * Fixed incorrect return type, renamed variable for consistency * chore(maintenance): bump dependencies & drop nodejs14x (#1687) * chore: update release script to mark all utilities as alpha * chore: restore version to ease conflicts * chore: release version change * chore: release version change * chore(maintenance): remove `createLogger` and `createTracer` helpers (#1722) * chore(maintenance): bump dependencies & drop nodejs14x (#1687) * chore: add pre-release script * chore: restore deps * chore: added v2 shim * chore(maintenance): remove logger and tracer helper function * chore: remove imports * chore: fix deps & versions * tests: moved unit tests * tests: move logger tests * chore: added v2 shim * chore: added v2 shim * feat(logger): add esmodule support (#1734) * feat(logger): add esm build output * fix(Logger): Remove barrel files update references * test(Logger): update jest/ts-jest to use ESM * chore(Logger): remove unused lodash.merge * fix(logger): reinstate lodash.merge * chore(logger): revert TS assertion * chore(logger): revert format changes * chore(logger): update postbuild to remove incremental tsbuildinfo files * fix(logger): correct reference to types output * feat(logging): add middleware export * chore(logger): replace postbuild script with echo statement * feat(logger): add typesVersions property and barrel files to /types * chore(logger): file not used, can be added back if needed * chore(logger): add space back to README * chore(logger): revert space in README * feat(commons): add esmodule support (#1735) * chore(logger): adapt logger to commons exports * feat(commons): add esmodule support * chore: address sonar findings * chore(commons): exported version * chore: fixed imports in examples * chore(parameters): fixed imports * chore(metrics): fixed imports * chore(tracer): fixed imports * chore(idempotency): fixed imports * chore(commons): test coverage * chore(batch): fix imports * feat(parameters): add esmodule support (#1736) * feat(batch): add esmodule support (#1737) * feat(internal): add esmodule support (#1738) * feat(testing): add esmodule support * chore(all): update imports * feat(metrics): add esmodule support (#1739) * feat(tracer): add esmodule support (#1741) * feat(tracer): add esmodule support * chore(docs): update imports * feat(idempotency): add esmodule support (#1743) * feat(idempotency): add esmodule support * chore(metrics): fix import * chore(ci): v2 release line * chore(ci): fix alpha versioning pre-release * docs(maintenance): add processes tab (#1747) * docs(maintenance): update mkdocs to support tabs * chore(ci): add parallel test npm script * chore(ci): add jest command * docs(maintenance): add testing page to navbar * docs(maintenance): add contributing info * chore: update roadmap * chore: update release drafter workflow to allow for manual trigger * fix formatting * docs: maintainers handbook * chore: link to new location * fix links * Update docs/maintainers.md Co-authored-by: Alexander Schueren <[email protected]> --------- Co-authored-by: Alexander Schueren <[email protected]> * chore(docs): add invisible unicode char to decorator docs (#1755) * chore: remove extra comma * chore(docs): upgrade doc intro * feat(logger): align sampling debug logs feature implementation with the other runtimes (#1744) * test(logger): remove logsSampled field, add default sampleRateValue * test(logger): add tests for sampling debug logs feature * feat(logger): change implementation to make sampling decision at per-function level * refactor(logger): remove redundant createLogger method * refactor(logger): remove getSampleRateValue method * test(logger): improve tests * refactor(logger): return createLogger() back with the detailed comment of the method importance * test(logger): add constructor/custom config/env var priority tests for sampling rate feature, improve description * refactor(logger): address review comments * feat(logger): add refreshSampleRateCalculation method and tests * test(logger): adjust end-to-end tests * chore(logger): refactor types and interfaces (#1758) * chore(logger): refactor types and interfaces * chore: grouped type files * chore: fix code smell * chore: fix ci * chore: fix ci * chore(maintenance): bump Middy v4 & run tests (#1760) * chore(parameters): fix esm bundling * chore(parameters): change declare client param * chore(layers) widen version check in e2e * chore(maintenance): enable `isolatedModules` and isolate cache (#1765) * chore(layers) widen version check in e2e * chore(maintenance): enable isolatedModules * chore: remove redundant comments from tsconfig * chore: changed path of tsbuild cache * fix: idempotency types * build(maintenance): bump aws sdk dev dependencies * chore(parameters): add export types * chore(logger): set default UTC timezone (#1775) * chore(parameters): add export types * chore(logger): set default utc timezone * chore(logger): pass down envvarsservice to log formatter * fix(metrics): deduplicate dimensions when serialising (#1780) * fix: deduplicate dimensions when serializing * fix tests * remove tsbuildinfo * remove whitespace * fix gitignore again * play some sonar games * fix test * chore(release): v1.14.2 [skip ci] * feat(metrics): log directly to stdout (#1786) * chore(commons): move isDevMode to commons * chore(logger): move isDev config out of logger to commons * feat(metrics): use own console object by default * tests(layers): fix unit tests * feat(maintenance): add support for nodejs20.x runtime (#1790) * feat(maintenance): support nodejs20.x runtime * tests(metrics): fix object ordering in tests * build(testing): bump cdk * build(maintenance): revert aws-cdk-lib to support nodejs14 * tests(maintenance): set runtime with family * chore(docs): patch runtime in cdk * chore(docs): patch runtime in cdk * chore(maintenance): increment version in commons ahead of release * chore(commons): simplify config service interface * chore(release): v1.15.0 [skip ci] * feat(logger): add support for `AWS_LAMBDA_LOG_LEVEL` and `POWERTOOLS_LOG_LEVEL` (#1795) * feat(logger): support advanced logging * docs(logger): add alc info * feat(logger): support alc * docs: fix alc docs links * tests(logger): add unit tests for the feature * docs(logger): make POWERTOOLS_LOG_LEVEL default * chore(release): v1.16.0 [skip ci] * chore(maintenance): drop support for Node.js 14 (#1802) * chore: package lock * chore(docs): update docs url in comments & readme files (#1728) * chore(ci): update v2 release workflow (#1745) * docs(maintenance): add processes tab (#1747) * docs(maintenance): update mkdocs to support tabs * chore(ci): add parallel test npm script * chore(ci): add jest command * docs(maintenance): add testing page to navbar * docs(maintenance): add contributing info * chore: update roadmap * chore: update release drafter workflow to allow for manual trigger * fix formatting * docs: maintainers handbook * chore: link to new location * fix links * Update docs/maintainers.md Co-authored-by: Alexander Schueren <[email protected]> --------- Co-authored-by: Alexander Schueren <[email protected]> * chore(maintenance): add --require-hashes flag to pip installs (#1827) * bump version to 9.5.2, rerun pip-compile with correct deps (#1830) * chore(ci): Dependabot fine tuning (#1862) * ignore major updates for mike * set versioning strategy for cdk, dependabot is running on auto upgrade strategy per default * ignore middy major upgrades * remove CodeQL, it's enough to have Sonar * update package-lock * chore(deps-dev): bump @aws-sdk/client-cloudwatch from 3.438.0 to 3.485.0 (#1857) * chore(deps-dev): bump @types/node from 20.11.0 to 20.11.2 (#1912) * chore(deps): fix dependencies and dependabot config (#1917) * chore(deps-dev): bump @typescript-eslint/parser from 6.19.0 to 6.19.1 (#1946) Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 6.19.0 to 6.19.1. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.19.1/packages/parser) --- updated-dependencies: - dependency-name: "@typescript-eslint/parser" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump @typescript-eslint/eslint-plugin (#1948) Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 6.19.0 to 6.19.1. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v6.19.1/packages/eslint-plugin) --- updated-dependencies: - dependency-name: "@typescript-eslint/eslint-plugin" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(ci): refactor workflows to scope permissions (#1978) * chore(maintenance): rebase conflicts * chore(maintenance): rebase conflicts * chore: rebase conflicts * chore: remove v2 specific release * chore: release patch script * docs: update docs & snippets * chore: address SonarCloud findings * chore: address SonarCloud findings * chore: address SonarCloud findings * tests: coverage * chore: add layers v2 * chore: bump ua version * docs: add install steps to batch * chore: fix install command * chore: remove unused dependency * Update examples/cdk/package.json --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Erika Yao <[email protected]> Co-authored-by: erikayao93 <[email protected]> Co-authored-by: Ant Stanley <[email protected]> Co-authored-by: Alexander Schueren <[email protected]> Co-authored-by: Sergei Cherniaev <[email protected]> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent f92538c commit 3b99263

File tree

404 files changed

+4621
-5178
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

404 files changed

+4621
-5178
lines changed

.github/actions/cached-node-modules/action.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ inputs:
44
nodeVersion: # id of input
55
description: 'Node.js version to use in the cache key'
66
default: '20'
7+
build:
8+
description: 'Whether to build the packages or not'
9+
default: 'true'
710
outputs:
811
cache-hit:
912
description: "Whether the cache was hit or not"
@@ -17,7 +20,7 @@ runs:
1720
shell: bash
1821
- name: Cache node modules
1922
id: cache-node-modules
20-
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
23+
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
2124
with:
2225
path: '**/node_modules'
2326
# Use the combo between node version, name, and SHA-256 hash of the lock file as cache key so that
@@ -29,8 +32,8 @@ runs:
2932
run: npm ci
3033
shell: bash
3134
- name: Build packages
32-
# Regardless of whether the cache was hit or not, we need to build the packages.
33-
#
35+
# Regardless of whether the cache was hit or not, we need to build the packages, unless the caller says otherwise
36+
if: inputs.build == 'true'
3437
# We build the shared package first, then the others in parallel to speed up the process
3538
# even though we could just run `npm run build` in the root folder and build them in
3639
# sequence, but still in the correct order.

.github/scripts/release_patch_package_json.js

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const betaPackages = [];
4444
types,
4545
files,
4646
private,
47+
type,
4748
} = pkgJson;
4849

4950
let version = originalVersion;
@@ -71,6 +72,7 @@ const betaPackages = [];
7172
main,
7273
types,
7374
files,
75+
type,
7476
};
7577

7678
// Not all utilities have these fields, so only add them if they exist to avoid

.github/workflows/make-v2-release.yml

-81
This file was deleted.

.github/workflows/make-version.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,13 @@ jobs:
3030
uses: ./.github/actions/cached-node-modules
3131
- name: Version
3232
id: bump-version
33+
run: npx lerna version --conventional-commits --no-git-tag-version --no-push --no-commit-hooks --yes
34+
- name: Update user agent version
3335
run: |
34-
npx lerna version --conventional-commits --no-git-tag-version --no-push --no-commit-hooks --yes
35-
git add .
36+
VERSION=$(cat lerna.json | jq .version -r)
37+
echo -e "// this file is auto generated, do not modify\nexport const VERSION = '$VERSION';" > packages/commons/src/version.ts
38+
- name: Stage changes
39+
run: git add .
3640
- name: Set release version
3741
id: set-release-version
3842
run: |

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ tmp
5050

5151
# TS build files
5252
tsconfig.tsbuildinfo
53-
.tsbuildinfo
53+
.tsbuildinfo

MAINTAINERS.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
> [!IMPORTANT]
2-
> Maintainers' playbook moved: https://docs.powertools.aws.dev/lambda/typescript/latest/maintainers/
2+
> Maintainers' playbook moved: https://docs.powertools.aws.dev/lambda/typescript/latest/maintainers/

docs/core/logger.md

+21-26
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ The library has three optional settings, which can be set via environment variab
4545

4646
These settings will be used across all logs emitted:
4747

48-
| Setting | Description | Environment variable | Default Value | Allowed Values | Example Value | Constructor parameter |
49-
| ---------------------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------- | ------------------- | ------------------------------------------------------ | ------------------- | --------------------- |
50-
| **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` | `service_undefined` | Any string | `serverlessAirline` | `serviceName` |
51-
| **Logging level** | Sets how verbose Logger should be, from the most verbose to the least verbose (no logs) | `POWERTOOLS_LOG_LEVEL` | `INFO` | `DEBUG`, `INFO`, `WARN`, `ERROR`, `CRITICAL`, `SILENT` | `ERROR` | `logLevel` |
52-
| **Sample rate** | Probability that a Lambda invocation will print all the log items regardless of the log level setting | `POWERTOOLS_LOGGER_SAMPLE_RATE` | `0` | `0.0` to `1.0` | `0.1` | `sampleRateValue` |
48+
| Setting | Description | Environment variable | Default Value | Allowed Values | Example Value | Constructor parameter |
49+
| ----------------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------- | ------------------- | ------------------------------------------------------ | ------------------- | --------------------- |
50+
| **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` | `service_undefined` | Any string | `serverlessAirline` | `serviceName` |
51+
| **Logging level** | Sets how verbose Logger should be, from the most verbose to the least verbose (no logs) | `POWERTOOLS_LOG_LEVEL` | `INFO` | `DEBUG`, `INFO`, `WARN`, `ERROR`, `CRITICAL`, `SILENT` | `ERROR` | `logLevel` |
52+
| **Sample rate** | Probability that a Lambda invocation will print all the log items regardless of the log level setting | `POWERTOOLS_LOGGER_SAMPLE_RATE` | `0` | `0.0` to `1.0` | `0.1` | `sampleRateValue` |
5353

5454
See all environment variables in the [Environment variables](../index.md/#environment-variables) section.
5555
Check API docs to learn more about [Logger constructor options](https://docs.powertools.aws.dev/lambda/typescript/latest/api/types/_aws_lambda_powertools_logger.types.ConstructorOptions.html){target="_blank"}.
@@ -110,10 +110,10 @@ This functionality will include the following keys in your structured logs:
110110
=== "Middy Middleware"
111111

112112
!!! tip "A note about Middy"
113-
Currently we support only Middy `v3.x` that you can install it by running `npm i @middy/core@~3`.
113+
We guarantee support only for Middy.js `v4.x`, that you can install it by running `npm i @middy/core@~4`.
114114
Check their docs to learn more about [Middy and its middleware stack](https://middy.js.org/docs/intro/getting-started){target="_blank"} as well as [best practices when working with Powertools](https://middy.js.org/docs/integrations/lambda-powertools#best-practices){target="_blank"}.
115115

116-
```typescript hl_lines="1 13"
116+
```typescript hl_lines="2 14"
117117
--8<-- "docs/snippets/logger/middy.ts"
118118
```
119119

@@ -131,7 +131,7 @@ This functionality will include the following keys in your structured logs:
131131

132132
=== "Manual"
133133

134-
```typescript hl_lines="6"
134+
```typescript hl_lines="10"
135135
--8<-- "docs/snippets/logger/manual.ts"
136136
```
137137

@@ -163,7 +163,7 @@ When debugging in non-production environments, you can instruct Logger to log th
163163

164164
=== "Middy Middleware"
165165

166-
```typescript hl_lines="10"
166+
```typescript hl_lines="15"
167167
--8<-- "docs/snippets/logger/eventMiddy.ts"
168168
```
169169

@@ -236,7 +236,7 @@ If you want to make sure that persistent attributes added **inside the handler f
236236

237237
=== "Middy Middleware"
238238

239-
```typescript hl_lines="30"
239+
```typescript hl_lines="31"
240240
--8<-- "docs/snippets/logger/clearStateMiddy.ts"
241241
```
242242

@@ -509,23 +509,21 @@ The `createChild` method allows you to create a child instance of the Logger, wh
509509
}
510510
```
511511

512-
### Sampling logs
512+
### Sampling debug logs
513513

514-
Use sampling when you want to print all the log items generated in your code, based on a **percentage of your concurrent/cold start invocations**.
514+
Use sampling when you want to dynamically change your log level to **DEBUG** based on a **percentage of your concurrent/cold start invocations**.
515515

516-
You can do that by setting a "sample rate", a float value ranging from `0.0` (0%) to `1` (100%), by using a `POWERTOOLS_LOGGER_SAMPLE_RATE` env var or passing the `sampleRateValue` parameter in the Logger constructor.
517-
This number represents the probability that a Lambda invocation will print all the log items regardless of the log level setting.
518-
519-
For example, by setting the "sample rate" to `0.5`, roughly 50% of your lambda invocations will print all the log items, including the `debug` ones.
516+
You can use values ranging from `0` to `1` (100%) when setting the `sampleRateValue` constructor option or `POWERTOOLS_LOGGER_SAMPLE_RATE` env var.
520517

521518
!!! tip "When is this useful?"
522-
In production, to avoid log data pollution and reduce CloudWatch costs, developers are encouraged to use the logger with `logLevel` equal to `ERROR` or `WARN`.
523-
This means that only errors or warnings will be printed.
519+
Let's imagine a sudden spike increase in concurrency triggered a transient issue downstream. When looking into the logs you might not have enough information, and while you can adjust log levels it might not happen again.
524520

525-
However, it might still be useful to print all the logs (including debug ones) of a very small percentage of invocations to have a better understanding of the behaviour of your code in production even when there are no errors.
526-
527-
**Sampling decision happens at the Logger initialization**. This means sampling may happen significantly more or less than depending on your traffic patterns, for example a steady low number of invocations and thus few cold starts.
528-
If you want to reset the sampling decision and refresh it for each invocation, you can call the `logger.refreshSampleRateCalculation()` method at the beginning or end of your handler.
521+
This feature takes into account transient issues where additional debugging information can be useful.
522+
523+
Sampling decision happens at the Logger initialization. This means sampling may happen significantly more or less than depending on your traffic patterns, for example a steady low number of invocations and thus few cold starts.
524+
525+
!!! note
526+
Open a [feature request](https://github.com/aws-powertools/powertools-lambda-typescript/issues/new?assignees=&labels=type%2Ffeature-request%2Ctriage&projects=aws-powertools%2F7&template=feature_request.yml&title=Feature+request%3A+TITLE) if you want Logger to calculate sampling for every invocation
529527

530528
=== "handler.ts"
531529

@@ -639,7 +637,7 @@ You can customize the structure (keys and values) of your log items by passing a
639637

640638
=== "handler.ts"
641639

642-
```typescript hl_lines="2 5"
640+
```typescript hl_lines="2 6"
643641
--8<-- "docs/snippets/logger/bringYourOwnFormatterHandler.ts"
644642
```
645643

@@ -700,9 +698,6 @@ This is a Jest sample that provides the minimum information necessary for Logger
700698
--8<-- "docs/snippets/logger/unitTesting.ts"
701699
```
702700

703-
!!! tip
704-
If you don't want to declare your own dummy Lambda Context, you can use [`ContextExamples.helloworldContext`](https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/packages/commons/src/samples/resources/contexts/hello-world.ts#L3-L16) from [`@aws-lambda-powertools/commons`](https://www.npmjs.com/package/@aws-lambda-powertools/commons).
705-
706701
### Suppress logs with Jest
707702

708703
When unit testing your code with [Jest](https://jestjs.io) you can use the `POWERTOOLS_DEV` environment variable in conjunction with the Jest `--silent` CLI option to suppress logs from Logger.

docs/core/metrics.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ npm install @aws-lambda-powertools/metrics
4949

5050
!!! warning "Caution"
5151

52-
Using the Lambda [Advanced Logging Controls](...docs link) feature requires you to update your version of Powertools for AWS Lambda (TypeScript) to at least v1.15.0 to ensure metrics are reported correctly to Amazon CloudWatch Metrics.
52+
Using the Lambda [Advanced Logging Controls](https://docs.aws.amazon.com/lambda/latest/dg/monitoring-cloudwatchlogs.html#monitoring-cloudwatchlogs-advanced) feature requires you to update your version of Powertools for AWS Lambda (TypeScript) to at least v1.15.0 to ensure metrics are reported correctly to Amazon CloudWatch Metrics.
5353

5454
### Usage
5555

@@ -253,7 +253,7 @@ See below an example of how to automatically flush metrics with the Middy-compat
253253

254254
=== "handler.ts"
255255

256-
```typescript hl_lines="20"
256+
```typescript hl_lines="2 17"
257257
--8<-- "docs/snippets/metrics/middy.ts"
258258
```
259259

@@ -368,7 +368,7 @@ You can optionally capture cold start metrics with the `logMetrics` middleware o
368368

369369
=== "Middy Middleware"
370370

371-
```typescript hl_lines="21"
371+
```typescript hl_lines="18"
372372
--8<-- "docs/snippets/metrics/captureColdStartMetricMiddy.ts"
373373
```
374374

@@ -398,7 +398,7 @@ You can add high-cardinality data as part of your Metrics log with the `addMetad
398398

399399
=== "handler.ts"
400400

401-
```typescript hl_lines="18"
401+
```typescript hl_lines="15"
402402
--8<-- "docs/snippets/metrics/addMetadata.ts"
403403
```
404404

docs/core/tracer.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ You can quickly start by importing the `Tracer` class, initialize it outside the
8888
=== "Middy Middleware"
8989

9090
!!! tip "A note about Middy"
91-
Currently we support only Middy `v3.x` that you can install it by running `npm i @middy/core@~3`.
91+
We guarantee support only for Middy.js `v4.x`, that you can install it by running `npm i @middy/core@~4`.
9292
Check their docs to learn more about [Middy and its middleware stack](https://middy.js.org/docs/intro/getting-started){target="_blank"} as well as [best practices when working with Powertools](https://middy.js.org/docs/integrations/lambda-powertools#best-practices){target="_blank"}.
9393

94-
```typescript hl_lines="1 14 16"
94+
```typescript hl_lines="2 15 17"
9595
--8<-- "docs/snippets/tracer/middy.ts"
9696
```
9797

@@ -197,7 +197,7 @@ You can patch all AWS SDK v2 clients by calling the `captureAWS` method:
197197

198198
=== "index.ts"
199199

200-
```typescript hl_lines="6"
200+
```typescript hl_lines="7"
201201
--8<-- "docs/snippets/tracer/captureAWSAll.ts"
202202
```
203203

@@ -284,7 +284,7 @@ Alternatively, use the `captureResponse: false` option in both `tracer.captureLa
284284

285285
=== "middy.ts"
286286

287-
```typescript hl_lines="17"
287+
```typescript hl_lines="18"
288288
--8<-- "docs/snippets/tracer/disableCaptureResponseMiddy.ts"
289289
```
290290

0 commit comments

Comments
 (0)