diff --git a/docs/platforms/javascript/common/agent-tracing/anthropic.mdx b/docs/platforms/javascript/common/agent-tracing/anthropic.mdx index 52f5435bf37be..fc7f104d4b447 100644 --- a/docs/platforms/javascript/common/agent-tracing/anthropic.mdx +++ b/docs/platforms/javascript/common/agent-tracing/anthropic.mdx @@ -2,90 +2,17 @@ title: Anthropic description: "Adds instrumentation for the Anthropic SDK." sidebar_order: 22 -supported: - - javascript.node - - javascript.eve - - javascript.aws-lambda - - javascript.azure-functions - - javascript.connect - - javascript.express - - javascript.fastify - - javascript.gcp-functions - - javascript.hapi - - javascript.hono - - javascript.koa - - javascript.nestjs - - javascript.nextjs - - javascript.nuxt - - javascript.solidstart - - javascript.sveltekit - - javascript.react-router - - javascript.remix - - javascript.astro - - javascript.bun - - javascript.tanstackstart-react - - javascript.cloudflare +supportedCategories: + - server --- - - - For meta-framework applications running on both client and server, we recommend **setting up the integration manually** using the [`instrumentAnthropicAiClient` wrapper](#manual-instrumentation) to ensure consistent instrumentation across all runtimes. - - +_Import name: `Sentry.anthropicAIIntegration`_ - +The `anthropicAIIntegration` adds instrumentation for the [`@anthropic-ai/sdk`](https://www.npmjs.com/package/@anthropic-ai/sdk) API to capture spans by wrapping Anthropic SDK calls and recording LLM interactions. - ## Automatic Instrumentation +This integration is enabled by default and automatically captures spans for Anthropic SDK calls (requires Sentry SDK version `10.28.0` or higher). - _Import name: `Sentry.anthropicAIIntegration`_ - - - - If you are using a different runtime (like Bun, Cloudflare Workers or a Browser) or experiencing missing spans, you need to use **[Manual Instrumentation](#manual-instrumentation)** to explicitly wrap your AI client instance instead. - - - - The `anthropicAIIntegration` adds instrumentation for the [`@anthropic-ai/sdk`](https://www.npmjs.com/package/@anthropic-ai/sdk) API to capture spans by wrapping Anthropic SDK calls and recording LLM interactions. - - In Node.js runtimes, this integration is enabled by default and automatically captures spans for Anthropic SDK calls (requires Sentry SDK version `10.28.0` or higher). - - To customize what data is captured (such as inputs and outputs), see the [Options](#options) in the Configuration section. - - - - - - ## Manual Instrumentation - - _Import name: `Sentry.instrumentAnthropicAiClient`_ - - The `instrumentAnthropicAiClient` helper adds instrumentation for the [`@anthropic-ai/sdk`](https://www.npmjs.com/package/@anthropic-ai/sdk) API to capture spans by wrapping Anthropic SDK calls and recording LLM interactions with configurable input/output recording. You need to manually wrap your Anthropic client instance with this helper. - - See the example below: - - ```javascript - import Anthropic from "@anthropic-ai/sdk"; - - const anthropic = new Anthropic({ - apiKey: "your-api-key", // Warning: API key will be exposed in browser! -}); - - const client = Sentry.instrumentAnthropicAiClient(anthropic, { - recordInputs: true, - recordOutputs: true, -}); - - // Use the wrapped client instead of the original anthropic instance - const response = await client.messages.create({ - model: "claude-3-5-sonnet-20241022", - max_tokens: 1024, - messages: [{ role: "user", content: "Hello!" }], -}); - ``` - - To customize what data is captured (such as inputs and outputs), see the [Options](#options) in the Configuration section. - - +To customize what data is captured (such as inputs and outputs), see the [Options](#options) in the Configuration section. ## Configuration @@ -111,36 +38,18 @@ Defaults to `true` if `dataCollection.genAI.outputs` is `true` (which is the def **Usage** - - - Using the `anthropicAIIntegration` integration for **automatic instrumentation**: - - ```javascript - Sentry.init({ +```javascript +Sentry.init({ dsn: "____PUBLIC_DSN____", // Tracing must be enabled for agent tracing to work tracesSampleRate: 1.0, integrations: [ - Sentry.anthropicAIIntegration({ - // your options here -}), + Sentry.anthropicAIIntegration({ + // your options here + }), ], }); - ``` - - - - - - Using the `instrumentAnthropicAiClient` wrapper for **manual instrumentation**: - - ```javascript - const client = Sentry.instrumentAnthropicAiClient(anthropic, { - // your options here -}); - ``` - - +``` ## Supported Operations diff --git a/docs/platforms/javascript/common/agent-tracing/google-genai.mdx b/docs/platforms/javascript/common/agent-tracing/google-genai.mdx index 1f4b5f8bb4d3a..762ad9a0d1731 100644 --- a/docs/platforms/javascript/common/agent-tracing/google-genai.mdx +++ b/docs/platforms/javascript/common/agent-tracing/google-genai.mdx @@ -2,86 +2,17 @@ title: Google Gen AI description: "Adds instrumentation for Google Gen AI SDK." sidebar_order: 23 -supported: - - javascript.node - - javascript.eve - - javascript.aws-lambda - - javascript.azure-functions - - javascript.connect - - javascript.express - - javascript.fastify - - javascript.gcp-functions - - javascript.hapi - - javascript.hono - - javascript.koa - - javascript.nestjs - - javascript.nextjs - - javascript.nuxt - - javascript.solidstart - - javascript.sveltekit - - javascript.react-router - - javascript.remix - - javascript.astro - - javascript.bun - - javascript.tanstackstart-react - - javascript.cloudflare +supportedCategories: + - server --- - - - For meta-framework applications running on both client and server, we recommend **setting up the integration manually** using the [`instrumentGoogleGenAIClient` wrapper](#manual-instrumentation) to ensure consistent instrumentation across all runtimes. - - +_Import name: `Sentry.googleGenAIIntegration`_ - +The `googleGenAIIntegration` adds instrumentation for the [`@google/genai`](https://www.npmjs.com/package/@google/genai) SDK to capture spans by wrapping Google Gen AI SDK calls and recording LLM interactions. - ## Automatic Instrumentation +This integration is enabled by default and automatically captures spans for Google Gen AI SDK calls (requires Sentry SDK version `10.28.0` or higher). - _Import name: `Sentry.googleGenAIIntegration`_ - - - - If you are using a different runtime (like Bun, Cloudflare Workers or a Browser) or experiencing missing spans, you need to use **[Manual Instrumentation](#manual-instrumentation)** to explicitly wrap your AI client instance instead. - - - - The `googleGenAIIntegration` adds instrumentation for the [`@google/genai`](https://www.npmjs.com/package/@google/genai) SDK to capture spans by wrapping Google Gen AI SDK calls and recording LLM interactions. - - In Node.js runtimes, this integration is enabled by default and automatically captures spans for Google Gen AI SDK calls (requires Sentry SDK version `10.28.0` or higher). - - To customize what data is captured (such as inputs and outputs), see the [Options](#options) in the Configuration section. - - - - - - ## Manual Instrumentation - - _Import name: `Sentry.instrumentGoogleGenAIClient`_ - - The `instrumentGoogleGenAIClient` helper adds instrumentation for the [`@google/genai`](https://www.npmjs.com/package/@google/genai) SDK to capture spans by wrapping Google Gen AI SDK calls and recording LLM interactions with configurable input/output recording. You need to manually wrap your Google Gen AI client instance with this helper. - - See example below: - - ```javascript - import { GoogleGenAI } from "@google/genai"; - - const genAI = new GoogleGenAI({ - apiKey: "your-api-key", // Warning: API key will be exposed in browser! - }); - - const client = Sentry.instrumentGoogleGenAIClient(genAI, { - recordInputs: true, - recordOutputs: true, - }); - - // Use the wrapped client instead of the original genAI instance - const result = await client.models.generateContent("Hello!"); - ``` - - To customize what data is captured (such as inputs and outputs), see the [Options](#options) in the Configuration section. - - +To customize what data is captured (such as inputs and outputs), see the [Options](#options) in the Configuration section. ## Configuration @@ -107,14 +38,10 @@ Defaults to `true` if `dataCollection.genAI.outputs` is `true` (which is the def **Usage** - - -Using the `googleGenAIIntegration` integration for **automatic instrumentation**: - ```javascript Sentry.init({ dsn: "____PUBLIC_DSN____", - // Tracing must be enabled for agent tracing to work + // Tracing must be enabled for agent tracing to work tracesSampleRate: 1.0, integrations: [ Sentry.googleGenAIIntegration({ @@ -124,20 +51,6 @@ Sentry.init({ }); ``` - - - - -Using the `instrumentGoogleGenAIClient` wrapper for **manual instrumentation**: - -```javascript -const client = Sentry.instrumentGoogleGenAIClient(genAI, { - // your options here -}); -``` - - - ## Supported Operations By default, tracing support is added to the following Google Gen AI SDK calls: diff --git a/docs/platforms/javascript/common/agent-tracing/index.mdx b/docs/platforms/javascript/common/agent-tracing/index.mdx index 2b3dc566ecb3b..c4389c231d7d6 100644 --- a/docs/platforms/javascript/common/agent-tracing/index.mdx +++ b/docs/platforms/javascript/common/agent-tracing/index.mdx @@ -5,34 +5,8 @@ sidebar_order: 7 description: "Monitor agents with token usage, latency, tool execution, and error tracking." sidebar_section: features new: true -supported: - - javascript.node - - javascript.eve - - javascript.aws-lambda - - javascript.azure-functions - - javascript.bun - - javascript.cloudflare - - javascript.connect - - javascript.deno - - javascript.effect - - javascript.elysia - - javascript.express - - javascript.fastify - - javascript.firebase - - javascript.gcp-functions - - javascript.hapi - - javascript.hono - - javascript.koa - - javascript.nestjs - - javascript.nitro - - javascript.astro - - javascript.nextjs - - javascript.nuxt - - javascript.react-router - - javascript.remix - - javascript.solidstart - - javascript.sveltekit - - javascript.tanstackstart-react +supportedCategories: + - server --- With Sentry Agent Tracing, you can monitor and debug your AI systems with full-stack context. You'll be able to track key insights like token usage, latency, tool usage, and error rates — and group multi-turn chats in Conversations. Agent Tracing data is fully connected to your other Sentry data like logs, errors, and traces. @@ -115,31 +89,26 @@ Pick your AI stack. Some libraries auto-instrument; others need a short setup to: "/agent-tracing/openai/", title: "OpenAI", icon: "openai", - notSupported: ["javascript.deno"], }, { to: "/agent-tracing/anthropic/", title: "Anthropic", icon: "anthropic", - notSupported: ["javascript.deno"], }, { to: "/agent-tracing/google-genai/", title: "Google Gen AI SDK", icon: "google-genai", - notSupported: ["javascript.deno"], }, { to: "/agent-tracing/langchain/", title: "LangChain", icon: "langchain", - notSupported: ["javascript.deno"], }, { to: "/agent-tracing/langgraph/", title: "LangGraph", icon: "langgraph", - notSupported: ["javascript.deno"], }, { to: "/agent-tracing/mastra/", diff --git a/docs/platforms/javascript/common/agent-tracing/langchain.mdx b/docs/platforms/javascript/common/agent-tracing/langchain.mdx index c6f230c55139e..213544069cbcd 100644 --- a/docs/platforms/javascript/common/agent-tracing/langchain.mdx +++ b/docs/platforms/javascript/common/agent-tracing/langchain.mdx @@ -2,90 +2,17 @@ title: LangChain description: "Adds instrumentation for LangChain." sidebar_order: 24 -supported: - - javascript.node - - javascript.eve - - javascript.aws-lambda - - javascript.azure-functions - - javascript.connect - - javascript.express - - javascript.fastify - - javascript.gcp-functions - - javascript.hapi - - javascript.hono - - javascript.koa - - javascript.nestjs - - javascript.nextjs - - javascript.nuxt - - javascript.solidstart - - javascript.sveltekit - - javascript.react-router - - javascript.remix - - javascript.astro - - javascript.bun - - javascript.tanstackstart-react - - javascript.cloudflare +supportedCategories: + - server --- - - - For meta-framework applications running on both client and server, we recommend **setting up the integration manually** using the [`createLangChainCallbackHandler` wrapper](#manual-instrumentation) to ensure consistent instrumentation across all runtimes. - - +_Import name: `Sentry.langChainIntegration`_ - +The `langChainIntegration` adds instrumentation for [`langchain`](https://www.npmjs.com/package/langchain) to capture spans by automatically wrapping LangChain operations and recording agent interactions with configurable input/output recording. - ## Automatic Instrumentation +This integration is enabled by default and automatically captures spans for LangChain SDK calls (requires Sentry SDK version `10.28.0` or higher). - _Import name: `Sentry.langChainIntegration`_ - - - - If you are using a different runtime (like Bun, Cloudflare Workers or a Browser) or experiencing missing spans, you need to use **[Manual Instrumentation](#manual-instrumentation)** to explicitly wrap your AI client instance instead. - - - - The `langChainIntegration` adds instrumentation for [`langchain`](https://www.npmjs.com/package/langchain) to capture spans by automatically wrapping LangChain operations and recording agent interactions with configurable input/output recording. - - In Node.js runtimes, this integration is enabled by default and automatically captures spans for LangChain SDK calls (requires Sentry SDK version `10.28.0` or higher). - - To customize what data is captured (such as inputs and outputs), see the [Options](#options) in the Configuration section. - - - - - - ## Manual Instrumentation - - _Import name: `Sentry.createLangChainCallbackHandler`_ - - The `createLangChainCallbackHandler` helper adds instrumentation for [`langchain`](https://www.npmjs.com/package/langchain) to capture spans by creating a callback handler that wraps LangChain operations and records agent interactions with configurable input/output recording. You need to manually create and pass this callback handler to your LangChain operations. - - See example below: - - ```javascript - import { ChatAnthropic } from "@langchain/anthropic"; - - // Create a LangChain callback handler - const callbackHandler = Sentry.createLangChainCallbackHandler({ - recordInputs: true, - recordOutputs: true, - }); - - // Use with chat models - const model = new ChatAnthropic({ - model: "claude-3-5-sonnet-20241022", - apiKey: "your-api-key", // Warning: API key will be exposed in browser! - }); - - await model.invoke("Tell me a joke", { - callbacks: [callbackHandler], - }); - ``` - - To customize what data is captured (such as inputs and outputs), see the [Options](#options) in the Configuration section. - - +To customize what data is captured (such as inputs and outputs), see the [Options](#options) in the Configuration section. ## Configuration @@ -111,10 +38,6 @@ Defaults to `true` if `dataCollection.genAI.outputs` is `true` (which is the def **Usage** - - -Using the `langChainIntegration` integration for **automatic instrumentation**: - ```javascript Sentry.init({ dsn: "____PUBLIC_DSN____", @@ -128,20 +51,6 @@ Sentry.init({ }); ``` - - - - -Using the `createLangChainCallbackHandler` wrapper for **manual instrumentation**: - -```javascript -const callbackHandler = Sentry.createLangChainCallbackHandler({ - // your options here -}); -``` - - - ## Supported Operations By default, tracing support is added to the following LangChain SDK calls: diff --git a/docs/platforms/javascript/common/agent-tracing/langgraph.mdx b/docs/platforms/javascript/common/agent-tracing/langgraph.mdx index d624bf14c23f4..826dc88fd8578 100644 --- a/docs/platforms/javascript/common/agent-tracing/langgraph.mdx +++ b/docs/platforms/javascript/common/agent-tracing/langgraph.mdx @@ -2,112 +2,17 @@ title: LangGraph description: "Adds instrumentation for the LangGraph SDK." sidebar_order: 25 -supported: - - javascript.node - - javascript.eve - - javascript.aws-lambda - - javascript.azure-functions - - javascript.connect - - javascript.express - - javascript.fastify - - javascript.gcp-functions - - javascript.hapi - - javascript.hono - - javascript.koa - - javascript.nestjs - - javascript.nextjs - - javascript.nuxt - - javascript.solidstart - - javascript.sveltekit - - javascript.react-router - - javascript.remix - - javascript.astro - - javascript.bun - - javascript.tanstackstart-react - - javascript.cloudflare +supportedCategories: + - server --- - - - For meta-framework applications running on both client and server, we recommend **setting up the integration manually** using the [`instrumentLangGraph` wrapper](#manual-instrumentation) to ensure consistent instrumentation across all runtimes. - - +_Import name: `Sentry.langGraphIntegration`_ - +The `langGraphIntegration` adds instrumentation for [`@langchain/langgraph`](https://www.npmjs.com/package/@langchain/langgraph) to capture spans by automatically wrapping LangGraph operations and recording agent interactions including agent invocations, graph executions, and node operations. - ## Automatic Instrumentation +This integration is enabled by default and automatically captures spans for LangGraph SDK calls (requires Sentry SDK version `10.28.0` or higher). - _Import name: `Sentry.langGraphIntegration`_ - - - - If you are using a different runtime (like Bun, Cloudflare Workers or a Browser) or experiencing missing spans, you need to use **[Manual Instrumentation](#manual-instrumentation)** to explicitly wrap your AI client instance instead. - - - - The `langGraphIntegration` adds instrumentation for [`@langchain/langgraph`](https://www.npmjs.com/package/@langchain/langgraph) to capture spans by automatically wrapping LangGraph operations and recording agent interactions including agent invocations, graph executions, and node operations. - - In Node.js runtimes, this integration is enabled by default and automatically captures spans for LangGraph SDK calls (requires Sentry SDK version `10.28.0` or higher). - - To customize what data is captured (such as inputs and outputs), see the [Options](#options) in the Configuration section. - - - - - - ## Manual Instrumentation - - _Import name: `Sentry.instrumentLangGraph`_ - - The `instrumentLangGraph` helper adds instrumentation for [`@langchain/langgraph`](https://www.npmjs.com/package/@langchain/langgraph) to capture spans by wrapping a `StateGraph` before compilation and recording agent interactions with configurable input/output recording. You need to call this helper on the graph **before** calling `.compile()`. - - See example below: - - ```javascript - import { ChatOpenAI } from "@langchain/openai"; - import { StateGraph, MessagesAnnotation, START, END } from '@langchain/langgraph'; - import { SystemMessage, HumanMessage } from '@langchain/core/messages'; - - // Create LLM call - const llm = new ChatOpenAI({ - modelName: "gpt-4o", - apiKey: "your-api-key", // Warning: API key will be exposed in browser! - }); - - async function callLLM(state) { - const response = await llm.invoke(state.messages); - - return { - messages: [...state.messages, response], - }; - } - - // Create the agent - const agent = new StateGraph(MessagesAnnotation) - .addNode('agent', callLLM) - .addEdge(START, 'agent') - .addEdge('agent', END); - - // Instrument the graph before compiling - Sentry.instrumentLangGraph(agent, { - recordInputs: true, - recordOutputs: true, - }); - - const graph = agent.compile({ name: 'my_agent' }); - - // Invoke the agent - const result = await graph.invoke({ - messages: [ - new SystemMessage("You are a helpful assistant."), - new HumanMessage("Hello!"), - ], - }); - ``` - - To customize what data is captured (such as inputs and outputs), see the [Options](#options) in the Configuration section. - - +To customize what data is captured (such as inputs and outputs), see the [Options](#options) in the Configuration section. ## Configuration @@ -133,10 +38,6 @@ Defaults to `true` if `dataCollection.genAI.outputs` is `true` (which is the def **Usage** - - -Using the `langGraphIntegration` integration for **automatic instrumentation**: - ```javascript Sentry.init({ dsn: "____PUBLIC_DSN____", @@ -150,20 +51,6 @@ Sentry.init({ }); ``` - - - - -Using the `instrumentLangGraph` wrapper for **manual instrumentation**: - -```javascript -Sentry.instrumentLangGraph(graph, { - // your options here -}); -``` - - - ## Supported Operations By default, tracing support is added to the following LangGraph SDK calls: @@ -171,7 +58,6 @@ By default, tracing support is added to the following LangGraph SDK calls: - **Agent Creation** (`gen_ai.create_agent`) - Captures spans when compiling a StateGraph into an executable agent - **Agent Invocation** (`gen_ai.invoke_agent`) - Captures spans for agent execution via `invoke()` - ## Supported Versions - `@langchain/langgraph`: `>=0.2.0 <2.0.0` diff --git a/docs/platforms/javascript/common/agent-tracing/manual-instrumentation.mdx b/docs/platforms/javascript/common/agent-tracing/manual-instrumentation.mdx index 98657524519c3..63aee4d11702a 100644 --- a/docs/platforms/javascript/common/agent-tracing/manual-instrumentation.mdx +++ b/docs/platforms/javascript/common/agent-tracing/manual-instrumentation.mdx @@ -3,34 +3,8 @@ title: Manual Instrumentation sidebar_title: Manual Instrumentation sidebar_order: 90 description: "Learn how to manually instrument your agents to capture spans, token usage, and tool execution." -supported: - - javascript.node - - javascript.eve - - javascript.aws-lambda - - javascript.azure-functions - - javascript.bun - - javascript.cloudflare - - javascript.connect - - javascript.deno - - javascript.effect - - javascript.elysia - - javascript.express - - javascript.fastify - - javascript.firebase - - javascript.gcp-functions - - javascript.hapi - - javascript.hono - - javascript.koa - - javascript.nestjs - - javascript.nitro - - javascript.astro - - javascript.nextjs - - javascript.nuxt - - javascript.react-router - - javascript.remix - - javascript.solidstart - - javascript.sveltekit - - javascript.tanstackstart-react +supportedCategories: + - server --- If your AI library does not have automatic instrumentation, create spans manually. Spans need well-defined names and data attributes so agent data shows up correctly. diff --git a/docs/platforms/javascript/common/agent-tracing/openai.mdx b/docs/platforms/javascript/common/agent-tracing/openai.mdx index 4f7dcea270c05..b16258b6efd6c 100644 --- a/docs/platforms/javascript/common/agent-tracing/openai.mdx +++ b/docs/platforms/javascript/common/agent-tracing/openai.mdx @@ -2,135 +2,17 @@ title: OpenAI description: "Adds instrumentation for the OpenAI SDK." sidebar_order: 21 -supported: - - javascript.node - - javascript.eve - - javascript.aws-lambda - - javascript.azure-functions - - javascript.connect - - javascript.express - - javascript.fastify - - javascript.gcp-functions - - javascript.hapi - - javascript.hono - - javascript.koa - - javascript.nestjs - - javascript.nextjs - - javascript.nuxt - - javascript.solidstart - - javascript.sveltekit - - javascript.react-router - - javascript.remix - - javascript.astro - - javascript.bun - - javascript.tanstackstart-react - - javascript.cloudflare +supportedCategories: + - server --- - - - For meta-framework applications running on both client and server, we recommend using the [`instrumentOpenAiClient` wrapper](#instrument-the-client) to ensure consistent instrumentation across all runtimes. - - +_Import name: `Sentry.openAIIntegration`_ - +The `openAIIntegration` adds instrumentation for the [`openai`](https://www.npmjs.com/package/openai) SDK to capture spans by wrapping OpenAI SDK calls and recording LLM interactions. - ## Automatic Instrumentation +This integration is enabled by default and automatically captures spans for OpenAI SDK calls (requires Sentry SDK version `10.28.0` or higher). - _Import name: `Sentry.openAIIntegration`_ - - - - If you are using a different runtime (like Bun, Cloudflare Workers or a Browser) or experiencing missing spans, **[wrap the client](#instrument-the-client)** with `instrumentOpenAiClient` instead. - - - - The `openAIIntegration` adds instrumentation for the [`openai`](https://www.npmjs.com/package/openai) SDK to capture spans by wrapping OpenAI SDK calls and recording LLM interactions. - - In Node.js runtimes, this integration is enabled by default and automatically captures spans for OpenAI SDK calls (requires Sentry SDK version `10.28.0` or higher). - - To customize what data is captured (such as inputs and outputs), see the [Options](#options) in the Configuration section. - - - - - - ## Instrument the Client - - _Import name: `Sentry.instrumentOpenAiClient`_ - - The `instrumentOpenAiClient` helper instruments the [`openai`](https://www.npmjs.com/package/openai) SDK by wrapping your client instance and recording LLM interactions with configurable input/output capture. - - - - On Cloudflare Workers, enable tracing on the worker (for example with `Sentry.withSentry` and `tracesSampleRate`), then wrap every OpenAI client you use. Tracing alone is not enough — unwrapped clients produce no `gen_ai.*` spans. - - ```javascript - import * as Sentry from "@sentry/cloudflare"; - import OpenAI from "openai"; - - export default Sentry.withSentry( - (env) => ({ - dsn: env.SENTRY_DSN, - tracesSampleRate: 1.0, - }), - { - async fetch(request, env) { - const openai = new OpenAI({ - apiKey: env.OPENAI_API_KEY, - }); - - const client = Sentry.instrumentOpenAiClient(openai, { - recordInputs: true, - recordOutputs: true, - }); - - const response = await client.chat.completions.create({ - model: "gpt-4o-mini", - messages: [{ role: "user", content: "Hello!" }], - }); - - return Response.json(response); - }, - }, - ); - ``` - - If you call OpenAI from a Durable Object over RPC, set `rpcTracePropagationBindings` on both sides. On the Worker, list the Durable Object's binding. On the Durable Object, set the option to an empty array. Wrap the Durable Object with `instrumentDurableObjectWithSentry`. See RPC Trace Propagation. - - For multi-turn Conversations and the User column, see Tracking Conversations (`setConversationId` / `setUser`). - - - - - - See example below: - - ```javascript - import OpenAI from "openai"; - - const openai = new OpenAI({ - // Warning: API key will be exposed in browser! - apiKey: "your-api-key", - }); - - const client = Sentry.instrumentOpenAiClient(openai, { - recordInputs: true, - recordOutputs: true, - }); - - // Use the wrapped client instead of the original openai instance - const response = await client.chat.completions.create({ - model: "gpt-4o", - messages: [{ role: "user", content: "Hello!" }], - }); - ``` - - - - To customize what data is captured (such as inputs and outputs), see the [Options](#options) in the Configuration section. - - +To customize what data is captured (such as inputs and outputs), see the [Options](#options) in the Configuration section. ## Configuration @@ -156,10 +38,6 @@ Defaults to `true` if `dataCollection.genAI.outputs` is `true` (which is the def **Usage** - - -Using the `openAIIntegration` integration for **automatic instrumentation**: - ```javascript Sentry.init({ dsn: "____PUBLIC_DSN____", @@ -173,20 +51,6 @@ Sentry.init({ }); ``` - - - - -Using the `instrumentOpenAiClient` wrapper: - -```javascript -const client = Sentry.instrumentOpenAiClient(openai, { - // your options here -}); -``` - - - ## Supported Operations By default, tracing support is added to the following OpenAI SDK calls: @@ -202,20 +66,10 @@ Instrumented calls record model, token usage, latency, and (when enabled) inputs ### Tool execution spans -The OpenAI SDK does **not** run your tools — your application does, after the model returns `tool_calls`. Because of that, `instrumentOpenAiClient` / `openAIIntegration` do **not** create `gen_ai.execute_tool` spans for local tool handlers. - - +The OpenAI SDK does **not** run your tools — your application does, after the model returns `tool_calls`. Because of that, the OpenAI integration does **not** create `gen_ai.execute_tool` spans for local tool handlers. To get the full agent tree (`gen_ai.invoke_agent` → `gen_ai.chat` + `gen_ai.execute_tool`), wrap your tool loop with manual instrumentation. - - - - -To get the full agent tree (`gen_ai.invoke_agent` → `gen_ai.chat` + `gen_ai.execute_tool`), wrap your tool loop with manual instrumentation. - - - ### Streaming token usage @@ -225,7 +79,7 @@ When using OpenAI's streaming API, you must also pass `stream_options: { include ```javascript -const stream = await client.chat.completions.create({ +const stream = await openai.chat.completions.create({ model: "gpt-4o-mini", messages: [{ role: "user", content: "Hello!" }], stream: true, diff --git a/docs/platforms/javascript/common/agent-tracing/vercelai.mdx b/docs/platforms/javascript/common/agent-tracing/vercelai.mdx index e9fcdfda98cfc..fec05b2bc999b 100644 --- a/docs/platforms/javascript/common/agent-tracing/vercelai.mdx +++ b/docs/platforms/javascript/common/agent-tracing/vercelai.mdx @@ -2,34 +2,8 @@ title: Vercel AI description: "Adds instrumentation for Vercel AI SDK." sidebar_order: 20 -supported: - - javascript.node - - javascript.eve - - javascript.aws-lambda - - javascript.azure-functions - - javascript.bun - - javascript.cloudflare - - javascript.connect - - javascript.deno - - javascript.effect - - javascript.elysia - - javascript.express - - javascript.fastify - - javascript.firebase - - javascript.gcp-functions - - javascript.hapi - - javascript.hono - - javascript.koa - - javascript.nestjs - - javascript.nitro - - javascript.astro - - javascript.nextjs - - javascript.nuxt - - javascript.react-router - - javascript.remix - - javascript.solidstart - - javascript.sveltekit - - javascript.tanstackstart-react +supportedCategories: + - server --- _Import name: `Sentry.vercelAIIntegration`_ diff --git a/docs/platforms/javascript/common/configuration/integrations/console.mdx b/docs/platforms/javascript/common/configuration/integrations/console.mdx index 2f5142476012c..8bd80ff2d03e4 100644 --- a/docs/platforms/javascript/common/configuration/integrations/console.mdx +++ b/docs/platforms/javascript/common/configuration/integrations/console.mdx @@ -2,32 +2,10 @@ title: Console description: "Capture console logs as breadcrumbs. (default)" customCanonicalTag: "/platforms/javascript/guides/express/configuration/integrations/console/" +supportedCategories: + - server supported: - - javascript.node - - javascript.eve - - javascript.mastra - - javascript.aws-lambda - - javascript.azure-functions - - javascript.connect - - javascript.express - - javascript.fastify - - javascript.gcp-functions - - javascript.hapi - - javascript.hono - - javascript.koa - - javascript.nestjs - javascript.electron - - javascript.nextjs - - javascript.nuxt - - javascript.solidstart - - javascript.sveltekit - - javascript.remix - - javascript.react-router - - javascript.astro - - javascript.bun - - javascript.deno - - javascript.cloudflare - - javascript.tanstackstart-react --- diff --git a/docs/platforms/javascript/common/configuration/integrations/modules.mdx b/docs/platforms/javascript/common/configuration/integrations/modules.mdx index f79fe7574066e..c714b3720a86f 100644 --- a/docs/platforms/javascript/common/configuration/integrations/modules.mdx +++ b/docs/platforms/javascript/common/configuration/integrations/modules.mdx @@ -1,32 +1,10 @@ --- title: Modules description: "Add node modules / packages to the event. (default)" +supportedCategories: + - server supported: - - javascript.node - - javascript.eve - - javascript.mastra - - javascript.aws-lambda - - javascript.azure-functions - - javascript.connect - - javascript.express - - javascript.fastify - - javascript.gcp-functions - - javascript.hapi - - javascript.hono - - javascript.koa - - javascript.nestjs - javascript.electron - - javascript.nextjs - - javascript.nuxt - - javascript.solidstart - - javascript.sveltekit - - javascript.remix - - javascript.react-router - - javascript.astro - - javascript.bun - - javascript.deno - - javascript.cloudflare - - javascript.tanstackstart-react --- diff --git a/docs/platforms/javascript/common/configuration/integrations/onuncaughtexception.mdx b/docs/platforms/javascript/common/configuration/integrations/onuncaughtexception.mdx index 479fa2081d112..7860e60d8916d 100644 --- a/docs/platforms/javascript/common/configuration/integrations/onuncaughtexception.mdx +++ b/docs/platforms/javascript/common/configuration/integrations/onuncaughtexception.mdx @@ -1,32 +1,10 @@ --- title: OnUncaughtException description: "Registers handlers to capture global uncaught exceptions. (default)" +supportedCategories: + - server supported: - - javascript.node - - javascript.eve - - javascript.mastra - - javascript.aws-lambda - - javascript.azure-functions - - javascript.connect - - javascript.express - - javascript.fastify - - javascript.gcp-functions - - javascript.hapi - - javascript.hono - - javascript.koa - - javascript.nestjs - javascript.electron - - javascript.nextjs - - javascript.nuxt - - javascript.solidstart - - javascript.sveltekit - - javascript.remix - - javascript.react-router - - javascript.astro - - javascript.bun - - javascript.deno - - javascript.cloudflare - - javascript.tanstackstart-react --- diff --git a/docs/platforms/javascript/common/configuration/integrations/requestdata.mdx b/docs/platforms/javascript/common/configuration/integrations/requestdata.mdx index 85ab98339e6ae..b689165dd9b12 100644 --- a/docs/platforms/javascript/common/configuration/integrations/requestdata.mdx +++ b/docs/platforms/javascript/common/configuration/integrations/requestdata.mdx @@ -1,31 +1,8 @@ --- title: RequestData description: "Adds data about an incoming request to an event. (default)" -supported: - - javascript.bun - - javascript.deno - - javascript.node - - javascript.eve - - javascript.mastra - - javascript.aws-lambda - - javascript.azure-functions - - javascript.connect - - javascript.express - - javascript.fastify - - javascript.gcp-functions - - javascript.hapi - - javascript.hono - - javascript.koa - - javascript.nestjs - - javascript.nextjs - - javascript.nuxt - - javascript.solidstart - - javascript.sveltekit - - javascript.remix - - javascript.react-router - - javascript.astro - - javascript.cloudflare - - javascript.tanstackstart-react +supportedCategories: + - server --- diff --git a/docs/platforms/javascript/common/configuration/integrations/supabase.mdx b/docs/platforms/javascript/common/configuration/integrations/supabase.mdx index 944fbfd3f595e..fb66c5938526c 100644 --- a/docs/platforms/javascript/common/configuration/integrations/supabase.mdx +++ b/docs/platforms/javascript/common/configuration/integrations/supabase.mdx @@ -1,33 +1,11 @@ --- title: Supabase description: "Adds instrumentation for Supabase client operations." +supportedCategories: + - server supported: - javascript.browser - - javascript.node - - javascript.eve - - javascript.mastra - - javascript.aws-lambda - - javascript.azure-functions - - javascript.connect - - javascript.express - - javascript.fastify - - javascript.gcp-functions - - javascript.hapi - - javascript.hono - - javascript.koa - - javascript.nestjs - javascript.electron - - javascript.nextjs - - javascript.nuxt - - javascript.solidstart - - javascript.sveltekit - - javascript.remix - - javascript.react-router - - javascript.astro - - javascript.bun - - javascript.deno - - javascript.cloudflare - - javascript.tanstackstart-react --- _Import name: `Sentry.supabaseIntegration`_ diff --git a/docs/platforms/javascript/common/configuration/integrations/trpc.mdx b/docs/platforms/javascript/common/configuration/integrations/trpc.mdx index 5cfeaf8b22fff..374c35a207bd6 100644 --- a/docs/platforms/javascript/common/configuration/integrations/trpc.mdx +++ b/docs/platforms/javascript/common/configuration/integrations/trpc.mdx @@ -1,32 +1,10 @@ --- title: trpcMiddleware description: "Capture spans & errors for tRPC handlers." +supportedCategories: + - server supported: - - javascript.node - - javascript.eve - - javascript.mastra - - javascript.aws-lambda - - javascript.azure-functions - - javascript.connect - - javascript.express - - javascript.fastify - - javascript.gcp-functions - - javascript.hapi - - javascript.hono - - javascript.koa - - javascript.nestjs - javascript.electron - - javascript.nextjs - - javascript.nuxt - - javascript.solidstart - - javascript.sveltekit - - javascript.remix - - javascript.react-router - - javascript.astro - - javascript.deno - - javascript.bun - - javascript.cloudflare - - javascript.tanstackstart-react --- diff --git a/docs/platforms/javascript/common/configuration/integrations/unhandledrejection.mdx b/docs/platforms/javascript/common/configuration/integrations/unhandledrejection.mdx index 07d9795ff2dbe..2ef59d7340e93 100644 --- a/docs/platforms/javascript/common/configuration/integrations/unhandledrejection.mdx +++ b/docs/platforms/javascript/common/configuration/integrations/unhandledrejection.mdx @@ -1,32 +1,10 @@ --- title: OnUnhandledRejection description: "Registers handlers to capture global unhandled promise rejections. (default)" +supportedCategories: + - server supported: - - javascript.node - - javascript.eve - - javascript.mastra - - javascript.aws-lambda - - javascript.azure-functions - - javascript.connect - - javascript.express - - javascript.fastify - - javascript.gcp-functions - - javascript.hapi - - javascript.hono - - javascript.koa - - javascript.nestjs - javascript.electron - - javascript.nextjs - - javascript.nuxt - - javascript.solidstart - - javascript.sveltekit - - javascript.remix - - javascript.react-router - - javascript.astro - - javascript.bun - - javascript.deno - - javascript.cloudflare - - javascript.tanstackstart-react ---