Skip to content

Conversation

@hassiebp
Copy link
Contributor

@hassiebp hassiebp commented Jun 16, 2025

Important

Add tracing_enabled parameter to conditionally initialize tracing in LangfuseResourceManager and Langfuse client.

  • Behavior:
    • Add tracing_enabled parameter to LangfuseResourceManager and Langfuse constructor.
    • Modify _initialize_instance() in resource_manager.py to conditionally initialize tracer and span processor based on tracing_enabled.
    • In client.py, pass tracing_enabled to LangfuseResourceManager and use NoOpTracer if tracing is disabled.
  • Misc:
    • Update LangfuseResourceManager.__new__() to default tracing_enabled to True if not specified.

This description was created by Ellipsis for ae7ca32. You can customize this summary. It will automatically update as commits are pushed.

Greptile Summary

Disclaimer: Experimental PR review

Optimizes the Langfuse client by conditionally initializing OpenTelemetry tracing based on configuration, preventing unnecessary processor registration when tracing is disabled.

  • Added tracing_enabled parameter to LangfuseResourceManager in langfuse/_client/resource_manager.py for conditional tracing initialization
  • Modified Langfuse client in langfuse/_client/client.py to properly propagate tracing configuration
  • Implementation maintains thread-safety and backward compatibility while reducing overhead when tracing is disabled

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.

LGTM

2 files reviewed, no comments
Edit PR Review Bot Settings | Greptile

hassiebp and others added 2 commits June 16, 2025 13:53
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
@hassiebp hassiebp enabled auto-merge (squash) June 16, 2025 11:54
@hassiebp hassiebp disabled auto-merge June 16, 2025 12:30
@hassiebp hassiebp merged commit c8f224e into main Jun 16, 2025
9 of 10 checks passed
@hassiebp hassiebp deleted the hassieb/lfe-5303-disable-processor-tracing-disabled branch June 16, 2025 12:30
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.

2 participants