Skip to content

fix(resource-manager): do not register processor if tracing disabled #1215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 16, 2025

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.

1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy