Commit b2ced23
fix(aws-serverless): Instrument aws-sdk clients using @smithy/core >= 3.24.0
`@smithy/core@3.24.0` moved the `Client` class out of `@smithy/smithy-client`
into the `@smithy/core/client` bundle and turned `constructStack` into a
closed-over local, so the vendored instrumentation - which created spans by
wrapping `constructStack` exported from `@smithy/middleware-stack` - silently
produced no spans for any AWS service on `@aws-sdk/*` >= 3.1046.0.
This backports the upstream fix (open-telemetry/opentelemetry-js-contrib#3530,
released in @opentelemetry/instrumentation-aws-sdk@0.74.0):
* Patch `Client.prototype.send` in `@smithy/core/dist-cjs/submodules/client/index.js`
for `@smithy/core` >= 3.24.0.
* From within the `send` patch, patch the live `middlewareStack` instance
directly (its `resolve` is the span-creation point) instead of relying on the
no-longer-patchable `constructStack` export.
* Guard `clone`/`concat` wrapping with `isWrapped` so repeated patching is safe.
The aws-integration tests are consolidated into a single scenario that exercises
all instrumented services, and run via `createEsmAndCjsTests` + `describe.each`
against two dependency sets:
* `latest` - the workspace `@aws-sdk/*` (`@smithy/core` >= 3.24.0, the new path)
* `v3.1041.0` - aws-sdk 3.1041.0 pinned together with the pre-`@smithy/core`
smithy stack via `additionalDependencies`, exercising the old
`@smithy/middleware-stack` path
Both run the same assertions in ESM and CJS, proving spans are produced on both
architectures. Pinning only the client is not enough - `@smithy/smithy-client`
must also be pinned < 4.13, otherwise it pulls `@smithy/core` >= 3.24.0 again.
Fixes #21546
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 4e7eb9a commit b2ced23
22 files changed
Lines changed: 749 additions & 1316 deletions
File tree
- dev-packages/node-integration-tests
- suites/aws-serverless/aws-integration
- dynamodb
- kinesis
- lambda
- s3
- secretsmanager
- sns
- sqs
- stepfunctions
- packages/aws-serverless/src/integration/aws/vendored
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
Lines changed: 0 additions & 52 deletions
This file was deleted.
Lines changed: 0 additions & 51 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 0 additions & 51 deletions
This file was deleted.
0 commit comments