Skip to content

Commit

Permalink
fix llmobs traces not submitting for langgraph errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sabrenner committed Feb 6, 2025
1 parent 91fe626 commit 5696d35
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ddtrace/contrib/internal/langgraph/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def traced_pregel_stream(langgraph, pin, func, instance, args, kwargs):
result = func(*args, **kwargs)
except Exception:
span.set_exc_info(*sys.exc_info())
integration.llmobs_set_tags(span, args=args, kwargs={**kwargs, "name": name}, response=None, operation="graph")
span.finish()
raise

Expand All @@ -139,6 +140,9 @@ def _stream():
break
except Exception:
span.set_exc_info(*sys.exc_info())
integration.llmobs_set_tags(
span, args=args, kwargs={**kwargs, "name": name}, response=None, operation="graph"
)
span.finish()
raise

Expand All @@ -160,6 +164,7 @@ def traced_pregel_astream(langgraph, pin, func, instance, args, kwargs):
result = func(*args, **kwargs)
except Exception:
span.set_exc_info(*sys.exc_info())
integration.llmobs_set_tags(span, args=args, kwargs={**kwargs, "name": name}, response=None, operation="graph")
span.finish()
raise

Expand All @@ -178,6 +183,9 @@ async def _astream():
break
except Exception:
span.set_exc_info(*sys.exc_info())
integration.llmobs_set_tags(
span, args=args, kwargs={**kwargs, "name": name}, response=None, operation="graph"
)
span.finish()
raise

Expand Down

0 comments on commit 5696d35

Please sign in to comment.