You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: move otel check to client init time to avoid timing issue (#1958)
**Issue:** for dynamic values like env var, you usually want to check
them inside the instance or function, not at import time. because under
the hood, python Imports are cached (in sys.modules), so in the case of
some customer who's using pytest with otel, their second import of
langsmith.client (during pytest unit test run time) weren't able to
override initial one (during langsmith_plugin pytest plugin import,
happened at very first of pytest set up). This is causing subtle issue
like if pytest plugin run first (`has_otel=False`), then later even if
env var got reset (`has_otel=True`) the python still doesn't recognize
the change.
I also found that the env var cache a bit problematic in such case, but
if we fix the import, that might be less concerning, so i just reduced
max size a little bit to make it less likely to be an issue.
0 commit comments