Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions currencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"core": false,
"versions": [
{
"v": "3.1045.0"
"v": "3.1046.0"
}
]
},
Expand All @@ -89,7 +89,7 @@
"core": false,
"versions": [
{
"v": "3.1045.0"
"v": "3.1046.0"
}
]
},
Expand All @@ -105,7 +105,7 @@
"core": false,
"versions": [
{
"v": "3.1045.0"
"v": "3.1046.0"
}
]
},
Expand All @@ -121,7 +121,7 @@
"core": false,
"versions": [
{
"v": "3.1045.0"
"v": "3.1046.0"
}
]
},
Expand All @@ -137,7 +137,7 @@
"core": false,
"versions": [
{
"v": "3.1045.0"
"v": "3.1046.0"
}
]
},
Expand All @@ -153,7 +153,7 @@
"core": false,
"versions": [
{
"v": "3.1045.0"
"v": "3.1046.0"
}
]
},
Expand All @@ -169,7 +169,7 @@
"core": false,
"versions": [
{
"v": "3.1045.0"
"v": "3.1046.0"
}
]
},
Expand All @@ -185,7 +185,7 @@
"core": false,
"versions": [
{
"v": "3.1045.0"
"v": "3.1046.0"
}
]
},
Expand All @@ -201,7 +201,7 @@
"core": false,
"versions": [
{
"v": "3.1045.0"
"v": "3.1046.0"
}
]
},
Expand Down Expand Up @@ -800,7 +800,7 @@
"core": false,
"versions": [
{
"v": "12.5.2"
"v": "12.5.3"
},
{
"v": "10.0.4"
Expand Down Expand Up @@ -1331,4 +1331,4 @@
}
]
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ exports.init = function init(config) {

sqsConsumer.init();

/**
* https://github.com/aws/aws-sdk-js-v3/releases/tag/v3.1046.0
*/
hook.onModuleLoad('@smithy/core/client', instrumentGlobalSmithy);

/**
* @aws-sdk/smithly-client >= 3.36.0 changed how the dist structure gets delivered
* https://github.com/aws/aws-sdk-js-v3/blob/main/packages/smithy-client/CHANGELOG.md#3360-2021-10-08
Expand Down Expand Up @@ -72,8 +77,25 @@ exports.deactivate = function deactivate() {
isActive = false;
};

function instrumentGlobalSmithy(Smithy) {
shimmer.wrap(Smithy.Client.prototype, 'send', shimSmithySend);
/**
* The require hook can run once while `exports` is still `{}` (cyclic CJS load); `exports` is then the same object
* Node fills in later. Defer wrapping until after the current synchronous load completes.
*/
function instrumentGlobalSmithy(exports) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theoretically we could add support for this problem into the requireHook.
But I have not seen this issue before. So lets see if we get more cases in the future.

const tryWrap = () => {
if (typeof exports.Client === 'function' && exports.Client.prototype) {
shimmer.wrap(exports.Client.prototype, 'send', shimSmithySend);
return true;
}
return false;
};

if (!tryWrap()) {
setImmediate(() => {
tryWrap();
});
}
return exports;
}

function shimSmithySend(originalSend) {
Expand All @@ -84,6 +106,7 @@ function shimSmithySend(originalSend) {

const serviceId = self.config && self.config.serviceId;
let awsProduct = serviceId && awsProductInstances.find(aws => aws.getServiceIdName() === serviceId.toLowerCase());

if (awsProduct && awsProduct.supportsOperation(command.constructor.name)) {
return awsProduct.instrumentedSmithySend(self, isActive, originalSend, smithySendArgs);
} else {
Expand Down