The LangChain instrumentation registers both a module-level and a file-level hook for each provider package (e.g. @langchain/openai). Both hooks call _patch, which wraps the same prototype methods (invoke, stream, batch) with a new
proxy and callback handler. This results in every LangChain call producing duplicate gen_ai.chat spans. The fix adds a __sentry_patched__ guard on the prototype to skip patching if it's already been done.