langfuse / langfuse/langfuse-examples

Correct usage of langfuse with Spring AI

Open
#8 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
39
Forks
28
PR merge metrics
No merged PRs in 30d

Description

Dear langfuse team,

I have been trying to figure out the best way to setup langfuse with Spring AI for some time now and wanted to share where I am at.

For this, I have created a fork of the current sample application here.

Would you mind taking a look to see if:

  • This is the correct way to add the session and user id?
  • This is the correct way to set the input and output to show up in the UI on the root level?

To me, it looks like, the spans are not correctly nested:
Image

This is also the case if I don't filter out any spans that are not AI related:
Image

However, if I add tool calls, this seems to nest the spans correctly again, but won't show the parameters of the tool calls.
Image

Some other notes

  • Maybe the files in the config folder help others to see how to reduce the noise coming from opentelemetry spring boot starter. If you don't filter out the spans, you also get all other traces into langfuse, e.g.
Image

I am happy to make this example a bit nicer and more elaborate (with a tool call etc)and submit a pull request to improve the documentation a bit.

Thanks for your help

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked davidbellem/langfuse-examples fork and inspect its config folder and Spring AI setup. Compare the session and user ID, root input/output, span nesting, tool-call parameters, and OpenTelemetry filtering with the current examples. Done means the correct setup is verified and documented in a reproducible example.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
documentation, observability
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.