fix(observability): map user_prompt -> input.value (Langfuse Input was null) - #59
Merged
Merged
Conversation
…gfuse Input isn't null
Claude Code emits the prompt as the span attribute 'user_prompt' (on
claude_code.interaction), but Langfuse reads observation Input from the OpenInference
'input.value' convention -> the Input field showed null while the prompt sat only in the
raw-attributes panel. Add an OTTL transform mapping user_prompt -> input.value.
Assistant OUTPUT text is NOT emitted on the trace signal (Claude Code sends it via the
logs signal, which Langfuse trace ingestion does not consume) -> output shows
tokens/cost/finish_reason only; documented inline.
Token usage + cost already work (the gen_ai.usage.* transform on main); the recent
'all null' was the stack being down after reboot (4 containers were removed and did not
auto-recreate) - brought back up, restart: unless-stopped carries them across reboots.
Verified: fresh trace -> observation usage {input:10,output:59,cache...} cost $0.109;
claude_code.interaction Input = the prompt text.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Updates the OpenTelemetry Collector transform used to forward Claude Code traces into Langfuse so that Langfuse’s “Input” field is populated (instead of null) by mapping Claude Code’s user_prompt span attribute onto the OpenInference input.value attribute.
Changes:
- Adds an OTTL transform statement mapping
attributes["user_prompt"]→attributes["input.value"]whenuser_promptis present. - Documents (inline) the expected limitation that assistant output text is emitted via logs rather than traces, so Langfuse trace ingestion won’t show completion text.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
Two reported issues: (1) traces stopped after a reboot, (2) input/output showing null.
Root causes + fixes:
restart: unless-stoppedon every service carries them across future reboots. (No code change needed.)user_prompt(onclaude_code.interaction), but Langfuse reads Input from OpenInferenceinput.value. This PR adds an OTTL transformuser_prompt -> input.value.gen_ai.usage.*transform is on main); the 'all null' was just the stack being down. Verified after fix: usage{input:10,output:59,cache...}, cost $0.109.Limitation (documented inline)
Assistant OUTPUT text is not on the trace signal — Claude Code emits it via the logs signal, which Langfuse trace ingestion doesn't consume. Output observations still show tokens/cost/finish_reason.
🤖 Generated with Claude Code