-
Notifications
You must be signed in to change notification settings - Fork 534
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
nestjs depends on types from devDependency, failing compilation #985
Comments
We had several issues like this in the past resulting in moving types into dependencies resulting in complains by consumers that the version specified by the instrumentation differs from that one used by the end user. see for example (there are more) I think we have to get rid of type definitions of the instrumented module in the instrumentation API. |
Me too. Would like to start with @rauno56 - You wrote the instrumentation, right? Does it make sense to you to remove the type above? |
Some more references: it's not an easy topic and most likely resulting in some breakage. Also the hook concept quite some instrumentation have will be harder to use as we can't use a well known type there without leaking the type dependency. |
Thanks for the references, I need to free up some time to dive deep into the details |
I don't see another solution. For packages that rely on This autoinstrumentation PR reveals more:
|
I'm getting exactly these errors, is there any workaround? I see that there's an upcoming fix #1017 but with the current release cycle idk when to expect it UPDATE: as a workaround added all of these dependencies to the devDependencies of my project and the build succeeded |
A workaround is to add |
What version of OpenTelemetry are you using?
1.0.1
What version of Node are you using?
v16.14.0
What did you do?
yarn add @opentelemetry/instrumentation-nestjs-core
->"@opentelemetry/instrumentation-nestjs-core": "0.28.3"
and then:This package does not depend on nestjs directly.
When
yarn build
ing the package, following error printed to console:This message is valid, as the nestjs instrumentation indeed does this:
which transpile into the
instrumentation.d.ts
file inbuild
as:So in order for this package to work correctly in typescript, we will need to include these types in the regular "dependencies" which also means dragging a dependency on the entire
@nestjs/core
for all users just for the type.Another alternative would be to remove the type from InstrumentationBase, replacing it with
any
and thus having no type import in the public interface. It seems to not be used for anything anyhow.The other type imports from
@nestjs/*
are not exported to the public interface so I think they are safe to use ininstrumentation.ts
:If there is support for this change, I can work on a PR to add it.
@rauno56
The text was updated successfully, but these errors were encountered: