Skip to content

feat(instrumentation-nestjs-core): add support for NestJS 11 #2685

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

Merged

Conversation

neilime
Copy link
Contributor

@neilime neilime commented Jan 29, 2025

Which problem is this PR solving?

  • nest-core instrumentation is not supporting last version of NestJS (11)

Short description of the changes

  • Adding support for NestJS 11

Copy link

linux-foundation-easycla bot commented Jan 29, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: neilime / name: Emilien Escalle (b1fbaf7)

@github-actions github-actions bot added pkg:instrumentation-nestjs-core pkg-status:unmaintained This package is unmaintained. Only bugfixes may be acceped until a new owner has been found. labels Jan 29, 2025
@neilime neilime force-pushed the feat/nestjs-core-support-nestjs11 branch from 6747378 to 9f42c15 Compare January 29, 2025 13:13
@neilime neilime marked this pull request as ready for review January 29, 2025 14:19
@neilime neilime requested a review from a team as a code owner January 29, 2025 14:19
@neilime neilime force-pushed the feat/nestjs-core-support-nestjs11 branch from 9f42c15 to 2cc7772 Compare January 29, 2025 18:28
Copy link
Contributor

This package does not have an assigned component owner and is considered unmaintained. As such this package is in feature-freeze and this PR will be closed with 14 days unless a new owner or a sponsor (a member of @open-telemetry/javascript-approvers) for the feature is found. It is the responsibility of the author to find a sponsor for this feature.
Are you familiar with this package? Consider becoming a component owner.

@neilime neilime force-pushed the feat/nestjs-core-support-nestjs11 branch 2 times, most recently from 06d3115 to 09f29c9 Compare February 7, 2025 10:59
@neilime
Copy link
Contributor Author

neilime commented Feb 7, 2025

@dyladan any chance to have some review, or any advice to move forward with this instrumentation

@david-luna
Copy link
Contributor

Thanks for your contribution @neilime :)

you need to also update tav.yml to include the new version in test-all-versions workflow

@neilime neilime force-pushed the feat/nestjs-core-support-nestjs11 branch 2 times, most recently from e945812 to 62582a7 Compare February 11, 2025 15:32
@neilime
Copy link
Contributor Author

neilime commented Feb 11, 2025

@david-luna it's done

Copy link

codecov bot commented Feb 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.55%. Comparing base (2b7feac) to head (b1fbaf7).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2685   +/-   ##
=======================================
  Coverage   90.55%   90.55%           
=======================================
  Files         168      168           
  Lines        8078     8078           
  Branches     1548     1548           
=======================================
  Hits         7315     7315           
  Misses        763      763           
Files with missing lines Coverage Δ
...instrumentation-nestjs-core/src/instrumentation.ts 95.45% <100.00%> (ø)
🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@neilime neilime force-pushed the feat/nestjs-core-support-nestjs11 branch 4 times, most recently from 2825793 to ff88bc2 Compare February 18, 2025 17:39
@neilime
Copy link
Contributor Author

neilime commented Feb 18, 2025

@david-luna or @pichlermarc can you approve the workflows, I've fixed the failing tests. Thanks

@david-luna
Copy link
Contributor

Unit tests are failing for Node.js v14
https://github.com/open-telemetry/opentelemetry-js-contrib/actions/runs/13396741804/job/37462305503?pr=2685

> @opentelemetry/instrumentation-nestjs-core@0.44.0 test
> nyc mocha --timeout 5000 'test/**/*.test.ts'



  nestjs-core
    1) "before each" hook for "should capture setup"
    2) "after each" hook for "should capture setup"


  0 passing (58ms)
  2 failing

  1) nestjs-core
       "before each" hook for "should capture setup":
     /home/runner/work/opentelemetry-js-contrib/opentelemetry-js-contrib/plugins/node/opentelemetry-instrumentation-nestjs-core/node_modules/@nestjs/common/file-stream/streamable-file.js:36
            this.options.length ??= bufferOrReadStream.length;
                                             ^^^

That version of node does not support this kind of assignment. We should skip tests for that version of node.

@neilime
Copy link
Contributor Author

neilime commented Feb 19, 2025

Unit tests are failing for Node.js v14 https://github.com/open-telemetry/opentelemetry-js-contrib/actions/runs/13396741804/job/37462305503?pr=2685

> @opentelemetry/instrumentation-nestjs-core@0.44.0 test
> nyc mocha --timeout 5000 'test/**/*.test.ts'



  nestjs-core
    1) "before each" hook for "should capture setup"
    2) "after each" hook for "should capture setup"


  0 passing (58ms)
  2 failing

  1) nestjs-core
       "before each" hook for "should capture setup":
     /home/runner/work/opentelemetry-js-contrib/opentelemetry-js-contrib/plugins/node/opentelemetry-instrumentation-nestjs-core/node_modules/@nestjs/common/file-stream/streamable-file.js:36
            this.options.length ??= bufferOrReadStream.length;
                                             ^^^

That version of node does not support this kind of assignment. We should skip tests for that version of node.

That's weird, as the test is failing with "@nestjs/common@^8.0.0", so something that didnt change.
I think this is a side effect of a dev deps upgrade.

I will test them one by one in nodejs 14 context

@neilime neilime force-pushed the feat/nestjs-core-support-nestjs11 branch from ff88bc2 to 29ec165 Compare February 19, 2025 12:59
@neilime
Copy link
Contributor Author

neilime commented Feb 19, 2025

@david-luna I will separate the PR in 2 commits, one for dev deps upgrade, one for NestJS 11 upgrade.

I've made the first one, it works fine on local with nodejs 14, can you approve workflow to validate it passes on CI

@gperdomor
Copy link

@neilime I think this line should be updated too:
const supportedVersions = ['>=4.0.0 <11']; to something like const supportedVersions = ['>=4.0.0 <12'];

@neilime
Copy link
Contributor Author

neilime commented Feb 20, 2025

@neilime I think this line should be updated too: const supportedVersions = ['>=4.0.0 <11']; to something like const supportedVersions = ['>=4.0.0 <12'];

Yes it will be but as we have some weird issue with node 14, I separate the PR in two commits:

See #2685 (comment)

I'm waiting the CI validation of the first one before doing the second one

@neilime
Copy link
Contributor Author

neilime commented Feb 20, 2025

Now it's failing on mongodb tests with nodejs 18... Looks more and more weird.

I will try to rebase to be up to date with main.

Is there any way to allows workflow every time for this PR? it is very time consuming to wait for validation every time.

@neilime
Copy link
Contributor Author

neilime commented Feb 26, 2025

@david-luna @gperdomor @pichlermarc, I think the PR is good to pass all tests.

After many attempts to fix flaky tests, handle node 14 issues...

I've made the CI pass on my form repository, I you can approve the workflow it will be great.

Thanks

@mimiz
Copy link

mimiz commented Mar 4, 2025

Hello, is there a way to help on this PR ?

@neilime
Copy link
Contributor Author

neilime commented Mar 4, 2025

Hello, is there a way to help on this PR ?

On my side, I'm just waiting for CI workflows approval and some reviews

@neilime neilime force-pushed the feat/nestjs-core-support-nestjs11 branch from 1190482 to e910bfd Compare March 4, 2025 08:57
@darraghenright
Copy link

Thanks a million for this @neilime

Copy link

@mimiz mimiz left a comment

Choose a reason for hiding this comment

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

Hello,
It seems the modification is very simple, that CI checks are ok (tests and code quality), so this PR can be approved

@david-luna
Copy link
Contributor

@neilime there have been changes you need to sync. I've already created an issue for the mongodb tests #2757

I'll try to allocate time this week.

Cheers

@neilime neilime force-pushed the feat/nestjs-core-support-nestjs11 branch from e910bfd to e6f04e8 Compare March 19, 2025 08:08
@neilime
Copy link
Contributor Author

neilime commented Mar 19, 2025

@neilime there have been changes you need to sync. I've already created an issue for the mongodb tests #2757

I'll try to allocate time this week.

Cheers

@david-luna it's done, thank you for checking it.

@neilime neilime force-pushed the feat/nestjs-core-support-nestjs11 branch from e6f04e8 to 4e0613b Compare March 19, 2025 16:12
@neilime neilime requested a review from david-luna March 19, 2025 16:13
@david-luna david-luna added the has:sponsor This package or feature has a sponsor that has volunteered to review PRs and respond to questions label Mar 19, 2025
@@ -35664,31 +35290,6 @@
"@opentelemetry/api": "^1.3.0"
}
},
"plugins/node/opentelemetry-instrumentation-aws-sdk/node_modules/@aws-sdk/types": {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is odd and unrelated to the dependencies we're modifying in this PR. Could you please sync with main and run npm install again?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@david-luna to be clean I've restarted from main and re-apply needed changes. Now the package-lock.json must be good.

Copy link
Contributor

Choose a reason for hiding this comment

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

looks good! Thank you :)

@neilime neilime force-pushed the feat/nestjs-core-support-nestjs11 branch from 4e0613b to 5863c2b Compare March 19, 2025 17:00
@neilime neilime requested a review from david-luna March 19, 2025 17:02
Signed-off-by: Emilien Escalle <emilien.escalle@escemi.com>
@neilime neilime force-pushed the feat/nestjs-core-support-nestjs11 branch from f3ac768 to b1fbaf7 Compare March 20, 2025 08:26
@david-luna
Copy link
Contributor

The only error in CI is the mongodb instrumentation test for nodejs v20.6.0. I'm working on it in #2764

@david-luna david-luna changed the title feat(instrumentation): add support for NestJS 11 feat(instrumentation-nestjs-core): add support for NestJS 11 Mar 20, 2025
@david-luna
Copy link
Contributor

@neilime I was able to reproduce the test failure in another PR (ref). So I think this one is good to go :)

@david-luna david-luna merged commit 67e37b7 into open-telemetry:main Mar 20, 2025
23 of 24 checks passed
@dyladan dyladan mentioned this pull request Mar 20, 2025
deejay1 pushed a commit to deejay1/opentelemetry-js-contrib that referenced this pull request Apr 14, 2025
…lemetry#2685)

Signed-off-by: Emilien Escalle <emilien.escalle@escemi.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has:sponsor This package or feature has a sponsor that has volunteered to review PRs and respond to questions pkg:instrumentation-nestjs-core pkg-status:unmaintained:autoclose-scheduled pkg-status:unmaintained This package is unmaintained. Only bugfixes may be acceped until a new owner has been found.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants