Replies: 5 comments 4 replies
-
|
The limitation you're encountering is a known constraint when using the Langfuse LangChain integration with multiple projects.(1) In the Python SDK, there was a similar issue where the Current Status:
Recommended Approach:
Unfortunately, there isn't currently a supported way to pass different credentials per-request to the TypeScript 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
@vilmiran Thanks for raising this! Are you looking for routing specific events to different projects (difficult to achieve currently), or would you like to simply export all events to multiple projects (possible via registering multiple LangfuseSpanProcessors with differently scoped keys in your OTEL setup)? |
Beta Was this translation helpful? Give feedback.
-
|
Hi, We have managed to send traces to different Langfuse projects from the same application. From what we understand, Open Telemetry allows you to define an array of Span Processors to send traces to different "systems." We have added the LangfuseSpanProcessor twice, configuring each instance with the keys that point to a specific project. Do you see any issues with using it this way? Thanks. |
Beta Was this translation helpful? Give feedback.
-
|
What you mention sounds promising and seems like it could help us solve the problem. Currently, although we’re able to route and send traces to multiple projects as you described, only the parent trace is being sent to the Langfuse project. We tested the code from the pull request, but we noticed that in the onStart method of the LangfuseSpanProcessor, the parent context appears empty, so nothing is propagated to the child spans. Do we need to modify anything else in the code to make it work as expected? |
Beta Was this translation helpful? Give feedback.
-
|
@hassiebp we are running into the same issue. We have many langfuse projects and different api keys/ project. Depending on the organization that's is invoking the function. We use a separate langfuse config and send those specific traces to that. Whats the best workable solution to get around this? We are also using the manual method for observations (since that is most similar to v3 for now) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I’ve recently upgraded from typescript @langfuse/langchain v3.x to v4.x, and I’ve encountered a limitation regarding the usage of multiple Langfuse projects in a single application.
Previous behavior (v3.x):
In v3.x, I was able to pass different publicKey, secretKey, and baseUrl directly to the CallbackHandler constructor:
new CallbackHandler({
secretKey,
publicKey,
baseUrl,
userId,
sessionId,
tags,
metadata
});
This allowed me to send traces to different Langfuse projects within the same app.
Current behavior (v4.x):
With @langfuse/langchain@^4.2.1, the CallbackHandler constructor only accepts user/session metadata, and the Langfuse client configuration (publicKey, secretKey, baseUrl) is only read from environment variables:
new CallbackHandler({
userId,
sessionId,
tags,
traceMetadata
});
I cannot find a way to use different credentials for different projects in the same process. The docs seem to recommend only global environment variables, which prevents sending traces to multiple Langfuse projects from a single app instance.
Could you please advise on how to send traces to multiple Langfuse projects from a single TypeScript application, or if there is a recommended workaround for this scenario?
Thank you!!
Beta Was this translation helpful? Give feedback.
All reactions