File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 4949from langfuse ._client .environment_variables import (
5050 LANGFUSE_DEBUG ,
5151 LANGFUSE_HOST ,
52+ LANGFUSE_OTEL_TRACES_EXPORT_PATH ,
5253 LANGFUSE_PUBLIC_KEY ,
5354 LANGFUSE_SAMPLE_RATE ,
5455 LANGFUSE_SECRET_KEY ,
Original file line number Diff line number Diff line change 4444**Default value:** ``"https://cloud.langfuse.com"``
4545"""
4646
47+ LANGFUSE_OTEL_TRACES_EXPORT_PATH = "LANGFUSE_OTEL_TRACES_EXPORT_PATH"
48+ """
49+ .. envvar:: LANGFUSE_OTEL_TRACES_EXPORT_PATH
50+
51+ URL path on the configured host to export traces to.
52+
53+ **Default value:** ``/api/public/otel/v1/traces``
54+ """
55+
4756LANGFUSE_DEBUG = "LANGFUSE_DEBUG"
4857"""
4958.. envvar:: LANGFUSE_DEBUG
Original file line number Diff line number Diff line change 2323from langfuse ._client .environment_variables import (
2424 LANGFUSE_FLUSH_AT ,
2525 LANGFUSE_FLUSH_INTERVAL ,
26+ LANGFUSE_OTEL_TRACES_EXPORT_PATH ,
2627)
2728from langfuse ._client .utils import span_formatter
2829from langfuse .logger import langfuse_logger
@@ -90,8 +91,16 @@ def __init__(
9091 # Merge additional headers if provided
9192 headers = {** default_headers , ** (additional_headers or {})}
9293
94+ traces_export_path = os .environ .get (LANGFUSE_OTEL_TRACES_EXPORT_PATH , None )
95+
96+ endpoint = (
97+ f"{ host } /{ traces_export_path } "
98+ if traces_export_path
99+ else f"{ host } /api/public/otel/v1/traces"
100+ )
101+
93102 langfuse_span_exporter = OTLPSpanExporter (
94- endpoint = f" { host } /api/public/otel/v1/traces" ,
103+ endpoint = endpoint ,
95104 headers = headers ,
96105 timeout = timeout ,
97106 )
You can’t perform that action at this time.
0 commit comments