open-telemetry / opentelemetry-js-contrib

OpenTelemetry instrumentation for JavaScript modules
https://opentelemetry.io
Apache License 2.0
665 stars 490 forks source link

@opentelemetry/auto-instrumentations-node@0.39.2 unit tests are failing #2324

Open swaruparameshpajju opened 1 month ago

swaruparameshpajju commented 1 month ago

What happened?

2024-07-10 10:40:58,968 [ INFO ] oos_automation.build.@opentelemetry/auto-instrumentations-node@0.39.2 | log_utils.py | 175 :: Environment +----------------------+------------------------------------------------------------------------------------------------------+ | ENV | VALUE | |----------------------+------------------------------------------------------------------------------------------------------| | PACKAGE | @opentelemetry/auto-instrumentations-node@0.39.2 | | LANGUAGE | node | | FRAMEWORK | node | | BUILD_CMD | npm run build | | OS_NAME | Oracle Linux Server | | OS_VERSION | 8.8 | | COMPILER/INTERPRETER | node | | PYTHON_VERSION | 3.9.6 | | JAVA_VERSION | 1.8.0_382 | | MAVEN_VERSION | 3.9.4 | | GRADLE_VERSION | 8.2.1 | | ANT_VERSION | 1.10.14 | | NODE_VERSION | 16.20.2 | | CPP_VERSION | 8.5.0 | | GO_VERSION | go1.22.0 | | CARGO_VERSION | 1.75.0 | | HTTP_PROXY | www-proxy.us.oracle.com | | HTTPS_PROXY | www-proxy.us.oracle.com | | JAVA_HOME | /opt/jdk8u382-b05 | | PATH | /opt/node-v16.20.2-linux-x64/bin:/opt/jdk8u382-b05/bin:/opt/apache-ant-1.10.14/bin:/opt/apache-maven | | | -3.9.4/bin:/opt/gradle-8.2.1/bin:/opt/sbt/bin:/opt/python3.9/bin:/opt/node-v16.20.2-linux-x64/bin:/o | | | pt/go1.22.0/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | +----------------------+------------------------------------------------------------------------------------------------------+ 2024-07-10 10:40:58,968 [ DEBUG ] oos_automation.build.@opentelemetry/auto-instrumentations-node@0.39.2 | package.py | 679 :: Current dir: /builds/5G-Common/cnc-opensource/cnc-opensource-build 2024-07-10 10:40:58,968 [ INFO ] oos_automation.build.@opentelemetry/auto-instrumentations-node@0.39.2 | package.py | 831 :: Got some command in build cmds, executing it 2024-07-10 10:40:58,969 [ DEBUG ] oos_automation.build.@opentelemetry/auto-instrumentations-node@0.39.2 | cmd.py | 51 :: version='1', cmd_type='live', running command=npm run build, supress_exception=True 2024-07-10 10:40:58,976 [ INFO ] oos_automation.build.@opentelemetry/auto-instrumentations-node@0.39.2 | cmd.py | 62 :: Waiting for cmd out... [10 10:40:59.505] | npm WARN config _auth, _authToken, username and _password must be scoped to a registry. see npm help npmrc for more information. [10 10:40:59.529] | npm ERR! Missing script: "build" [10 10:40:59.529] | npm ERR! [10 10:40:59.529] | npm ERR! To see a list of scripts, run: [10 10:40:59.529] | npm ERR! npm run [10 10:40:59.531] | [10 10:40:59.532] | npm ERR! A complete log of this run can be found in: [10 10:40:59.532] | npm ERR! /root/.npm/_logs/2024-07-10T10_40_59_465Z-debug-0.log

OpenTelemetry Setup Code

No response

package.json

No response

Relevant log output

[10 10:44:48.425] | Version 4.4.4
[10 10:44:48.425] | 
[10 10:44:48.425] | > @opentelemetry/sql-common@0.40.0 compile
[10 10:44:48.425] | > tsc --build tsconfig.json
[10 10:44:56.168] | lerna ERR! lifecycle "prepare" errored in "@opentelemetry/contrib-test-utils", exiting 1
[10 10:44:56.210] | npm ERR! code 1
[10 10:44:56.210] | npm ERR! path /tmp/pkgs_raw/@opentelemetry+auto-instrumentations-node/0.39.2
[10 10:44:56.214] | npm ERR! command failed
[10 10:44:56.214] | npm ERR! command sh -c -- npm run bootstrap
[10 10:44:56.216] | 
[10 10:44:56.216] | npm ERR! A complete log of this run can be found in:
[10 10:44:56.216] | npm ERR!     /root/.npm/_logs/2024-07-10T10_41_03_237Z-debug-0.log
2024-07-10 10:44:56,247 [ WARNING  ] oos_automation.build.@opentelemetry/auto-instrumentations-node@0.39.2 | cmd.py                | 80     ::  Command failed but supress is true, error handling skipped
2024-07-10 10:44:56,247 [  ERROR   ] oos_automation.build.@opentelemetry/auto-instrumentations-node@0.39.2 | tester.py             | 110    ::  Package install failed for testing
2024-07-10 10:44:56,247 [   INFO   ] oos_automation.build.@opentelemetry/auto-instrumentations-node@0.39.2 | package.py            | 1449   ::  Tests Complete
2024-07-10 10:44:56,248 [   INFO   ] oos_automation.build.@opentelemetry/auto-instrumentations-node@0.39.2 | main_v2.py            | 377    ::  Total Test time: 3.89 minutes
JamieDanielson commented 1 month ago

@swaruparameshpajju can you provide some more detail about how this error came up? Is there a way we can reproduce this to understand what may need to be changed?

JamieDanielson commented 1 month ago

Also it looks like you are using an older version; are you able to try the latest version to see if you still have trouble?

swaruparameshpajju commented 1 month ago

Hi, need to use same version. can u suggest how to go ahead to resolve

david-luna commented 1 month ago

Hi @swaruparameshpajju

I agree with @JamieDanielson. You should try to update the package.

Maybe I'm going to do a lot of assumptions. It would be good if you can confirm them.

Based on that the the somple npm install script fails because of the following.

We see this log

[10 10:44:56.168] | lerna ERR! lifecycle "prepare" errored in "@opentelemetry/contrib-test-utils", exiting 1

and prepare script s doing a compilation https://github.com/open-telemetry/opentelemetry-js-contrib/blob/d1436eb7e4543d92e23cb1ceff15bf5cf6c3c65c/packages/opentelemetry-test-utils/package.json#L16

I've checked out the same TAG auto-instrumentations-node-v0.39.2 and got a similar compilation issue in the npm install process. Here is the output

> @opentelemetry/contrib-test-utils@0.34.1 compile
> tsc -p .

src/resource-assertions.ts:201:20 - error TS2339: Property 'NAME' does not exist on type '{ "telemetry.sdk.name": string; "process.runtime.name": string; "telemetry.sdk.language": string; "telemetry.sdk.version": string; }'.

201     name: SDK_INFO.NAME,
                       ~~~~

src/resource-assertions.ts:202:24 - error TS2339: Property 'LANGUAGE' does not exist on type '{ "telemetry.sdk.name": string; "process.runtime.name": string; "telemetry.sdk.language": string; "telemetry.sdk.version": string; }'.

202     language: SDK_INFO.LANGUAGE,
                           ~~~~~~~~

src/resource-assertions.ts:203:23 - error TS2339: Property 'VERSION' does not exist on type '{ "telemetry.sdk.name": string; "process.runtime.name": string; "telemetry.sdk.language": string; "telemetry.sdk.version": string; }'.

203     version: SDK_INFO.VERSION,
                          ~~~~~~~

Problem here is that @opentelemetry/core did change the property names if the SDK_INFO object in https://github.com/open-telemetry/opentelemetry-js/pull/2173/files#diff-7c29fd1242f26460e18708792e9636800d9f1f7320de3ef32609454df4dfca92 and npm installs a more recent version which contains this change. That was before v1.0.0 was released

So the @opentelemetry/contrib-test-utils declares a dependency of @opentelemetry/core@^1.0.0 but is using types from a previous release. There isn't an easy solution for that so I strongly recommend the update.

May I ask why exactly you need that version? And why do you have to build it by yourself since its already available in npm registry?