Skip to content
\n
{\n  \"name\": \"test-app\",\n  \"version\": \"1.0.0\",\n  \"private\": true,\n  \"type\": \"commonjs\",\n  \"engines\": {\n    \"node\": \">=16\",\n    \"npm\": \">=7\"\n  },\n  \"scripts\": {\n    \"start\": \"node index.js\"\n  },\n  \"dependencies\": {\n    \"openai\": \"^4.67.3\",\n    \"langchain\": \"^0.3.2\",\n    \"@langchain/core\": \"^0.3.11\",\n    \"@langchain/openai\": \"^0.3.7\",\n\n    \"dotenv\": \"^16.4.5\",\n    \"@traceloop/node-server-sdk\": \"^0.11.1\"\n  }\n}
","upvoteCount":1,"answerCount":7,"acceptedAnswer":{"@type":"Answer","text":"

@codefromthecrypt so the reason is an issue we have with OpenTelemetry auto-instrumentation. The only way we're able to solve it as of now is by manually instrumenting the module, like this:

\n
import * as RunnableModule from \"@langchain/core/runnables\";\n\ntraceloop.initialize({\n  disableBatch: true,\n  instrumentModules: {\n    langchain: { runnablesModule: RunnableModule },\n  },\n});\n
\n

For some reason, import-in-the-middle (which is used by OpenTelemetry for auto-instrumentation) doesn't catch some of langchain packages. I'll continue investigating this.

","upvoteCount":1,"url":"https://github.com/traceloop/openllmetry-js/discussions/468#discussioncomment-10967895"}}}
Discussion options

You must be logged in to vote

@codefromthecrypt so the reason is an issue we have with OpenTelemetry auto-instrumentation. The only way we're able to solve it as of now is by manually instrumenting the module, like this:

import * as RunnableModule from "@langchain/core/runnables";

traceloop.initialize({
  disableBatch: true,
  instrumentModules: {
    langchain: { runnablesModule: RunnableModule },
  },
});

For some reason, import-in-the-middle (which is used by OpenTelemetry for auto-instrumentation) doesn't catch some of langchain packages. I'll continue investigating this.

Replies: 7 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by nirga
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #466 on October 17, 2024 07:21.