Langfuse makes haystack slow
Describe the bug Langfuse make haystack slow : for a 13 second pipeline, it takes extra 6 seconds when running with langfuse tracer for a total of 19s. After profiling my pipeline, it looks like uploading to langfuse take time, as if it was waiting for it to be uploaded to run the next component.
I'm using langfuse self hosted
Describe your environment (please complete the following information):
- OS: ubuntu (docker)
- Haystack version: 2.9
- Integration version: 0.7
After more research, I found that setting HAYSTACK_LANGFUSE_ENFORCE_FLUSH to false solve the problem. It would be nice to either have a parameter to change it, or even documentations for it.
Hello @mydsoElliott thanks for reaching out. Just to better understand how we could improve documentation: Have you found the documentation page about Haystack's langfuse integration? https://docs.haystack.deepset.ai/reference/integrations-langfuse
We describe the HAYSTACK_LANGFUSE_ENFORCE_FLUSH there and in the component docstring here including the motivation for the default setting true. So this issue is mainly about making this setting more visible to users and explicitly mentioning the effect on speed?
Hello, indeed I never found this by myself, so It's a bit my bad. But even if I did, I don't think I would have known that it was making the pipeline that much slower.
May be a better way would be to mention it in the langfuse connector. https://docs.haystack.deepset.ai/docs/langfuseconnector
as I feel like it's something you're more likely to see.
Mentionning speed could also be nice.
Also having it on by default without a warning nor being in debug mode can make it hard to realize it if you don't specifically look for it.