Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: aws-powertools/powertools-lambda-typescript
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.7.2
Choose a base ref
...
head repository: aws-powertools/powertools-lambda-typescript
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.8.0
Choose a head ref
  • 16 commits
  • 34 files changed
  • 5 contributors

Commits on Apr 1, 2022

  1. build(deps-dev): bump @aws-sdk/client-dynamodb from 3.55.0 to 3.58.0 (#…

    …719)
    
    Bumps [@aws-sdk/client-dynamodb](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/clients/client-dynamodb) from 3.55.0 to 3.58.0.
    - [Release notes](https://github.com/aws/aws-sdk-js-v3/releases)
    - [Changelog](https://github.com/aws/aws-sdk-js-v3/blob/main/clients/client-dynamodb/CHANGELOG.md)
    - [Commits](https://github.com/aws/aws-sdk-js-v3/commits/v3.58.0/clients/client-dynamodb)
    
    ---
    updated-dependencies:
    - dependency-name: "@aws-sdk/client-dynamodb"
      dependency-type: direct:development
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Apr 1, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ff3d153 View commit details

Commits on Apr 5, 2022

  1. feat: added captureHTTPsRequest feature (#677)

    * fix: increased test cases timeout to make it more stable
    
    * test: increase timeout to 4min
    
    * feat: added captureHTTPsRequest feature
    
    * docs: added 3rd party clients notice
    
    * fix: removed unused import
    
    * chore: add integ tests
    
    * fix: increased timeout to 3min
    
    * fix: error introduced in test fn
    
    * fix: revert changes on e2e test from this PR
    
    * fix: reverted e2e test
    
    * fix: reintroduced some changes
    
    * fix: re-added manual e2e tests
    
    * fixtroubleshooting
    
    * fixtroubleshooting
    
    * fix/troubleshooting
    
    * fix/troubleshooting
    
    * fix/troubleshooting
    
    * Update docs/core/tracer.md
    
    Co-authored-by: Florian Chazal <[email protected]>
    
    * fix: addressed review comments
    
    * build(deps): updated client-dynamodb dev dep
    
    * Update docs/core/tracer.md
    
    Co-authored-by: Sara Gerion <[email protected]>
    
    * Update packages/tracing/tests/unit/ProviderService.test.ts
    
    Co-authored-by: Sara Gerion <[email protected]>
    
    * Update packages/tracing/src/Tracer.ts
    
    Co-authored-by: Sara Gerion <[email protected]>
    
    Co-authored-by: Florian Chazal <[email protected]>
    Co-authored-by: Sara Gerion <[email protected]>
    3 people authored Apr 5, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    5a36723 View commit details

Commits on Apr 7, 2022

  1. build(deps): bump aws-sdk from 2.1105.0 to 2.1109.0 (#736)

    Bumps [aws-sdk](https://github.com/aws/aws-sdk-js) from 2.1105.0 to 2.1109.0.
    - [Release notes](https://github.com/aws/aws-sdk-js/releases)
    - [Changelog](https://github.com/aws/aws-sdk-js/blob/master/CHANGELOG.md)
    - [Commits](aws/aws-sdk-js@v2.1105.0...v2.1109.0)
    
    ---
    updated-dependencies:
    - dependency-name: aws-sdk
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Apr 7, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ca17e42 View commit details
  2. build(deps-dev): bump eslint-import-resolver-typescript (#720)

    Bumps [eslint-import-resolver-typescript](https://github.com/alexgorbatchev/eslint-import-resolver-typescript) from 2.7.0 to 2.7.1.
    - [Release notes](https://github.com/alexgorbatchev/eslint-import-resolver-typescript/releases)
    - [Changelog](https://github.com/alexgorbatchev/eslint-import-resolver-typescript/blob/master/CHANGELOG.md)
    - [Commits](import-js/eslint-import-resolver-typescript@v2.7.0...v2.7.1)
    
    ---
    updated-dependencies:
    - dependency-name: eslint-import-resolver-typescript
      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>
    dependabot[bot] authored Apr 7, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    494eea0 View commit details
  3. build(deps-dev): bump @typescript-eslint/parser from 5.17.0 to 5.18.0 (

    …#725)
    
    Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.17.0 to 5.18.0.
    - [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/v5.18.0/packages/parser)
    
    ---
    updated-dependencies:
    - dependency-name: "@typescript-eslint/parser"
      dependency-type: direct:development
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Apr 7, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ffdd36d View commit details
  4. build(deps-dev): bump esbuild from 0.14.29 to 0.14.34 (#734)

    Bumps [esbuild](https://github.com/evanw/esbuild) from 0.14.29 to 0.14.34.
    - [Release notes](https://github.com/evanw/esbuild/releases)
    - [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
    - [Commits](evanw/esbuild@v0.14.29...v0.14.34)
    
    ---
    updated-dependencies:
    - dependency-name: esbuild
      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>
    dependabot[bot] authored Apr 7, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    27c6953 View commit details
  5. build(deps): bump constructs from 10.0.102 to 10.0.108 (#735)

    Bumps [constructs](https://github.com/aws/constructs) from 10.0.102 to 10.0.108.
    - [Release notes](https://github.com/aws/constructs/releases)
    - [Commits](aws/constructs@v10.0.102...v10.0.108)
    
    ---
    updated-dependencies:
    - dependency-name: constructs
      dependency-type: direct:production
      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>
    dependabot[bot] authored Apr 7, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    fba4410 View commit details
  6. build(deps-dev): bump typedoc from 0.22.13 to 0.22.14 (#737)

    Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.22.13 to 0.22.14.
    - [Release notes](https://github.com/TypeStrong/TypeDoc/releases)
    - [Changelog](https://github.com/TypeStrong/typedoc/blob/master/CHANGELOG.md)
    - [Commits](TypeStrong/typedoc@v0.22.13...v0.22.14)
    
    ---
    updated-dependencies:
    - dependency-name: typedoc
      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>
    dependabot[bot] authored Apr 7, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    108087d View commit details
  7. build(deps-dev): bump @aws-cdk/cx-api from 2.19.0 to 2.20.0 (#738)

    Bumps [@aws-cdk/cx-api](https://github.com/aws/aws-cdk/tree/HEAD/packages/@aws-cdk/cx-api) from 2.19.0 to 2.20.0.
    - [Release notes](https://github.com/aws/aws-cdk/releases)
    - [Changelog](https://github.com/aws/aws-cdk/blob/master/allowed-breaking-changes.txt)
    - [Commits](https://github.com/aws/aws-cdk/commits/HEAD/packages/@aws-cdk/cx-api)
    
    ---
    updated-dependencies:
    - dependency-name: "@aws-cdk/cx-api"
      dependency-type: direct:development
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Apr 7, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8b0e147 View commit details
  8. build(deps-dev): bump eslint-plugin-import from 2.25.4 to 2.26.0 (#739)

    Bumps [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import) from 2.25.4 to 2.26.0.
    - [Release notes](https://github.com/import-js/eslint-plugin-import/releases)
    - [Changelog](https://github.com/import-js/eslint-plugin-import/blob/main/CHANGELOG.md)
    - [Commits](import-js/eslint-plugin-import@v2.25.4...v2.26.0)
    
    ---
    updated-dependencies:
    - dependency-name: eslint-plugin-import
      dependency-type: direct:development
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Apr 7, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    258128d View commit details
  9. build(deps-dev): bump cdk-assets from 2.19.0 to 2.20.0 (#740)

    Bumps [cdk-assets](https://github.com/aws/aws-cdk/tree/HEAD/packages/cdk-assets) from 2.19.0 to 2.20.0.
    - [Release notes](https://github.com/aws/aws-cdk/releases)
    - [Changelog](https://github.com/aws/aws-cdk/blob/master/allowed-breaking-changes.txt)
    - [Commits](https://github.com/aws/aws-cdk/commits/HEAD/packages/cdk-assets)
    
    ---
    updated-dependencies:
    - dependency-name: cdk-assets
      dependency-type: direct:development
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Apr 7, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    862a928 View commit details
  10. build(deps-dev): bump @aws-cdk/cloudformation-diff from 2.19.0 to 2.2…

    …0.0 (#741)
    
    Bumps [@aws-cdk/cloudformation-diff](https://github.com/aws/aws-cdk/tree/HEAD/packages/@aws-cdk/cloudformation-diff) from 2.19.0 to 2.20.0.
    - [Release notes](https://github.com/aws/aws-cdk/releases)
    - [Changelog](https://github.com/aws/aws-cdk/blob/master/allowed-breaking-changes.txt)
    - [Commits](https://github.com/aws/aws-cdk/commits/HEAD/packages/@aws-cdk/cloudformation-diff)
    
    ---
    updated-dependencies:
    - dependency-name: "@aws-cdk/cloudformation-diff"
      dependency-type: direct:development
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Apr 7, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e1f4408 View commit details
  11. build(deps): bump aws-cdk-lib from 2.19.0 to 2.20.0 (#742)

    Bumps [aws-cdk-lib](https://github.com/aws/aws-cdk/tree/HEAD/packages/aws-cdk-lib) from 2.19.0 to 2.20.0.
    - [Release notes](https://github.com/aws/aws-cdk/releases)
    - [Changelog](https://github.com/aws/aws-cdk/blob/master/allowed-breaking-changes.txt)
    - [Commits](https://github.com/aws/aws-cdk/commits/HEAD/packages/aws-cdk-lib)
    
    ---
    updated-dependencies:
    - dependency-name: aws-cdk-lib
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Apr 7, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    7cb8a27 View commit details
  12. build(deps-dev): bump @typescript-eslint/eslint-plugin (#743)

    Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.17.0 to 5.18.0.
    - [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/v5.18.0/packages/eslint-plugin)
    
    ---
    updated-dependencies:
    - dependency-name: "@typescript-eslint/eslint-plugin"
      dependency-type: direct:development
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Apr 7, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0fbf46e View commit details
  13. build(deps): bump aws-sdk from 2.1109.0 to 2.1110.0 (#744)

    Bumps [aws-sdk](https://github.com/aws/aws-sdk-js) from 2.1109.0 to 2.1110.0.
    - [Release notes](https://github.com/aws/aws-sdk-js/releases)
    - [Changelog](https://github.com/aws/aws-sdk-js/blob/master/CHANGELOG.md)
    - [Commits](aws/aws-sdk-js@v2.1109.0...v2.1110.0)
    
    ---
    updated-dependencies:
    - dependency-name: aws-sdk
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Apr 7, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0813b25 View commit details

Commits on Apr 8, 2022

  1. Copy the full SHA
    1c2870e View commit details
Showing with 1,385 additions and 1,230 deletions.
  1. +11 −0 CHANGELOG.md
  2. +65 −11 docs/core/tracer.md
  3. +1 −0 docs/index.md
  4. +8 −0 examples/cdk/CHANGELOG.md
  5. +189 −189 examples/cdk/package-lock.json
  6. +2 −2 examples/cdk/package.json
  7. +1 −1 lerna.json
  8. +742 −861 package-lock.json
  9. +8 −0 packages/commons/CHANGELOG.md
  10. +1 −1 packages/commons/package.json
  11. +8 −0 packages/logger/CHANGELOG.md
  12. +2 −2 packages/logger/package.json
  13. +8 −0 packages/metrics/CHANGELOG.md
  14. +2 −2 packages/metrics/package.json
  15. +11 −0 packages/tracing/CHANGELOG.md
  16. +5 −4 packages/tracing/package.json
  17. +41 −0 packages/tracing/src/Tracer.ts
  18. +11 −6 packages/tracing/src/TracerInterface.ts
  19. +3 −0 packages/tracing/src/config/ConfigService.ts
  20. +2 −0 packages/tracing/src/config/ConfigServiceInterface.ts
  21. +4 −0 packages/tracing/src/config/EnvironmentVariablesService.ts
  22. +8 −1 packages/tracing/src/provider/ProviderService.ts
  23. +3 −1 packages/tracing/src/provider/ProviderServiceInterface.ts
  24. +2 −0 packages/tracing/src/types/Tracer.ts
  25. +3 −1 packages/tracing/tests/e2e/tracer.test.Decorator.ts
  26. +5 −13 packages/tracing/tests/e2e/tracer.test.DecoratorWithAsyncHandler.ts
  27. +6 −14 packages/tracing/tests/e2e/tracer.test.Manual.ts
  28. +6 −14 packages/tracing/tests/e2e/tracer.test.Middleware.ts
  29. +80 −96 packages/tracing/tests/e2e/tracer.test.ts
  30. +13 −0 packages/tracing/tests/helpers/tracesUtils.ts
  31. +23 −1 packages/tracing/tests/unit/ProviderService.test.ts
  32. +1 −0 packages/tracing/tests/unit/Tracer.test.ts
  33. +17 −0 packages/tracing/tests/unit/config/EnvironmentVariablesService.test.ts
  34. +93 −10 packages/tracing/tests/unit/helpers.test.ts
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [0.8.0](https://github.com/awslabs/aws-lambda-powertools-typescript/compare/v0.7.2...v0.8.0) (2022-04-08)


### Features

* added captureHTTPsRequest feature ([#677](https://github.com/awslabs/aws-lambda-powertools-typescript/issues/677)) ([5a36723](https://github.com/awslabs/aws-lambda-powertools-typescript/commit/5a367233b3284c4b1c0c18caffd00e585afc9f55))





## [0.7.2](https://github.com/awslabs/aws-lambda-powertools-typescript/compare/v0.7.1...v0.7.2) (2022-04-01)

**Note:** Version bump only for package aws-lambda-powertools-typescript
76 changes: 65 additions & 11 deletions docs/core/tracer.md
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@ Tracer is an opinionated thin wrapper for [AWS X-Ray SDK for Node.js](https://gi

* 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

@@ -49,13 +50,13 @@ The `Tracer` utility must always be instantiated outside of the Lambda handler.

### Utility settings

The library has one optional setting. You can set it as environment variable, or pass it in the constructor.

This setting will be used across all traces emitted:
The library has three optional settings. You can set them as environment variables, or pass them in the constructor:

Setting | Description | Environment variable | Constructor parameter
------------------------------------------------- |------------------------------------------------------------------------------------------------| ------------------------------------------------- | -------------------------------------------------
**Tracing enabled** | Enables or disables tracing. By default tracing is enabled when running in AWS Lambda. | `POWERTOOLS_TRACE_ENABLED` | `enabled`
**Service name** | Sets an annotation with the **name of the service** across all traces e.g. `serverlessAirline` | `POWERTOOLS_SERVICE_NAME` | `serviceName`
**Capture HTTPs Requests** | Defines whether HTTPs requests will be traced or not, enabled by default when tracing is also enabled. | `POWERTOOLS_TRACER_CAPTURE_HTTPS_REQUESTS` | `captureHTTPsRequests`

For a **complete list** of supported environment variables, refer to [this section](./../index.md#environment-variables).

@@ -137,13 +138,9 @@ You can quickly start by importing the `Tracer` class, initialize it outside the

=== "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"}.

```typescript hl_lines="1-2 11 13"
import { Tracer, captureLambdaHandler } from '@aws-lambda-powertools/tracer';
import middy from '@middy/core';
import middy from '@middy/core'; // (1)

const tracer = new Tracer({ serviceName: 'serverlessAirline' });

@@ -157,6 +154,9 @@ You can quickly start by importing the `Tracer` class, initialize it outside the
.use(captureLambdaHandler(tracer));
```

1. 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"}.

=== "Decorator"

!!! info
@@ -326,13 +326,67 @@ If you're looking to shave a few microseconds, or milliseconds depending on your
=== "index.ts"

```typescript hl_lines="5"
import { S3 } from "aws-sdk";
import { S3 } from 'aws-sdk';
import { Tracer } from '@aws-lambda-powertools/tracer';

const tracer = new Tracer({ serviceName: 'serverlessAirline' });
const s3 = tracer.captureAWSClient(new S3());
```

### Tracing HTTP requests

When your function makes calls to HTTP APIs, Tracer automatically traces those calls and add the API to the service graph as a downstream service.

You can opt-out from this feature by setting the **`POWERTOOLS_TRACER_CAPTURE_HTTPS_REQUESTS=false`** environment variable or by passing the `captureHTTPSRequests: false` option to the `Tracer` constructor.

!!! info
The following snippet shows how to trace [axios](https://www.npmjs.com/package/axios) requests, but you can use any HTTP client library built on top of [http](https://nodejs.org/api/http.html) or [https](https://nodejs.org/api/https.html).
Support to 3rd party HTTP clients is provided on a best effort basis.

=== "index.ts"

```typescript hl_lines="2 7"
import { Tracer } from '@aws-lambda-powertools/tracer';
import axios from 'axios'; // (1)

const tracer = new Tracer({ serviceName: 'serverlessAirline' });

export const handler = async (event: unknown, context: Context): Promise<void> => {
await axios.get('https://httpbin.org/status/200');
};
```

1. You can install the [axios](https://www.npmjs.com/package/axios) package using `npm i axios`
=== "Example Raw X-Ray Trace excerpt"

```json hl_lines="6 9 12-21"
{
"id": "22883fbc730e3a0b",
"name": "## index.handler",
"start_time": 1647956168.22749,
"end_time": 1647956169.0679862,
"subsegments": [
{
"id": "ab82ab2b7d525d8f",
"name": "httpbin.org",
"start_time": 1647956168.407,
"end_time": 1647956168.945,
"http": {
"request": {
"url": "https://httpbin.org/status/200",
"method": "GET"
},
"response": {
"status": 200,
"content_length": 0
}
},
"namespace": "remote"
}
]
}
```

## Advanced

### Disabling response auto-capture
@@ -361,7 +415,7 @@ This is useful when you need a feature available in X-Ray that is not available

=== "index.ts"

```typescript hl_lines="6"
```typescript hl_lines="7"
import { Logger } from '@aws-lambda-powertools/logger';
import { Tracer } from '@aws-lambda-powertools/tracer';

@@ -379,4 +433,4 @@ Tracer is disabled by default when not running in the AWS Lambda environment - T

* Use annotations on key operations to slice and dice traces, create unique views, and create metrics from it via Trace Groups
* Use a namespace when adding metadata to group data more easily
* Annotations and metadata are added to the current subsegment opened. If you want them in a specific subsegment, [create one](https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-nodejs-subsegments.html#xray-sdk-nodejs-subsegments-lambda) via the escape hatch mechanism
* Annotations and metadata are added to the currently open subsegment. If you want them in a specific subsegment, [create one](https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-nodejs-subsegments.html#xray-sdk-nodejs-subsegments-lambda) via the escape hatch mechanism
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -54,6 +54,7 @@ Each TypeScript utility is installed as standalone NPM package.
| **POWERTOOLS_TRACE_ENABLED** | Explicitly disables tracing | [Tracer](./core/tracer) | `true` |
| **POWERTOOLS_TRACER_CAPTURE_RESPONSE** | Captures Lambda or method return as metadata. | [Tracer](./core/tracer) | `true` |
| **POWERTOOLS_TRACER_CAPTURE_ERROR** | Captures Lambda or method exception as metadata. | [Tracer](./core/tracer) | `true` |
| **POWERTOOLS_TRACER_CAPTURE_HTTPS_REQUESTS** | Captures HTTP(s) requests as segments. | [Tracer](./core/tracer) | `true` |
| **POWERTOOLS_LOGGER_LOG_EVENT** | Logs incoming event | [Logger](./core/logger) | `false` |
| **POWERTOOLS_LOGGER_SAMPLE_RATE** | Debug log sampling | [Logger](./core/logger) | `0` |
| **POWERTOOLS_LOG_DEDUPLICATION_DISABLED** | Disables log deduplication filter protection to use Pytest Live Log feature | [Logger](./core/logger) | `false` |
8 changes: 8 additions & 0 deletions examples/cdk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [0.8.0](https://github.com/awslabs/aws-lambda-powertools-typescript/compare/v0.7.2...v0.8.0) (2022-04-08)

**Note:** Version bump only for package cdk-app





## [0.7.2](https://github.com/awslabs/aws-lambda-powertools-typescript/compare/v0.7.1...v0.7.2) (2022-04-01)

**Note:** Version bump only for package cdk-app
Loading