Skip to content

fix: Hook internal paths like require-in-the-middle #189

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

timfish
Copy link
Contributor

@timfish timfish commented Apr 29, 2025

import-in-the-middle differs from require-in-the-middle in that you can't patch library internals. Open Telemetry expects these libraries to behave in the same way so you can patch a library with the same hook configuration.

  • This is not technically breaking if import-in-the-middle was not behaving as intended and documented
  • This could result in the Hook callbacks being called a lot more, for all of a libraries internal files?

@timfish
Copy link
Contributor Author

timfish commented Apr 29, 2025

Pain. The test failures are due to openai adding some shims that you need to import first otherwise some side-effects throw errors 🤦🏻‍♂️

@AbhiPrasad
Copy link

in that you can't patch library internals

Does this mean you can only patch what is explicitly exposed via package.json exports?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Impossible to instrument @modelcontextprotocol/sdk Behavior is different from require-in-the-middle
2 participants