Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimise LangfuseTracer - move flush to separate thread #782

Closed
Redna opened this issue Jun 4, 2024 · 1 comment · Fixed by #798
Closed

Optimise LangfuseTracer - move flush to separate thread #782

Redna opened this issue Jun 4, 2024 · 1 comment · Fixed by #798
Assignees
Labels
feature request Ideas to improve an integration integration:langfuse

Comments

@Redna
Copy link
Contributor

Redna commented Jun 4, 2024

Is your feature request related to a problem? Please describe.
Currently the Langfuse integration is very slow when content tracing is enabled, even for a local Langfuse deployment.
The problem is that the trace method defined in haystack_integrations.tracing.langfuse.LangfuseTracer is calling the flushmethod of the tracer. This blocks the entire Thread until the data has been pushed. As it is executed before and after each component this slows down the execution dramatically.

From my experience adding Langfuse causes a slow down of around 3 to 5 times the normal execution time.

Describe the solution you'd like

  1. move the flush method to a separate Tread:
    threading.Thread(target=self._tracer.flush, daemon=True)

Describe alternatives you've considered
make "force_flush" optional to enable this feature for short living applications (Lambda functions) and leave open to the developer to flush the data before application shutdown.

@Redna Redna added the feature request Ideas to improve an integration label Jun 4, 2024
@touhi99
Copy link

touhi99 commented Jun 4, 2024

+1

also experiencing the issue with langfuse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Ideas to improve an integration integration:langfuse
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants