fix(resource-manager): reuse passed tracer provider for reinit#1461
Merged
fix(resource-manager): reuse passed tracer provider for reinit#1461
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Reuse
tracer_providerduring reinitialization inLangfuseResourceManagerto maintain consistent tracing behavior.tracer_providerin_create_client_from_instance()inget_client.pyby passinginstance.tracer_provider.self.tracer_providerin_initialize_instance()inresource_manager.pyto reuse existingtracer_provider._create_client_from_instance()to includetracer_providerparameter._initialize_instance()to setself.tracer_providerwith passed or initializedtracer_provider.This description was created by
for 57b2c3d. You can customize this summary. It will automatically update as commits are pushed.
Disclaimer: Experimental PR review
Greptile Overview
Greptile Summary
Preserves custom
tracer_providerwhen reinitializing Langfuse clients throughget_client().tracer_provideras an instance attribute (resource_manager.py:182)_create_client_from_instancenow passes the storedtracer_providerwhen creating new client instances (get_client.py:55)Confidence Score: 5/5
Important Files Changed
File Analysis
tracer_provideras instance attribute for later reuse during client reinitializationtracer_providerfrom resource manager when creating new client instances to preserve custom tracer configurationSequence Diagram
sequenceDiagram participant User participant Langfuse participant ResourceManager participant get_client participant _create_client_from_instance User->>Langfuse: new Langfuse(tracer_provider=custom_provider) Langfuse->>ResourceManager: __new__(tracer_provider=custom_provider) ResourceManager->>ResourceManager: _initialize_instance() Note over ResourceManager: tracer_provider stored or initialized ResourceManager->>ResourceManager: self.tracer_provider = tracer_provider ResourceManager-->>Langfuse: singleton instance User->>get_client: get_client() get_client->>get_client: Look up instance in _instances get_client->>_create_client_from_instance: _create_client_from_instance(instance) _create_client_from_instance->>Langfuse: new Langfuse(tracer_provider=instance.tracer_provider) Note over _create_client_from_instance,Langfuse: Passes tracer_provider to preserve custom config Langfuse->>ResourceManager: __new__(tracer_provider=instance.tracer_provider) Note over ResourceManager: Reuses existing singleton with same tracer_provider ResourceManager-->>Langfuse: existing instance Langfuse-->>get_client: client with preserved tracer_provider get_client-->>User: client instance