Skip to content

Commit

Permalink
remove setting env to none
Browse files Browse the repository at this point in the history
  • Loading branch information
hassiebp committed Feb 25, 2025
1 parent 00dbfea commit 8a29bee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
5 changes: 2 additions & 3 deletions langfuse/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,9 @@ def __init__(
if self.environment and not bool(
re.match(ENVIRONMENT_PATTERN, self.environment)
):
self.log.warning(
f'Invalid environment specified "{environment}" that does not match validation pattern ("{ENVIRONMENT_PATTERN}"). Setting will be ignored.'
self.log.error(
f'Invalid environment specified "{environment}" that does not match validation pattern ("{ENVIRONMENT_PATTERN}"). Events will be rejected by Langfuse servers.'
)
self.environment = None

self.httpx_client = httpx_client or httpx.Client(timeout=timeout)

Expand Down
13 changes: 0 additions & 13 deletions tests/test_core_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -1578,16 +1578,3 @@ def test_environment_from_env_var(monkeypatch):

fetched_trace = api_wrapper.get_trace(trace.id)
assert fetched_trace["environment"] == "testing"


def test_invalid_environment():
# Test with invalid environment (too long)
langfuse = Langfuse(debug=True, environment="UPPERCASE")
api_wrapper = LangfuseAPI()

trace = langfuse.trace(name="test_invalid_environment")
langfuse.flush()
sleep(1)

fetched_trace = api_wrapper.get_trace(trace.id)
assert fetched_trace["environment"] is None

0 comments on commit 8a29bee

Please sign in to comment.