Skip to content

feat: trace stitching via LANGFUSE_TRACE_ID#1

Merged
omer362 merged 1 commit into
mainfrom
feat/trace-stitching
Apr 16, 2026
Merged

feat: trace stitching via LANGFUSE_TRACE_ID#1
omer362 merged 1 commit into
mainfrom
feat/trace-stitching

Conversation

@omer362

@omer362 omer362 commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator

Adds ParentAwareIdGenerator that reuses LANGFUSE_TRACE_ID as the OTEL trace ID, stitching OpenCode spans under the caller's Langfuse trace.

When LANGFUSE_TRACE_ID is set to a valid 32-char hex trace ID,
all OTEL spans created by the Vercel AI SDK will reuse that trace ID
instead of generating a new one. This stitches OpenCode's tool and
LLM spans under the caller's Langfuse trace.

Uses a custom IdGenerator that extends RandomIdGenerator, overriding
only generateTraceId() — span IDs remain random as usual.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@omer362 omer362 merged commit bf38af2 into main Apr 16, 2026
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant