Summary
When sap_cloud_sdk.core.telemetry.auto_instrument() is called in an environment that has wrapt>=2, the LangChain instrumentor fails to install with:
ERROR:root:Error initializing LangChain instrumentor: wrap_function_wrapper() got an unexpected keyword argument 'module'
Traceloop.init swallows the exception and proceeds, so the rest of the OTel pipeline keeps working (other instrumentors, exporters, baggage processor) — but no LangChain / LangGraph spans are emitted, which silently breaks observability for any agent built on LangChain or LangGraph.
Root cause
traceloop-sdk (currently ~=0.54.0 in pyproject.toml) pulls opentelemetry-instrumentation-langchain (latest published: 0.60.0).
opentelemetry-instrumentation-langchain calls:
wrap_function_wrapper(module="langchain...", name="...", wrapper=...)
wrapt 2.x changed wrap_function_wrapper to wrap_function_wrapper(target, name, wrapper) — the module keyword no longer exists, so the call raises TypeError.
- There is currently no released
opentelemetry-instrumentation-langchain version that fixes this, so simply bumping traceloop-sdk does not resolve it.
Reproduction
requirements.txt:
sap-cloud-sdk==0.13.0 # also reproduces with 0.14.x
langchain>=1.0
langgraph>=1.0
Make sure wrapt 2.x is installed (it is currently the latest, so a fresh install gets it):
pip install -r requirements.txt
pip show wrapt # Version: 2.x
Minimal app:
from sap_cloud_sdk.core.telemetry import auto_instrument
auto_instrument() # OTEL_EXPORTER_OTLP_ENDPOINT or OTEL_TRACES_EXPORTER=console must be set
Console output includes:
ERROR:root:Error initializing LangChain instrumentor: wrap_function_wrapper() got an unexpected keyword argument 'module'
Confirmed in:
wrapt==2.1.2
opentelemetry-instrumentation-langchain==0.60.0
traceloop-sdk from sap-cloud-sdk==0.13.0 and observed against 0.14.1 (traceloop-sdk~=0.54.0)
Impact
- Any consumer running LangChain / LangGraph agents loses LangChain/LangGraph spans (no chain, node, or graph spans visible in the configured trace backend such as MLflow / OTLP collector / Jaeger).
- Only the silent log line above tells the user; nothing fails loudly.
Proposed fix
Two complementary actions:
- Interim: add
wrapt<2 to pyproject.toml [project] dependencies so the SDK pulls a wrapt 1.x (e.g. 1.17.2) where wrap_function_wrapper(module=...) is still accepted. PR to follow.
- Long term: track the upstream fix in traceloop/openllmetry →
opentelemetry-instrumentation-langchain → switch to positional args (wrap_function_wrapper(target, name, wrapper)); remove the wrapt<2 constraint once a fixed instrumentor release is published and traceloop-sdk pins it.
Happy to update the PR if a different shape is preferred (e.g. a constraint inside the optional starlette/AI extra rather than the core dependency list).
Summary
When
sap_cloud_sdk.core.telemetry.auto_instrument()is called in an environment that haswrapt>=2, the LangChain instrumentor fails to install with:Traceloop.initswallows the exception and proceeds, so the rest of the OTel pipeline keeps working (other instrumentors, exporters, baggage processor) — but no LangChain / LangGraph spans are emitted, which silently breaks observability for any agent built on LangChain or LangGraph.Root cause
traceloop-sdk(currently~=0.54.0inpyproject.toml) pullsopentelemetry-instrumentation-langchain(latest published:0.60.0).opentelemetry-instrumentation-langchaincalls:wrapt 2.xchangedwrap_function_wrappertowrap_function_wrapper(target, name, wrapper)— themodulekeyword no longer exists, so the call raisesTypeError.opentelemetry-instrumentation-langchainversion that fixes this, so simply bumpingtraceloop-sdkdoes not resolve it.Reproduction
requirements.txt:Make sure
wrapt 2.xis installed (it is currently the latest, so a fresh install gets it):pip install -r requirements.txt pip show wrapt # Version: 2.xMinimal app:
Console output includes:
Confirmed in:
wrapt==2.1.2opentelemetry-instrumentation-langchain==0.60.0traceloop-sdkfromsap-cloud-sdk==0.13.0and observed against0.14.1(traceloop-sdk~=0.54.0)Impact
Proposed fix
Two complementary actions:
wrapt<2topyproject.toml[project] dependenciesso the SDK pulls awrapt 1.x(e.g.1.17.2) wherewrap_function_wrapper(module=...)is still accepted. PR to follow.opentelemetry-instrumentation-langchain→ switch to positional args (wrap_function_wrapper(target, name, wrapper)); remove thewrapt<2constraint once a fixed instrumentor release is published andtraceloop-sdkpins it.Happy to update the PR if a different shape is preferred (e.g. a constraint inside the optional
starlette/AI extra rather than the core dependency list).