mirror of
https://github.com/hwchase17/langchain
synced 2024-11-11 19:11:02 +00:00
[Core] Logging: Suppress missing parent warning (#23363)
This commit is contained in:
parent
730c551819
commit
8955bc1866
@ -50,6 +50,8 @@ class _TracerCore(ABC):
|
||||
This class provides common methods, and reusable methods for tracers.
|
||||
"""
|
||||
|
||||
log_missing_parent: bool = True
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
@ -118,10 +120,11 @@ class _TracerCore(ABC):
|
||||
if parent_run := self.run_map.get(str(run.parent_run_id)):
|
||||
self._add_child_run(parent_run, run)
|
||||
else:
|
||||
logger.warning(
|
||||
f"Parent run {run.parent_run_id} not found for run {run.id}."
|
||||
" Treating as a root run."
|
||||
)
|
||||
if self.log_missing_parent:
|
||||
logger.warning(
|
||||
f"Parent run {run.parent_run_id} not found for run {run.id}."
|
||||
" Treating as a root run."
|
||||
)
|
||||
run.parent_run_id = None
|
||||
run.trace_id = run.id
|
||||
run.dotted_order = current_dotted_order
|
||||
|
@ -18,6 +18,8 @@ AsyncListener = Union[
|
||||
class RootListenersTracer(BaseTracer):
|
||||
"""Tracer that calls listeners on run start, end, and error."""
|
||||
|
||||
log_missing_parent = False
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
@ -63,6 +65,8 @@ class RootListenersTracer(BaseTracer):
|
||||
class AsyncRootListenersTracer(AsyncBaseTracer):
|
||||
"""Async Tracer that calls listeners on run start, end, and error."""
|
||||
|
||||
log_missing_parent = False
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
|
Loading…
Reference in New Issue
Block a user