fix(client): parse env vars for debug and tracing enabled case insensitive #1279
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
Make
LANGFUSE_DEBUGandLANGFUSE_TRACING_ENABLEDenvironment variable parsing case-insensitive inlangfuse/_client/client.py.langfuse/_client/client.pyto parseLANGFUSE_DEBUGandLANGFUSE_TRACING_ENABLEDenvironment variables case-insensitively.LANGFUSE_DEBUGaccepts "True", "TRUE", "true" and compares against "true".LANGFUSE_TRACING_ENABLEDuses "false" for exclusion check.tests/test_otel.pyvalidate the changes without breaking existing functionality.This description was created by
for bc6183d. You can customize this summary. It will automatically update as commits are pushed.
Disclaimer: Experimental PR review
Greptile Summary
This PR improves the environment variable parsing for the Langfuse Python SDK by making boolean environment variables case-insensitive. The change affects two key configuration variables:
LANGFUSE_DEBUGandLANGFUSE_TRACING_ENABLED.What Changed:
langfuse/_client/client.pyto convert environment variable values to lowercase before comparison"True"/"False"to"true"/"false"for consistencyLANGFUSE_DEBUGvariable now accepts any case variation (e.g., "True", "TRUE", "true") and compares against "true"LANGFUSE_TRACING_ENABLEDvariable now uses "false" as the exclusion check, making it more intuitiveHow it Integrates:
This change enhances the client initialization process in the core Langfuse client class. The environment variable parsing happens during client instantiation and affects the SDK's debug logging behavior and tracing functionality. The modification maintains full backward compatibility while making the configuration more user-friendly, aligning with common practices for boolean environment variables in Python applications.
Confidence score: 4/5