-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add @aws-sdk/client-dynamodb instrumentation #3530
Conversation
.ci/tav.json
Outdated
@@ -4,6 +4,7 @@ | |||
"modules": [ | |||
"@apollo/server", | |||
"@aws-sdk/client-s3", | |||
"@aws-sdk/client-dynamodb", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for reviewer: still under the limit and I guess the matrix will be reduced once we drop older node versions.
* Slurp everything from the given ReadableStream and return the content, | ||
* converted to a string. | ||
*/ | ||
async function slurpStream(stream) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for reviewer: moved this function to a common place for further use in other client tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work. This is great.
|
||
const NODE_VER_SUP_AWS_SDK = '14.0.0'; | ||
const NODE_VER_SUP_RANGE_RITM = `>=${NODE_VER_SUP_AWS_SDK}`; | ||
const NODE_VER_SUP_RANGE_IITM = iitmVersionsFrom(NODE_VER_SUP_AWS_SDK); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for reviewer: this is to avoid testing ESM on Node v12 since the dynamodb client doesn't support it. Check ./test/testconsts.js
module for implementation details.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I'm fine with this, but I feel it is a lot of code that is ultimate less clear than a second constant, something like:
const NODE_VER_RANGE_IITM_GE14 = '^14.13.1 || ^16.0.0 || ^18.1.0 <20'; // NODE_VER_RANGE_IITM minus node v12
Then perhaps these other usages could be updated:
test/instrumentation/modules/fastify/fastify.test.js
64: node: '^14.13.1 || ^16.0.0 || ^18.1.0 <20', // NODE_VER_RANGE_IITM minus node v12 because top-level `await` is used
test/instrumentation/modules/http/http-esm.test.js
111: node: '^14.13.1 || ^16.0.0 || ^18.1.0 <20', // NODE_VER_RANGE_IITM minus node v12 because top-level `await` is used
137: node: '^14.13.1 || ^16.0.0 || ^18.1.0 <20', // NODE_VER_RANGE_IITM minus node v12 because top-level `await` is used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done! also did the replacement in fastify and http tests :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A probably spurious test in apm-http-client
# payloadLogFile
ok 40 should have received 5 objects
not ok 41 plan != count
---
operator: fail
expected: 6
actual: 1
at: Transform.<anonymous> (/home/runner/work/apm-agent-nodejs/apm-agent-nodejs/test/apm-client/http-apm-client/config.test.js:572:13)
stack: |-
Error: plan != count
at Test.assert [as _assert] (/home/runner/work/apm-agent-nodejs/apm-agent-nodejs/node_modules/tape/lib/test.js:309:48)
at Test.fail (/home/runner/work/apm-agent-nodejs/apm-agent-nodejs/node_modules/tape/lib/test.js:403:7)
at completeEnd (/home/runner/work/apm-agent-nodejs/apm-agent-nodejs/node_modules/tape/lib/test.js:224:9)
at next (/home/runner/work/apm-agent-nodejs/apm-agent-nodejs/node_modules/tape/lib/test.js:234:4)
at Test._end (/home/runner/work/apm-agent-nodejs/apm-agent-nodejs/node_modules/tape/lib/test.js:254:2)
at Test.end (/home/runner/work/apm-agent-nodejs/apm-agent-nodejs/node_modules/tape/lib/test.js:194:7)
at Transform.<anonymous> (/home/runner/work/apm-agent-nodejs/apm-agent-nodejs/test/apm-client/http-apm-client/config.test.js:572:13)
at Transform.emit (node:events:514:28)
at endReadableNT (/home/runner/work/apm-agent-nodejs/apm-agent-nodejs/node_modules/readable-stream/lib/_stream_readable.js:1003:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
...
# update conf
|
||
const NODE_VER_SUP_AWS_SDK = '14.0.0'; | ||
const NODE_VER_SUP_RANGE_RITM = `>=${NODE_VER_SUP_AWS_SDK}`; | ||
const NODE_VER_SUP_RANGE_IITM = iitmVersionsFrom(NODE_VER_SUP_AWS_SDK); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I'm fine with this, but I feel it is a lot of code that is ultimate less clear than a second constant, something like:
const NODE_VER_RANGE_IITM_GE14 = '^14.13.1 || ^16.0.0 || ^18.1.0 <20'; // NODE_VER_RANGE_IITM minus node v12
Then perhaps these other usages could be updated:
test/instrumentation/modules/fastify/fastify.test.js
64: node: '^14.13.1 || ^16.0.0 || ^18.1.0 <20', // NODE_VER_RANGE_IITM minus node v12 because top-level `await` is used
test/instrumentation/modules/http/http-esm.test.js
111: node: '^14.13.1 || ^16.0.0 || ^18.1.0 <20', // NODE_VER_RANGE_IITM minus node v12 because top-level `await` is used
137: node: '^14.13.1 || ^16.0.0 || ^18.1.0 <20', // NODE_VER_RANGE_IITM minus node v12 because top-level `await` is used
test/instrumentation/modules/@aws-sdk/fixtures/use-client-dynamodb.js
Outdated
Show resolved
Hide resolved
^^ Basically all LGTM. Just the changelog entry move... and with "dismiss stale reviews", no point in an "approve". |
…modb.js Co-authored-by: Trent Mick <[email protected]>
Co-authored-by: Trent Mick <[email protected]>
Adding
@aws-sdk/client-dynamodb
v3 instrumentation and plugin it in@smithy/smithy-client
one. The tests have been created taking v2 instrumentation tests as a template.Closes #2958
Checklist