Skip to content

Upgrade @voltagent/langfuse-exporter to Langfuse JS SDK v5Β #1381

Description

@hassiebp

Hi VoltAgent team πŸ‘‹ β€” I'm Hassieb from the Langfuse team.

I reviewed @voltagent/langfuse-exporter. It currently groups OTel spans and recreates them through the v3 langfuse event API. With JS/TS SDK v5.4+, this can become a much thinner OTel integration:

  • Replace the custom v3-backed exporter with a wrapper around LangfuseSpanProcessor from @langfuse/otel.
  • Normalize VoltAgent's custom ai.*/usage.* fields to standard gen_ai.* and Langfuse observation attributes before export.
  • If VoltAgent's instrumentation scope is not covered by the v5 default filter, add a scoped shouldExportSpan rule that includes VoltAgent spans without pulling in unrelated HTTP/database spans.
  • Attach user/session/tags/trace-name attributes to every span rather than reconstructing them only on the root trace.
  • Preserve parent IDs, generation usage/TTFT, error status, batching, force-flush, and shutdown in tests.

Guides: JS SDK v3β†’v4 and v4β†’v5.

If you need support with the migration, we're happy to jump on a call or help review a PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions