-
Notifications
You must be signed in to change notification settings - Fork 835
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
Allow aliases when requiring instrumented libraries #2110
Comments
Playing with the idea a bit further, for that to be implemented, we need to change how we use
|
Yeah, great idea, I think this would allow people that forked libraries (e.g. typeorm) and published under a different name to still use the existing instrumentation libraries. E.g. instead of |
I think this will fix #1391 also |
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days. |
This issue was closed because it has been stale for 14 days with no activity. |
Instrumentations don't apply hooks when the library name given to
require
doesn't match instrumentation module definition's name exactly.Suppose I'm using a package called
foobar
and I alias it in package.json like this and there exists aFoobarInstrumentation
which matches againstfoobar
:Now when I call
require("foobar2")
the instrumentation module definition's name,foobar
does not match it exactly and the instrumentation is not loaded:https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-instrumentation/src/platform/node/instrumentation.ts#L146-L147
Besides aliases it will be useful when testing instrumentations, e.g. it will be possible to have multiple versions of the same library:
Now the tests will be able to do both
require("foobar1")
andrequire("foobar2")
, both of them will be instrumented.The text was updated successfully, but these errors were encountered: