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

chore: instrument smithy-client v2 #3526

Merged
merged 8 commits into from
Jul 31, 2023
Merged

Conversation

david-luna
Copy link
Member

@david-luna david-luna commented Jul 31, 2023

Add support for @smithy/smithy-client v2+. This version is introduced by @aws-sdk/client-s3 and others in version v3.378.0

Looking at the major release of smithy-client there are breaking changes in its types but these are not affecting the middlewares of the AWS clients so its safe to add support for it.

Closes #3523

Checklist

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

@david-luna david-luna self-assigned this Jul 31, 2023
@github-actions github-actions bot added the agent-nodejs Make available for APM Agents project planning. label Jul 31, 2023
@@ -37,7 +37,7 @@ const nodeHasInstrumentableFetch = typeof (global.fetch) === 'function'

var MODULES = [
'@apollo/server',
['@aws-sdk/smithy-client', '@smithy/smithy-client'], // Instrument the base client which all AWS-SDK v3 clients extends.
['@smithy/smithy-client', '@aws-sdk/smithy-client'], // Instrument the base client which all AWS-SDK v3 clients extends.
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 to reviewer: moved the smithy client file so path represents properly the namespace of the package on its recent version

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.

/test tav @aws-sdk/client-s3

@david-luna david-luna marked this pull request as ready for review July 31, 2023 15:41
@david-luna david-luna requested a review from trentm July 31, 2023 15:41
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.

/test tav @aws-sdk/client-s3 16

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.

Need to fix the package-lock file.

Copy link
Member

Choose a reason for hiding this comment

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

This accidentally changed to lockfileVersion: 1:

diff --git a/package-lock.json b/package-lock.json
index 51f534bf..bc50cde7 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,17985 +1,8 @@
 {
   "name": "elastic-apm-node",
   "version": "3.48.0",
-  "lockfileVersion": 2,
+  "lockfileVersion": 1,
...

I think you may have npm installed with an older version of Node than v16.

@trentm
Copy link
Member

trentm commented Jul 31, 2023

The huge change to package-lock.json here is partly due to the git diff algorithm. It is more sane with the "patience" algorithm:

% git diff main...  | wc -l
   35913

% git diff --patience main...  | wc -l
    7261

A lot of the diff is because these devDeps are at different versions:

    "@aws-sdk/client-s3": "^3.379.1",
    "@aws-sdk/s3-request-presigner": "^3.363.0",

Leading to a loss of a lot of possible dedupes for common transitive deps -- now at different versions. I'll upgrade the latter and see if that helps.

@trentm
Copy link
Member

trentm commented Jul 31, 2023

Yes, that helps a lot. For example, instead of >30 installations of @smithy/types, there is now just one:

% npm ls @smithy/types | rg -v deduped | rg smithy/types
│ ├── @smithy/[email protected]

And the diff is reduced:

% git diff --patience main...  | wc -l
    3648

and with the default algorithm as well:

% git diff  main...  | wc -l
    3660

@david-luna I think as a rule, if we update one @aws-sdk/... dep, we should update them all.

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.

LGTM, assuming tests pass again.

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.

/test tav @aws-sdk/client-s3

@trentm trentm merged commit c79872b into main Jul 31, 2023
42 checks passed
@trentm trentm deleted the dluna/smithy-client-v2-support branch July 31, 2023 23:10
fpm-peter pushed a commit to fpm-git/apm-agent-nodejs that referenced this pull request Aug 20, 2024
`@smithy/client@2` is used in `@aws-sdk/*` v3.378.0 and later.

Closes: elastic#3523
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
None yet
Development

Successfully merging this pull request may close these issues.

@aws-sdk/client-s3 TAV tests failing in main
2 participants