-
Notifications
You must be signed in to change notification settings - Fork 418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(langgraph): submit spans from langgraph to APM and LLMObs #11730
Conversation
|
BenchmarksBenchmark execution time: 2025-01-17 16:43:15 Comparing candidate commit 1a2dab7 in PR branch Found 0 performance improvements and 4 performance regressions! Performance is the same for 390 metrics, 2 unstable metrics. scenario:iast_aspects-lower_aspect
scenario:iast_aspects-ospathdirname_aspect
scenario:iast_aspects-ospathsplit_aspect
scenario:iast_aspects-translate_aspect
|
Datadog ReportBranch report: ✅ 0 Failed, 130 Passed, 1468 Skipped, 4m 12.31s Total duration (35m 22.88s time saved) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for guild/core files 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final review for me, everything looks good except for a couple small comments!
This PR adds a simple integration and corresponding LLMObs plugin for the LangGraph framework.
Enablement
For both APM and LLMObs, this integration is disabled by default, and only enabled with
DD_TRACE_LANGGRAPH_ENABLED=true
orpatch(langgraph=True)
, along with_DD_TRACE_LANGGRAPH_ENABLED=true
, due to its experimental nature.APM Tracing
The APM integration adds basic tracing for LangGraph
Pregel
graph invocations, as well as the execution of each node/step in the graph (traced asRunnableSeq
).LLM Observability Plugin
The LLMObs plugin submits the traces to LLM Observability.
Graph Invocation/Streaming Output Tagging
Because we patch the
(a)stream
method for both streams and(a)invoke
, since they rely on(a)stream
under the hood, we are bound to the yields from the stream. The object shape and value depend on thestream_mode
passed in to the stream function. Forinvoke
, it defaults to"values"
, which is perfect for our use case. However, if one were to callstream
directly, and either pass in nothing or something likestream_mode=["updates", "debug"]
, the output we would have for the graph span would appear as:This is a known limitation for now, and a more thought-out solution for either adding on
"values"
tostream_mode
and omitting their yields if it wasn't already present, or having some kind of clever joining, can be added in a later PR or by feature request.Checklist
Reviewer Checklist