GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||
GeezerVison is showing github.com — fix(server-utils): Instrument LangGraph stream executions by psh4607 · Pull Request #23615 · getsentry/sentry-javascript Conversation
|
|
Thanks for digging into this! the stream lifecycle work is in good shape. i just kicked off the CI workflow, meanwhile there are a couple of comments to look at |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
This pull request has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you apply the label |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Hi @psh4607 thanks for working on this! Could you address the bot comments and fix the merge conflicts please? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
👋 @andreiborza — Please review this PR when you get a chance! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
👋 @andreiborza — Please review this PR when you get a chance! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
👋 @andreiborza — Please review this PR when you get a chance! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Could you address the bot comments and fix the merge conflicts please?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Wrap each compiled graph once when manual and auto instrumentation both see it, stop closing a source iterator that already threw, and keep streaming when recording a chunk fails. Add a LangGraph v1 stream suite. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Record only the root graph's output from subgraph and multi-mode chunks, treat a caller's cancel as a finished run, and route tee/pipeTo/ pipeThrough through the instrumented reader (shared with Mistral) so those consumers end the span. Manual instrumentation now wins over the integration, and an unpatchable stream is returned to the caller. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reuse core handleCallbackErrors for reader and cancel settling, move the unpatchable-stream fallback into instrumentStreamResult, end the span once a locked cancel takes effect, and skip output recording for stream modes that don't carry the graph output. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a6d40c8. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
A cancel that rejects no longer leaves the stream marked as cancelled, so a later read failure still ends the agent span as an error. Co-Authored-By: Claude Opus 5.5 <[email protected]>
pipeThrough without a readable side, or pipeTo/pipeThrough with an invalid signal, took the source reader before the native call threw, leaving the stream locked and its span open. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…//github.com/psh4607/sentry-javascript into fix/JS-1858/langgraph-stream-instrumentation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… test @langchain/core is not a dependency of @sentry/server-utils, so the import only resolved through hoisting and fails under CI's isolated install. A local chunk with concat() exercises the same merge path. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
closing this in favour of #25749. while getting this mergeable we found the span is tied to the wrong event. it ends when the caller finishes reading the stream, but langgraph runs the graph whether or not anyone reads it, so a stream nobody reads never sent its span. most of the review rounds here came from that. #25749 ends the span on the run's own end/error callback instead, which drops most of the stream patching. the invoke/stream suppression from this PR carries over, and @psh4607 is co-author on it. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…#25749) `CompiledGraph.stream()` produced no `gen_ai.invoke_agent` span, so the chat and tool spans of a streamed run had no agent span above them. LangGraph runs the graph as soon as `stream()` is called, whether or not anyone reads it, so the span now follows the run. It ends on the run's own `handleChainEnd`/`handleChainError`, and the output comes from the final state, the same way `invoke()` records it. `invoke()` keeps its single span. The shared setup also no longer writes Sentry's metadata and callbacks into the caller's config, and a graph seen by both `instrumentStateGraph()` and the integration is wrapped once, with the manual options winning. **Known limitation.** When a caller stops reading early, LangGraph keeps running the graph but never reports the run's end. After a `break` the span ends at the break, so later nodes' spans start after it. After `reader.cancel()` or a client disconnecting from `new Response(stream)`, the span never ends. Replaces #23615. Co-authored with @psh4607 from that PR. Fixes #19626 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Seongho.Bak <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
…getsentry#25749) `CompiledGraph.stream()` produced no `gen_ai.invoke_agent` span, so the chat and tool spans of a streamed run had no agent span above them. LangGraph runs the graph as soon as `stream()` is called, whether or not anyone reads it, so the span now follows the run. It ends on the run's own `handleChainEnd`/`handleChainError`, and the output comes from the final state, the same way `invoke()` records it. `invoke()` keeps its single span. The shared setup also no longer writes Sentry's metadata and callbacks into the caller's config, and a graph seen by both `instrumentStateGraph()` and the integration is wrapped once, with the manual options winning. **Known limitation.** When a caller stops reading early, LangGraph keeps running the graph but never reports the run's end. After a `break` the span ends at the break, so later nodes' spans start after it. After `reader.cancel()` or a client disconnecting from `new Response(stream)`, the span never ends. Replaces getsentry#23615. Co-authored with @psh4607 from that PR. Fixes getsentry#19626 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Seongho.Bak <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
instrumentLangGraph does not instrument stream(), only invoke()
There was an error while loading. Please reload this page.