Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

yash025
Copy link
Contributor

@yash025 yash025 commented Sep 17, 2025

Important

Add support for custom span export path in Langfuse OpenTelemetry integration by introducing traces_export_path parameter.

  • Behavior:
    • Add traces_export_path parameter to Langfuse constructor in client.py for custom span export path.
    • Update LangfuseResourceManager and LangfuseSpanProcessor to use traces_export_path if provided.
    • Default to LANGFUSE_TRACES_EXPORT_PATH environment variable if traces_export_path is not specified.
  • Span Export:
    • Modify LangfuseSpanProcessor to construct endpoint using traces_export_path in span_processor.py.
    • Update LangfuseResourceManager to pass traces_export_path to LangfuseSpanProcessor in resource_manager.py.
  • Misc:
    • Ensure backward compatibility by defaulting to existing endpoint if traces_export_path is not set.

This description was created by Ellipsis 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:

  1. Langfuse client (client.py) - Accepts the new parameter and reads from LANGFUSE_TRACES_EXPORT_PATH environment variable
  2. LangfuseResourceManager (resource_manager.py) - Passes the parameter through the initialization process
  3. LangfuseSpanProcessor (span_processor.py) - Uses the custom path to construct the final OTLP endpoint URL

The 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:

  • The pull request description is empty (null), which makes it difficult to understand the specific use case or rationale for this change

Confidence score: 3/5

  • This PR introduces useful functionality but has implementation gaps that could cause runtime issues
  • Score reflects missing environment variable constant definition and lack of input validation for the custom path parameter
  • Pay close attention to client.py where LANGFUSE_TRACES_EXPORT_PATH constant is referenced but not defined in the environment variables module

Context 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)

@CLAassistant
Copy link

CLAassistant commented Sep 17, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ hassiebp
❌ Yashwanth H L


Yashwanth H L seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@yash025 yash025 marked this pull request as ready for review September 17, 2025 03:59
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 files reviewed, 1 comment

Edit Code Review Bot Settings | Greptile

@hassiebp hassiebp self-requested a review September 17, 2025 08:03
@hassiebp
Copy link
Contributor

Thanks for your contribution, @yash025

@hassiebp hassiebp enabled auto-merge (squash) September 17, 2025 17:36
@hassiebp hassiebp disabled auto-merge September 17, 2025 17:36
@hassiebp hassiebp merged commit 71f443a into langfuse:main Sep 17, 2025
1 check was pending
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants