-
Notifications
You must be signed in to change notification settings - Fork 824
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
[plugins] modules loaded before tracer SDK #636
Comments
Probably only warn on modules that would have been instrumented. for instance if http tracer is disabled, it doesn't matter that it was loaded before us. |
Totally agree (#654), it's already implemented in all vendor specific APMs because it's such a pain to debug for end users. |
Can you please confirm that |
@naseemkullah Nope, the tracer should always be required before any module. In your example, the patch still works because we patch the |
Thanks @vmarchaud |
I'm agree with @vmarchaud. It's a good rule. I also encountered some issues as well during integrations with http if tracer was initialized after... |
…#654) * feat: warn user when a instrumented package was already required #636 * chore: address PR comments * chore: extract package name from require.cache * chore: use find instead of some * chore: use require.resolve to find already required modules * chore: try/catch require.resolve Co-authored-by: Mayur Kale <[email protected]>
I think we close this one via #654. @vmarchaud please confirm. |
@mayurkale22 indeed its done |
Co-authored-by: Daniel Dyla <[email protected]>
IMO initialization of
NodeTracer
module which provides automated tracing (instrumentation) for Node.js applications has to be the first line in the application code before loading actual modules likehttp
,redis
,grpc
etc. Loading these modules before our tracer SDK may preventus from monkeypatching those modules for automatic tracing. I have verified that w/ current http example.
I am proposing to detect list of modules that were loaded using
require()
before our tracer SDK and log awarning
orerror
to inform the users.The text was updated successfully, but these errors were encountered: