Langflow traces are not well reflected in Langfuse
Bug Description
Not able to see Langflow components inputs and outputs in Langfuse tracing. For instance, for a given component, you will see the component python code instead of the input data. And the Output is completely empty.
See screenshot below.
Reproduction
- create a simple flow with chat input, prompt, and a chat output! flow example reproduce _error_langfuse (1).json
- connect to Langfuse, and see trace.
- notice that components input are tracking the python code of the component and not the data inputted
- notice that the component output is empty
see screenshow:
Expected behavior
I'm expecting to see input data (not the python code) and output data of each components.
Who can help?
@italojohnny
Operating System
Ubuntu
Langflow Version
1.0.19
Python Version
3.10
Screenshot
Flow File
Langflow should capture and serialize component inputs and outputs correctly for Langfuse integration. The LangFuseTracer class is responsible for this, using methods like add_trace and end_trace to handle inputs and outputs. These methods should ensure that the actual data, not the code, is included in the trace [1].
If you're seeing code instead of data, it might be due to an issue with how inputs are being captured or serialized. The _convert_to_langwatch_types method is used to convert inputs and outputs to compatible types, which should help ensure that data is correctly represented [2].
To troubleshoot, ensure that the _cleanup_inputs method is correctly sanitizing and storing inputs, and that the LangFuseTracer is properly initialized with the necessary environment variables for Langfuse [3][4]. If the issue persists, reviewing the implementation of these methods might help identify any discrepancies in how data is being processed.
To continue talking to Dosu, mention @dosu.
In version 1.0.18 traces were working fine. Looks like something was introduced in v19 resulted into breaking things. I see tracing service logic was slightly changed when introducing ruff rules.
In version 1.0.18 traces were working fine. Looks like something was introduced in v19 resulted into breaking things. I see tracing service logic was slightly changed when introducing ruff rules.
I spend a long time debugging this. And you are right, it is a bug that was introduced in the latest version :-(.
I found that the _end_and_reset function has an issue: self._reset_io() clears the outputs before the task is executed.
Same issue here; is there an ETA on a patch?
The reported behavior was introduced specifically in commit 4221fa40e610df564971b328b3b0ee41178077a2 (PR #3694).
However, from my analysis, all trace data is still present. What changed is that the component’s Python code is now included as well, which is quite annoying.
@italojohnny other than the python code is being added into the input. The output is not showing empty. See above screenshot. Were you able to reproduce the empty output?
@italojohnny other than the python code is being added into the input. The output is not showing empty. See above screenshot. Were you able to reproduce the empty output?
Thanks for clarifying this. I also saw that output was not being produced, which was how I noticed the bug in the first place. My scoring code that needs to pull the observation results broke.
Hello, @codenprogressive , @sunny6chen, @colecal and @zcasanova I believe PR #4669 has addressed the issues reported here. Could you please check again?
@italojohnny hey, I've tested couple of flows and most of them worked, but when I try to run flow with Wikipedia API tool (by itself or in a flow) there is lots of serialization errors and either flow times out or entire app straight up crashes. When langflow is not connected to langfuse everything works as expected. Maybe there are more components that do this, haven't really tested all of them.
To reproduce just connect to langfuse and run Wikipedia API tool. Tested on version 1.1.1
Thank you for your response, @rors41 . In this case, I believe the issue might be specifically related to this component. Could you open a new issue to report it?
I’ll go ahead and close this issue. If you encounter any other problems, please don’t hesitate to open a new one.