Skip to content

Langfuse: Reduce Sentry trace duplication #1078

Description

@vprashrex

Is your feature request related to a problem?
After upgrading to Langfuse v4, every LLM request results in two traces in Sentry: a bare http.server trace and a separate full waterfall trace for the Langfuse LLM generation. This duplication causes confusion and inflates the span volume in Sentry.

Describe the solution you'd like

  • Provide Langfuse with a dedicated, isolated TracerProvider to prevent LangfuseSpanProcessor from appearing on the Sentry provider.
  • Add a shared, lazily-initialized isolated TracerProvider to the Langfuse constructor at three locations.
  • Ensure multi-tenant safety by allowing each project's LangfuseSpanProcessor to filter spans by public_key.
  • Keep flush unaffected by using explicit flushing via .flush().

Result in Sentry: a single clean trace per request with no Langfuse span data leaking.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

Status
In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions