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

[nodejs] create new weblog for express 5 #3572

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

Conversation

IlyasShabi
Copy link
Contributor

@IlyasShabi IlyasShabi commented Nov 27, 2024

Motivation

Express has released a new version, v5, which includes some breaking changes compared to v4. We have a PR ready for review and merging on dd-trace-js. Additionally, we need to create a weblog for Express 5 to identify potential breaking changes and ensure our instrumentation remains compatible.

Changes

  • Change express4 folder name to express
  • Change all express dockerfile configuration
  • Exclude graphql and mongo sanitize from express 5

Workflow

  1. ⚠️ Create your PR as draft ⚠️
  2. Work on you PR until the CI passes (if something not related to your task is failing, you can ignore it)
  3. Mark it as ready for review
    • Test logic is modified? -> Get a review from RFC owner. We're working on refining the codeowners file quickly.
    • Framework is modified, or non obvious usage of it -> get a review from R&P team

🚀 Once your PR is reviewed, you can merge it!

🛟 #apm-shared-testing 🛟

Reviewer checklist

  • If PR title starts with [<language>], double-check that only <language> is impacted by the change
  • No system-tests internal is modified. Otherwise, I have the approval from R&P team
  • CI is green, or failing jobs are not related to this change (and you are 100% sure about this statement)
  • A docker base image is modified?
    • the relevant build-XXX-image label is present
  • A scenario is added (or removed)?

@@ -558,84 +563,106 @@ tests/:
Test_Kafka:
'*': irrelevant
express4: v0.1 # real version not known
express5: v0.1 # real version not known
Copy link
Contributor Author

@IlyasShabi IlyasShabi Nov 28, 2024

Choose a reason for hiding this comment

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

Question: Versioning is more related to features rather than instrumentation or weblogs. Do you think I should use the same versions as express 4?

Copy link
Contributor

Choose a reason for hiding this comment

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

As express5 is not yet supported, I think that you can't set any version <5.29.0 or <4.53.0 (next release) for any test.

@IlyasShabi IlyasShabi marked this pull request as ready for review November 29, 2024 07:44
@IlyasShabi IlyasShabi requested review from a team as code owners November 29, 2024 07:44
@@ -215,7 +215,7 @@ elif [ "$TARGET" = "agent" ]; then
elif [ "$TARGET" = "nodejs" ]; then
assert_version_is_dev
# NPM builds the package, so we put a trigger file that tells install script to get package from github#master
echo "DataDog/dd-trace-js#master" > nodejs-load-from-npm
echo "DataDog/dd-trace-js#express5" > nodejs-load-from-npm
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be removed after review


WORKDIR /usr/app

ENV NODE_ENV=production

RUN npm install
RUN npm install "express@^4.17.2" "apollo-server-express@^3.13.0" "express-mongo-sanitize@^2.2.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

as package-lock.json will not work for these dependencies, should we fix the versions?

Suggested change
RUN npm install "express@^4.17.2" "apollo-server-express@^3.13.0" "express-mongo-sanitize@^2.2.0"
RUN npm install "[email protected]" "[email protected]" "[email protected]"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

ENV NODE_ENV=production

RUN npm install
RUN npm install "express@^5.0.1"
Copy link
Contributor

Choose a reason for hiding this comment

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

as package-lock.json will not work for these dependencies, should we fix the versions?

RUN npm install "[email protected]"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@CarlesDD CarlesDD left a comment

Choose a reason for hiding this comment

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

missing_feature decorator for this test should be addressed to check the new weblog variant for express5.

Copy link
Collaborator

@cbeauchesne cbeauchesne left a comment

Choose a reason for hiding this comment

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

I'm not a node expert, but would it be more reliable to have a package/lock per weblog, rather a common one + a dedicated npm install ?

@@ -37,7 +40,10 @@ def test_source_get_reported(self):
""" for use case where only one is reported, we want to keep a test on the one reported """
self.validate_request_reported(self.requests["GET"])

@missing_feature(weblog_variant="express4", reason="Tainted as request body")
@missing_feature(
Copy link
Collaborator

Choose a reason for hiding this comment

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

This change is surprising, it goes from weblog_variant == "express4" to weblog_variant not in ["express4" ...). Is it intended ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks I will fix this, the feature is currently marked as missing in nodejs.yml
The failing test in nodejs prod is expected as my PR hasn't been merged yet.

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok, passing the PR as draft to unstress my noti stack. You can set it back to normal once it's ready to be merged.

Copy link
Collaborator

@cbeauchesne cbeauchesne left a comment

Choose a reason for hiding this comment

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

Some CI failures to fix, probably related to my comment.

@cbeauchesne cbeauchesne marked this pull request as draft November 29, 2024 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants