Skip to content
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

Merged
merged 40 commits into from
Sep 18, 2023

Conversation

david-luna
Copy link
Member

@david-luna david-luna commented Aug 1, 2023

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

  • Implement code
  • Add tests
  • Update TypeScript typings
  • Update documentation
  • Add CHANGELOG.asciidoc entry
  • Commit message follows commit guidelines

@github-actions github-actions bot added the agent-nodejs Make available for APM Agents project planning. label Aug 1, 2023
@david-luna david-luna changed the base branch from main to dev/4.x August 1, 2023 12:09
.ci/tav.json Outdated
@@ -4,6 +4,7 @@
"modules": [
"@apollo/server",
"@aws-sdk/client-s3",
"@aws-sdk/client-dynamodb",
Copy link
Member Author

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) {
Copy link
Member Author

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

@david-luna david-luna marked this pull request as draft August 1, 2023 18:09
trentm
trentm previously approved these changes Aug 1, 2023
Copy link
Member

@trentm trentm left a 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.

@david-luna david-luna marked this pull request as ready for review September 14, 2023 10:24
.tav.yml Show resolved Hide resolved

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);
Copy link
Member Author

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.

Copy link
Member

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

Copy link
Member Author

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 :)

Copy link
Member Author

@david-luna david-luna left a 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

.ci/scripts/test.sh Show resolved Hide resolved

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);
Copy link
Member

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

CHANGELOG.asciidoc Outdated Show resolved Hide resolved
lib/instrumentation/modules/@aws-sdk/client-dynamodb.js Outdated Show resolved Hide resolved
@trentm
Copy link
Member

trentm commented Sep 14, 2023

^^ Basically all LGTM. Just the changelog entry move... and with "dismiss stale reviews", no point in an "approve".

@david-luna david-luna merged commit 3adbadf into main Sep 18, 2023
14 checks passed
@david-luna david-luna deleted the dluna/2958-aws-dynamodb-v3-instr branch September 18, 2023 17:37
fpm-peter pushed a commit to fpm-git/apm-agent-nodejs that referenced this pull request Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-nodejs Make available for APM Agents project planning.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

AWS instrumentation for SDK v3, DynamoDB
2 participants