-
Notifications
You must be signed in to change notification settings - Fork 474
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
update nodejs autoinstrumetation, fixes #2626 #3570
base: main
Are you sure you want to change the base?
update nodejs autoinstrumetation, fixes #2626 #3570
Conversation
@open-telemetry/javascript-approvers could you have a look? 🙏 |
Signed-off-by: matteo.gazzetta <[email protected]>
0b6b81c
to
cf4ab32
Compare
Signed-off-by: matteo.gazzetta <[email protected]>
a1389c9
to
04677de
Compare
Thank you @pavolloffay i fixed the build since getResourceDetectorsFromEnv is exported as getResourceDetectors |
Actually, I think since metrics auto-configuration is now implemented, you may not even need the |
Hi @pichlermarc, are you suggesting to remove autoinstrumentation.ts here and update the code in nodejs.go to something like:
Would this approach work when referenced like this? I haven’t tested it yet. Thank you PS @swiatekm, what’s your opinion on this? |
|
Something along these lines yes. I don't think you necessarily need to reference the full path - you may be able to just ref the entrypoint:
|
710e87c
to
8726e9e
Compare
Signed-off-by: matteo.gazzetta <[email protected]>
605e371
to
c6ed877
Compare
Signed-off-by: matteo.gazzetta <[email protected]>
@pavolloffay @pichlermarc could you re-review this (I assume) final state of the change? @ElfoLiNk have you tested this with a real Node application? Our tests only check if the instrumented application starts, but not if it's actually emitting the right telemetry, so this should be verified manually with this kind of substantial change. |
@@ -22,7 +22,7 @@ import ( | |||
|
|||
const ( | |||
envNodeOptions = "NODE_OPTIONS" | |||
nodeRequireArgument = " --require /otel-auto-instrumentation-nodejs/autoinstrumentation.js" | |||
nodeRequireArgument = " --require /otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/auto-instrumentations-node/build/src/register.js" |
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.
Would this work? That's the entrypoint we provide for these kinds of things.
nodeRequireArgument = " --require /otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/auto-instrumentations-node/build/src/register.js" | |
nodeRequireArgument = " --require /otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/auto-instrumentations-node/register" |
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 tried but i got
Error: Cannot find module '/otel-auto-instrumentation-nodejs/node_modules/@opentelemetry/auto-instrumentations-node/register'
I tested today, and everything seems to be working: OTEL_LOGS_EXPORTER is empty. Using default otlp exporter. I was testing it with this configuration:
The exporter endpoint was set to port 4317. The only issue I encountered was with the metrics exporter:
To resolve this, I explicitly added OTEL_EXPORTER_OTLP_PROTOCOL to the instrumentation configuration, which resolved the issue. Additionally, both the operator and instrumentation Docker images need to be updated simultaneously. If you update only the instrumentation, you encounter the following error:
|
Description:
Update nodejs autoinstrumentation like register.ts from auto-instrumentations-node metapackage
Link to tracking Issue(s):
OTEL_NODE_RESOURCE_DETECTORS
#2626Testing:
Not tested yet
Documentation: