Deleted User
Deleted User15mo ago

external trace id

Hi, I'm just starting to mess around with LangFuse and have a couple questions. We run several chains of prompts through distributed queues/jobs. I would love to be able to pass around a trace id through the distributed jobs and be able to create spans/events/generations from that original trace id so they are all grouped together. It looks like I couldn't create a new trace from another job with the same trace id that kicked off the job. From what I can tell I can't pass an id into langfuse.trace(...) . How would you recommend tracing across several distributed queues and async prompt chains?
1 Reply
Marc
Marc15mo ago
Hi @Deleted User, in this case I'd suggest to use the externalid on traces for now as it automatically upserts the trace (helpful in distributed architectures) and you can add generations/events/spans/scores based on this external id Example const trace = langfuse.trace({ name: "chat-app-session". externalId: "my-apps-session-1234" }); const span = langfuse.span({ traceId: "my-apps-session-1234", traceIdType: "EXTERNAL", name: "chat-interaction", });