Skip to content

fix(observability): map user_prompt -> input.value (Langfuse Input was null) - #59

Merged
AndreJorgeLopes merged 1 commit into
mainfrom
fix/langfuse-otel-input-content
Jul 2, 2026
Merged

fix(observability): map user_prompt -> input.value (Langfuse Input was null)#59
AndreJorgeLopes merged 1 commit into
mainfrom
fix/langfuse-otel-input-content

Conversation

@AndreJorgeLopes

Copy link
Copy Markdown
Owner

TL;DR

Two reported issues: (1) traces stopped after a reboot, (2) input/output showing null.

Root causes + fixes:

  • No traces after reboot — 4 of 7 langfuse containers (clickhouse, redis, minio, otel-collector) were removed and did not auto-recreate, so web was unhealthy and nothing ingested. Brought the full stack up; restart: unless-stopped on every service carries them across future reboots. (No code change needed.)
  • Input null — Claude Code emits the prompt as span attr user_prompt (on claude_code.interaction), but Langfuse reads Input from OpenInference input.value. This PR adds an OTTL transform user_prompt -> input.value.
  • Tokens + cost already worked (the 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

…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>
Copilot AI review requested due to automatic review settings July 2, 2026 21:37
@AndreJorgeLopes
AndreJorgeLopes merged commit e25b758 into main Jul 2, 2026
1 check passed
@AndreJorgeLopes
AndreJorgeLopes deleted the fix/langfuse-otel-input-content branch July 2, 2026 21:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"] when user_prompt is 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.

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.

2 participants