-
Notifications
You must be signed in to change notification settings - Fork 515
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
shared use of node-fetch
by app and resource-detector-gcp
can result in https
module not getting instrumented
#2440
Comments
https
module is not auto-instrumentednode-fetch
by app and resource-detector-gcp
can result in https
module not getting instrumented
Re-stating the issue. The application use OTel via: node --require @opentelemetry/auto-instrumentations-node/register app.js The application is using const fetch = require('node-fetch');
// ...
fetch('https://httpbin.org/post', ...) Problem: there is no HTTP client span for the outgoing the issueThe require-in-the-middle hook to instrument Both OTel and the app are using the same % npm ls node-fetch
[email protected] /Users/trentm/tmp/oteljs-node-fetch-q
├─┬ @opentelemetry/[email protected]
│ └─┬ @opentelemetry/[email protected]
│ └─┬ [email protected]
│ └─┬ [email protected]
│ └── [email protected] deduped
└── [email protected] The A workaround is for the application code manually The general issue. Assuming OTel bootstrapping (e.g. via Practically speaking, I don't expect there to be any or many other occurrences of this. fix optionsI'm discussing options for fixing the specific issue with
... or other options I haven't thought of. |
FYI: discussed this a bit on the OTel JS SIG today: https://docs.google.com/document/d/1tCyoQK49WVcE-x8oryZOTTToFm7sIeUhxFPm9g-qL1k/edit#heading=h.rg479jqq3jo5 |
@trentm beat me to it with the comment but clicking comment anyway for posterity: |
If I'm not wrong we had a similar situation with
|
What version of OpenTelemetry are you using?
What version of Node are you using?
v20.16.0
What did you do?
Tried to get auto-instrumented metrics out of uses of
node-fetch@v2
.Basic express app setup that doesn't work:
https://gist.github.com/sjparkinson/3cd2061c1c8c7257787f15a66b5e574c/12075e305e88b53ae1556a5ea5b4cdcb96810b04
What did you expect to see?
Traces and metrics from
instrumentation-http
for uses ofnode-fetch
.What did you see instead?
Only traces from
instrumentation-net
for uses ofnode-fetch
.Additional context
As reported by Trent in the CNCF Slack, it looks to be an issue with
resource-detector-gcp
requiringgaxios
which requires the two Node.js http/https modules before they are instrumented.The text was updated successfully, but these errors were encountered: