Skip to content

Conversation

@RulaKhaled
Copy link
Member

@RulaKhaled RulaKhaled commented Nov 6, 2025

This PR adds manual instrumentation support for LangGraph StateGraph operations in Cloudflare Workers and Vercel Edge environments.

import * as Sentry from '@sentry/cloudflare'; // or '@sentry/vercel-edge'
import { StateGraph, START, END, MessagesAnnotation } from '@langchain/langgraph';

// Create and instrument the graph
const graph = new StateGraph(MessagesAnnotation)
  .addNode('agent', agentFn)
  .addEdge(START, 'agent')
  .addEdge('agent', END);

Sentry.instrumentLangGraph(graph, {
  recordInputs: true,
  recordOutputs: true,
});

const compiled = graph.compile({ name: 'weather_assistant' });

await compiled.invoke({
  messages: [{ role: 'user', content: 'What is the weather in SF?' }],
});

@RulaKhaled RulaKhaled force-pushed the support-cloudflare-and-vercel-edge branch from 8637cdc to 936427e Compare November 6, 2025 18:38
@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 24.59 kB - -
@sentry/browser - with treeshaking flags 23.08 kB - -
@sentry/browser (incl. Tracing) 41.22 kB - -
@sentry/browser (incl. Tracing, Profiling) 45.5 kB - -
@sentry/browser (incl. Tracing, Replay) 79.7 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 69.37 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 84.39 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 96.57 kB - -
@sentry/browser (incl. Feedback) 41.27 kB - -
@sentry/browser (incl. sendFeedback) 29.26 kB - -
@sentry/browser (incl. FeedbackAsync) 34.19 kB - -
@sentry/react 26.29 kB - -
@sentry/react (incl. Tracing) 43.21 kB - -
@sentry/vue 29.07 kB - -
@sentry/vue (incl. Tracing) 42.99 kB - -
@sentry/svelte 24.61 kB - -
CDN Bundle 26.89 kB - -
CDN Bundle (incl. Tracing) 41.77 kB - -
CDN Bundle (incl. Tracing, Replay) 78.3 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 83.77 kB - -
CDN Bundle - uncompressed 78.84 kB - -
CDN Bundle (incl. Tracing) - uncompressed 123.97 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 240 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 252.76 kB - -
@sentry/nextjs (client) 45.31 kB - -
@sentry/sveltekit (client) 41.61 kB - -
@sentry/node-core 50.76 kB - -
@sentry/node 158.7 kB +0.56% +879 B 🔺
@sentry/node - without tracing 92.64 kB - -
@sentry/aws-serverless 106.36 kB -0.01% -1 B 🔽

View base workflow run

@github-actions
Copy link
Contributor

github-actions bot commented Nov 6, 2025

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 8,833 - 11,390 -22%
GET With Sentry 1,414 16% 1,586 -11%
GET With Sentry (error only) 6,144 70% 7,742 -21%
POST Baseline 1,192 - 1,114 +7%
POST With Sentry 482 40% 543 -11%
POST With Sentry (error only) 1,026 86% 1,022 +0%
MYSQL Baseline 3,327 - 3,990 -17%
MYSQL With Sentry 454 14% 524 -13%
MYSQL With Sentry (error only) 2,699 81% 3,218 -16%

View base workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants