Skip to content

Commit

Permalink
Merge branch 'main' into renovate/otel-core-experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
haddasbronfman authored Aug 10, 2023
2 parents 5988f9b + 3f2bfe8 commit 58c9276
Showing 1 changed file with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,36 @@ export class AwsInstrumentation extends InstrumentationBase<any> {
v3MiddlewareStackFileNewVersions,
]);

// patch for @smithy/middleware-stack for aws-sdk packages v3.363.0+
const v3SmithyMiddlewareStackFile = new InstrumentationNodeModuleFile(
'@smithy/middleware-stack/dist-cjs/MiddlewareStack.js',
['>=1.0.1'],
this.patchV3ConstructStack.bind(this),
this.unpatchV3ConstructStack.bind(this)
);
const v3SmithyMiddlewareStack = new InstrumentationNodeModuleDefinition(
'@smithy/middleware-stack',
['>=2.0.0'],
undefined,
undefined,
[v3SmithyMiddlewareStackFile]
);

const v3SmithyClient = new InstrumentationNodeModuleDefinition<typeof AWS>(
'@aws-sdk/smithy-client',
['^3.1.0'],
this.patchV3SmithyClient.bind(this),
this.unpatchV3SmithyClient.bind(this)
);

// patch for new @smithy/smithy-client for aws-sdk packages v3.363.0+
const v3NewSmithyClient = new InstrumentationNodeModuleDefinition(
'@smithy/smithy-client',
['>=1.0.3'],
this.patchV3SmithyClient.bind(this),
this.unpatchV3SmithyClient.bind(this)
);

const v2Request = new InstrumentationNodeModuleFile<typeof AWS>(
'aws-sdk/lib/core.js',
['^2.308.0'],
Expand All @@ -134,7 +157,13 @@ export class AwsInstrumentation extends InstrumentationBase<any> {
[v2Request]
);

return [v2Module, v3MiddlewareStack, v3SmithyClient];
return [
v2Module,
v3MiddlewareStack,
v3SmithyMiddlewareStack,
v3SmithyClient,
v3NewSmithyClient,
];
}

protected patchV3ConstructStack(moduleExports: any, moduleVersion?: string) {
Expand Down

0 comments on commit 58c9276

Please sign in to comment.