Skip to content

fix(telemetry): capture Langfuse trace input and output - #177

Merged
cnjack merged 1 commit into
mainfrom
fix/langfuse-trace-input-output
Jul 30, 2026
Merged

fix(telemetry): capture Langfuse trace input and output#177
cnjack merged 1 commit into
mainfrom
fix/langfuse-trace-input-output

Conversation

@cnjack

@cnjack cnjack commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • capture the latest safe user input on Langfuse coding-agent traces
  • record the final agent response as trace output
  • cover plain and multimodal trace payload handling

Testing

  • go test ./internal/telemetry ./internal/runner

Summary by CodeRabbit

  • Enhancements

    • Langfuse tracing now captures the latest user input and the agent’s final response.
    • Multimodal inputs are represented safely without exposing image data or URLs.
    • Trace completion is recorded more reliably for improved observability.
  • Tests

    • Added coverage validating user-input capture, multimodal redaction, and final-response recording.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a41651a6-f51e-4543-9311-1bec3a24d63c

📥 Commits

Reviewing files that changed from the base of the PR and between da0e32a and d468db6.

📒 Files selected for processing (3)
  • internal/runner/runner.go
  • internal/telemetry/langfuse.go
  • internal/telemetry/langfuse_multimodal_test.go

📝 Walkthrough

Walkthrough

Langfuse tracing now records safe input from the latest user message and the final runner response. Multimodal content is replaced with an image placeholder, and tests capture and verify trace creation and completion payloads.

Changes

Langfuse tracing

Layer / File(s) Summary
Trace input and finalization
internal/telemetry/langfuse.go, internal/telemetry/langfuse_multimodal_test.go
Trace creation records safe latest-user input, multimodal content is redacted, trace completion records output, and tests verify both payloads.
Runner trace wiring
internal/runner/runner.go
Run passes messages when creating traces and passes its named response when ending them.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Run
  participant LangfuseTracer
  participant LangfuseClient
  Run->>LangfuseTracer: WithNewTrace(messages)
  LangfuseTracer->>LangfuseClient: CreateTrace with safe input
  Run->>LangfuseTracer: EndTrace(response)
  LangfuseTracer->>LangfuseClient: EndTrace with output
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: capturing Langfuse trace input and output.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/langfuse-trace-input-output

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cnjack
cnjack merged commit d63dd31 into main Jul 30, 2026
4 checks passed
@cnjack
cnjack deleted the fix/langfuse-trace-input-output branch July 30, 2026 03:22
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