core: Run LangChainTracer inline (#26797)

- this flag ensures the tracer always runs in the same thread as the run
being traced for both sync and async runs
- pro: less chance for ordering bugs and other oddities
- blocking the event loop is not a concern given all code in the tracer
holds the GIL anyway
This commit is contained in:
Nuno Campos 2024-09-24 08:31:18 -07:00 committed by GitHub
parent 408a930d55
commit de70a64e3a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -84,6 +84,8 @@ def _run_to_dict(run: Run) -> dict:
class LangChainTracer(BaseTracer):
"""Implementation of the SharedTracer that POSTS to the LangChain endpoint."""
run_inline = True
def __init__(
self,
example_id: Optional[Union[UUID, str]] = None,