Skip to content

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

Closed
timfish wants to merge 1 commit intonodejs:mainfrom
timfish:fix/differs-to-ritm
Closed

fix: Hook internal paths like require-in-the-middle#189
timfish wants to merge 1 commit intonodejs:mainfrom
timfish:fix/differs-to-ritm

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
Member

in that you can't patch library internals

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

@timfish
Copy link
Contributor Author

timfish commented May 24, 2025

Closing in favour of #194

@timfish timfish closed this May 24, 2025
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