feat(sdk): support multiple OTLP span exporters (dual-write alongside Langfuse)
维护者通常 1 天内回复
@hassiebp 已经在做这个了。
开始于 2026年6月18日。
评估
这个 Issue 还没有评估数据。
描述
Summary
We would like Langfuse SDKs to support exporting spans to more than one destination—specifically, keep the default Langfuse OTLP export and optionally forward the same spans to an additional OTLP endpoint (or custom SpanExporter).
This would follow the standard OpenTelemetry pattern of attaching multiple SpanProcessors to a single TracerProvider, without requiring users to replace Langfuse's built-in exporter.
Problem
Today, when instrumenting with the Langfuse Python SDK (@observe(), LangChain callbacks, etc.), spans are exported through Langfuse's internal OTLP pipeline to the configured Langfuse host.
Some deployments need parallel export to another OTLP-compatible backend—for example:
- An internal observability or logging pipeline (same VPC / on-prem)
- A secondary sink during migration or validation
- Environment-specific routing (e.g. dev/staging copies to a local collector)
PR https://github.com/langfuse/langfuse-python/pull/1618 added optional span_exporter, which is helpful for customization, but it replaces the default Langfuse exporter rather than adding a second one. Setting generic OTEL_EXPORTER_OTLP_* env vars also does not appear to dual-write when using Langfuse's own TracerProvider initialization.
Proposed behavior
Support one or more additional exporters while preserving the default Langfuse export path.
Option A — constructor / client API
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
Langfuse(
additional_span_exporters=[
OTLPSpanExporter(endpoint="https://internal-collector.example.com/v1/traces"),
],
)
Option B — environment variables (no code changes)
# Existing Langfuse config unchanged
LANGFUSE_PUBLIC_KEY=...
LANGFUSE_SECRET_KEY=...
LANGFUSE_HOST=...
# Additional OTLP sink
LANGFUSE_ADDITIONAL_OTLP_ENDPOINT=https://internal-collector.example.com
LANGFUSE_ADDITIONAL_OTLP_HEADERS=Authorization=Bearer ...
Requirements we care about:
- Default behavior unchanged when additional exporters are not configured
- Additional exporters receive the same spans as Langfuse (no silent filtering unless explicitly configured later)
- get_client() / singleton initialization should preserve additional exporters
- Clear documentation on auth headers, timeouts, and failure isolation (one exporter failing should not break the other)
Alternatives considered
- Replace exporter via span_exporter (#1618) — loses default Langfuse export unless manually re-wired
- User-owned OTEL Collector sidecar — works but adds operational overhead; SDK-level dual export is simpler for many teams
- Application-level double instrumentation — fragile across frameworks and easy to break on upgrades
Questions for maintainers
- Is dual / multi-exporter export something the Langfuse SDK team would consider?
- Would you prefer an explicit additional_span_exporters API, env-based configuration, or both?
- Should this live in langfuse-python first, with parity in langfuse-js?
- Any concerns about performance, backpressure, or support burden we should address in a PR?
Happy to contribute a PR if there is alignment on the API shape. Thanks!
- 主要语言
- Python
- 星标
- 468
- 派生
- 349
- 平均合并
- 16 小时 1 分钟
- 30 天内合并 PR
- 20
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
langfuse/langfuse-python 的其他 Issue
-
bug: get_dataset_run / get_dataset_runs / delete_dataset_run are unusable on Langfuse v4可能已有人在做 @hassiebp 于 3 天前认领。 未关闭bug feat-datasets feat-experiments sdk-python
langfuse/langfuse-python#1906 · 已指派 1 人 ·
维护者通常 1 天内回复
-
mask is not applied to create_dataset_item or create_score(comment=)可能已有人在做 @hassiebp 于 7 天前认领。 未关闭bug compliance feat-data-masking sdk-python security
langfuse/langfuse-python#1896 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Scores bypass sample_rate since v4可能已有人在做 @hassiebp 于 12 天前认领。 未关闭feat-scores sdk-python unconfirmed-bug
langfuse/langfuse-python#1890 · 已指派 1 人 ·
维护者通常 1 天内回复
-
batch_evaluation fails on self-hosted v4 events_only deployments (uses unavailable v3 read endpoints)可能已有人在做 @hassiebp 于 25 天前认领。 未关闭bug feat-evals sdk-python
langfuse/langfuse-python#1861 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
[HTTPXodus] Consider migrating from httpx to httpx2 (the actively maintained fork)可能已有人在做 @hassiebp 于 26 天前认领。 未关闭improvement sdk-python
langfuse/langfuse-python#1856 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 langfuse/langfuse-python 的全部 Issue
相似的 Issue
-
namespace operations
难度 1/5 1 小时以内 新手友好度 82/100
EclipseFdn/open-vsx.org#13573 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
collective/icalendar#1854 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
rancher/rancher-ai-agent#412 ·
维护者通常 6 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
TUDelftGeodesy/DePSI#134 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
HenriquesLab/rxiv-maker#335 ·