-
Notifications
You must be signed in to change notification settings - Fork 826
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
[next] Deprecate old runtimes #4295
Conversation
d602748
to
7b32468
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## next #4295 +/- ##
==========================================
- Coverage 92.30% 92.24% -0.07%
==========================================
Files 330 332 +2
Lines 9424 9437 +13
Branches 1998 1999 +1
==========================================
+ Hits 8699 8705 +6
- Misses 725 732 +7
|
Test failures on node 20: Instrumentation
|
@legendecas I was looking at the prometheus test failure and the test doesn't seem to do what it says. it looks like you modified the test in https://github.com/open-telemetry/opentelemetry-js/pull/2563/files#diff-7ae372e0e2c48cb428c513beb5afdcbf243d7221760f05c67a06a060e12b6f47R368 What is this test actually testing now? Should it be renamed, fixed, or removed? |
Looks like now we're running into microsoft/TypeScript#26362 |
efd20a7
to
98ff89e
Compare
edit: seems this is not actually what caused the issue. using |
@Qard I see you were active on that loaders issue. Do you know if that's what is affecting us here or have a suggestion for how we can resolve this? |
Not sure what this issue is. Probably worth reporting on the IITM repo to get some attention on it. |
@dyladan The Node.js v20 included changes in the ESM loader so that a module is loaded in a separate thread. That impacted import-in-the-middle so that it had to manually parse ESM files itself to get a list of exports for hooking. That handling doesn't currently handle "re-exports", i.e.: export * from './platform/index'; which is this in the compiled JS: var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
__exportStar(require("./platform/index"), exports); works without re-exportsSo if you import the deeper "./build/src/platform/node/instrumentation.js" which doesn't have any re-exports, then it works:
fails with re-exportsBut if you use any of the index.js files that use re-exports:
a workaroundA workaround that allows at least the diff --git a/experimental/packages/opentelemetry-instrumentation/test/node/EsmInstrumentation.test.mjs b/experimental/packages/opentelemetry-instrumentation/test/node/EsmInstrumentation.test.mjs
index f09097cd..0163a519 100644
--- a/experimental/packages/opentelemetry-instrumentation/test/node/EsmInstrumentation.test.mjs
+++ b/experimental/packages/opentelemetry-instrumentation/test/node/EsmInstrumentation.test.mjs
@@ -15,10 +15,10 @@
*/
import * as assert from 'assert';
-import {
- InstrumentationBase,
- InstrumentationNodeModuleDefinition,
-} from '../../build/src/index.js';
+// Avoid named imports to workaround https://github.com/DataDog/import-in-the-middle/issues/29
+import mod from '../../build/src/index.js';
+const InstrumentationBase = mod.InstrumentationBase;
+const InstrumentationNodeModuleDefinition = mod.InstrumentationNodeModuleDefinition
import * as exported from 'test-esm-module';
class TestInstrumentationWrapFn extends InstrumentationBase { Note that ESM support, in general, is still going to be busted for any cases where user code (including their dependencies) uses named ESM imports that depend on re-exports. |
There is a PR open for fixing this IITM issue. It has perhaps languished. I haven't had a chance to look at it yet. (I also indirectly noticed that this "import off-thread" handling in Node v20 is being considered for backport to Node v18 in nodejs/node#50669. So there may come a v18 minor release that breaks similarly.) |
08570e8
to
f6671a2
Compare
experimental/packages/opentelemetry-instrumentation/test/node/EsmInstrumentation.test.mjs
Outdated
Show resolved
Hide resolved
b8cd126
to
e1f814f
Compare
e1f814f
to
837153a
Compare
This is now ready for review. I've decided to disable node 20 testing because larger changes will need to be made in a separate PR to fix the http instrumentation tests |
Also need a |
@trentm the browser tests actually require node 16 runtime in order to use the version of webpack we have installed. That will have to be done separately. old webpack version requires old node version. old node version prevents webpack upgrades 🔁 |
d308ff9
to
343ca78
Compare
There's an interesting new PR over at the contrib repo (open-telemetry/opentelemetry-js-contrib#1816, I did not have time to review that one yet) that looks promising - looks like karma was deprecated back in April, which means we may be able to ditch it in favor of |
aa142dd
to
934cfa1
Compare
934cfa1
to
bf30779
Compare
@@ -77,3 +77,47 @@ export interface ShimWrapped extends Function { | |||
// eslint-disable-next-line @typescript-eslint/ban-types | |||
__original: Function; | |||
} | |||
|
|||
export interface InstrumentationModuleFile<T> { |
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.
Moved out of the platform
dir because there was no web-specific version
unpatch(moduleExports?: T, moduleVersion?: string): void; | ||
} | ||
|
||
export interface InstrumentationModuleDefinition<T> { |
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.
Moved out of the platform
dir because there was no web-specific version
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.
I'm thinking we might want to just remove this entirely? It doesn't seem to be used anywhere in the main repo. I haven't yet looked in contrib.
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.
looks good, thanks for taking care of this 🙂
Fixes #3583