feat: support custom export path to export spans #1342
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Important
Add support for custom span export path in Langfuse OpenTelemetry integration by introducing
traces_export_path
parameter.traces_export_path
parameter toLangfuse
constructor inclient.py
for custom span export path.LangfuseResourceManager
andLangfuseSpanProcessor
to usetraces_export_path
if provided.LANGFUSE_TRACES_EXPORT_PATH
environment variable iftraces_export_path
is not specified.LangfuseSpanProcessor
to construct endpoint usingtraces_export_path
inspan_processor.py
.LangfuseResourceManager
to passtraces_export_path
toLangfuseSpanProcessor
inresource_manager.py
.traces_export_path
is not set.This description was created by
for a25507f. You can customize this summary. It will automatically update as commits are pushed.
Disclaimer: Experimental PR review
Greptile Summary
Updated On: 2025-09-17 04:00:48 UTC
This PR introduces support for customizing the OTLP traces export endpoint path in the Langfuse Python client. The change adds a new optional
traces_export_path
parameter that allows users to override the default/api/public/otel/v1/traces
endpoint with a custom path.The implementation flows through the entire client initialization chain:
client.py
) - Accepts the new parameter and reads fromLANGFUSE_TRACES_EXPORT_PATH
environment variableresource_manager.py
) - Passes the parameter through the initialization processspan_processor.py
) - Uses the custom path to construct the final OTLP endpoint URLThe feature maintains backward compatibility by defaulting to the existing behavior when no custom path is provided. This change integrates with the existing OpenTelemetry Protocol (OTLP) infrastructure already present in the codebase, specifically enhancing the span export functionality that feeds into Langfuse's trace collection system.
PR Description Notes:
null
), which makes it difficult to understand the specific use case or rationale for this changeConfidence score: 3/5
client.py
whereLANGFUSE_TRACES_EXPORT_PATH
constant is referenced but not defined in the environment variables moduleContext used:
Rule - Open a GitHub issue or discussion first before submitting PRs to explain the rationale and necessity of the proposed changes, as required by the contributing guide. (link)