@sentry/node 10.24.0 → 10.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.js +9 -7
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/integrations/featureFlagShims/launchDarkly.js.map +1 -1
- package/build/cjs/integrations/featureFlagShims/openFeature.js.map +1 -1
- package/build/cjs/integrations/featureFlagShims/statsig.js.map +1 -1
- package/build/cjs/integrations/featureFlagShims/unleash.js.map +1 -1
- package/build/cjs/integrations/fs.js.map +1 -1
- package/build/cjs/integrations/http.js.map +1 -1
- package/build/cjs/integrations/node-fetch.js.map +1 -1
- package/build/cjs/integrations/tracing/amqplib.js.map +1 -1
- package/build/cjs/integrations/tracing/anthropic-ai/index.js.map +1 -1
- package/build/cjs/integrations/tracing/anthropic-ai/instrumentation.js +5 -0
- package/build/cjs/integrations/tracing/anthropic-ai/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/connect.js.map +1 -1
- package/build/cjs/integrations/tracing/dataloader.js.map +1 -1
- package/build/cjs/integrations/tracing/express.js.map +1 -1
- package/build/cjs/integrations/tracing/fastify/fastify-otel/index.js.map +1 -1
- package/build/cjs/integrations/tracing/fastify/index.js.map +1 -1
- package/build/cjs/integrations/tracing/fastify/v3/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/fastify/v3/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/firebase/firebase.js.map +1 -1
- package/build/cjs/integrations/tracing/firebase/otel/firebaseInstrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/firebase/otel/patches/firestore.js.map +1 -1
- package/build/cjs/integrations/tracing/firebase/otel/patches/functions.js.map +1 -1
- package/build/cjs/integrations/tracing/genericPool.js.map +1 -1
- package/build/cjs/integrations/tracing/google-genai/index.js.map +1 -1
- package/build/cjs/integrations/tracing/google-genai/instrumentation.js +5 -2
- package/build/cjs/integrations/tracing/google-genai/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/graphql.js.map +1 -1
- package/build/cjs/integrations/tracing/hapi/index.js.map +1 -1
- package/build/cjs/integrations/tracing/hono/index.js.map +1 -1
- package/build/cjs/integrations/tracing/hono/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/index.js +20 -15
- package/build/cjs/integrations/tracing/index.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka.js.map +1 -1
- package/build/cjs/integrations/tracing/knex.js.map +1 -1
- package/build/cjs/integrations/tracing/koa.js.map +1 -1
- package/build/cjs/integrations/tracing/langchain/index.js +4 -0
- package/build/cjs/integrations/tracing/langchain/index.js.map +1 -1
- package/build/cjs/integrations/tracing/langchain/instrumentation.js +8 -2
- package/build/cjs/integrations/tracing/langchain/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/langgraph/index.js +93 -0
- package/build/cjs/integrations/tracing/langgraph/index.js.map +1 -0
- package/build/cjs/integrations/tracing/langgraph/instrumentation.js +78 -0
- package/build/cjs/integrations/tracing/langgraph/instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing/lrumemoizer.js.map +1 -1
- package/build/cjs/integrations/tracing/mongo.js.map +1 -1
- package/build/cjs/integrations/tracing/mongoose.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql2.js.map +1 -1
- package/build/cjs/integrations/tracing/openai/index.js.map +1 -1
- package/build/cjs/integrations/tracing/openai/instrumentation.js +6 -1
- package/build/cjs/integrations/tracing/openai/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres.js.map +1 -1
- package/build/cjs/integrations/tracing/postgresjs.js.map +1 -1
- package/build/cjs/integrations/tracing/prisma.js.map +1 -1
- package/build/cjs/integrations/tracing/redis.js +18 -7
- package/build/cjs/integrations/tracing/redis.js.map +1 -1
- package/build/cjs/integrations/tracing/tedious.js.map +1 -1
- package/build/cjs/integrations/tracing/vercelai/index.js.map +1 -1
- package/build/cjs/integrations/tracing/vercelai/instrumentation.js.map +1 -1
- package/build/cjs/sdk/index.js.map +1 -1
- package/build/cjs/sdk/initOtel.js.map +1 -1
- package/build/cjs/utils/redisCache.js.map +1 -1
- package/build/esm/index.js +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/integrations/featureFlagShims/launchDarkly.js.map +1 -1
- package/build/esm/integrations/featureFlagShims/openFeature.js.map +1 -1
- package/build/esm/integrations/featureFlagShims/statsig.js.map +1 -1
- package/build/esm/integrations/featureFlagShims/unleash.js.map +1 -1
- package/build/esm/integrations/fs.js.map +1 -1
- package/build/esm/integrations/http.js.map +1 -1
- package/build/esm/integrations/node-fetch.js.map +1 -1
- package/build/esm/integrations/tracing/amqplib.js.map +1 -1
- package/build/esm/integrations/tracing/anthropic-ai/index.js.map +1 -1
- package/build/esm/integrations/tracing/anthropic-ai/instrumentation.js +6 -1
- package/build/esm/integrations/tracing/anthropic-ai/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/connect.js.map +1 -1
- package/build/esm/integrations/tracing/dataloader.js.map +1 -1
- package/build/esm/integrations/tracing/express.js.map +1 -1
- package/build/esm/integrations/tracing/fastify/fastify-otel/index.js.map +1 -1
- package/build/esm/integrations/tracing/fastify/index.js.map +1 -1
- package/build/esm/integrations/tracing/fastify/v3/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/fastify/v3/utils.js.map +1 -1
- package/build/esm/integrations/tracing/firebase/firebase.js.map +1 -1
- package/build/esm/integrations/tracing/firebase/otel/firebaseInstrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/firebase/otel/patches/firestore.js.map +1 -1
- package/build/esm/integrations/tracing/firebase/otel/patches/functions.js.map +1 -1
- package/build/esm/integrations/tracing/genericPool.js.map +1 -1
- package/build/esm/integrations/tracing/google-genai/index.js.map +1 -1
- package/build/esm/integrations/tracing/google-genai/instrumentation.js +6 -3
- package/build/esm/integrations/tracing/google-genai/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/graphql.js.map +1 -1
- package/build/esm/integrations/tracing/hapi/index.js.map +1 -1
- package/build/esm/integrations/tracing/hono/index.js.map +1 -1
- package/build/esm/integrations/tracing/hono/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/index.js +9 -4
- package/build/esm/integrations/tracing/index.js.map +1 -1
- package/build/esm/integrations/tracing/kafka.js.map +1 -1
- package/build/esm/integrations/tracing/knex.js.map +1 -1
- package/build/esm/integrations/tracing/koa.js.map +1 -1
- package/build/esm/integrations/tracing/langchain/index.js +4 -0
- package/build/esm/integrations/tracing/langchain/index.js.map +1 -1
- package/build/esm/integrations/tracing/langchain/instrumentation.js +9 -3
- package/build/esm/integrations/tracing/langchain/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/langgraph/index.js +90 -0
- package/build/esm/integrations/tracing/langgraph/index.js.map +1 -0
- package/build/esm/integrations/tracing/langgraph/instrumentation.js +76 -0
- package/build/esm/integrations/tracing/langgraph/instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing/lrumemoizer.js.map +1 -1
- package/build/esm/integrations/tracing/mongo.js.map +1 -1
- package/build/esm/integrations/tracing/mongoose.js.map +1 -1
- package/build/esm/integrations/tracing/mysql.js.map +1 -1
- package/build/esm/integrations/tracing/mysql2.js.map +1 -1
- package/build/esm/integrations/tracing/openai/index.js.map +1 -1
- package/build/esm/integrations/tracing/openai/instrumentation.js +7 -2
- package/build/esm/integrations/tracing/openai/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/postgres.js.map +1 -1
- package/build/esm/integrations/tracing/postgresjs.js.map +1 -1
- package/build/esm/integrations/tracing/prisma.js.map +1 -1
- package/build/esm/integrations/tracing/redis.js +13 -3
- package/build/esm/integrations/tracing/redis.js.map +1 -1
- package/build/esm/integrations/tracing/tedious.js.map +1 -1
- package/build/esm/integrations/tracing/vercelai/index.js.map +1 -1
- package/build/esm/integrations/tracing/vercelai/instrumentation.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/sdk/index.js.map +1 -1
- package/build/esm/sdk/initOtel.js.map +1 -1
- package/build/esm/utils/redisCache.js.map +1 -1
- package/build/types/index.d.ts +1 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/anthropic-ai/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/google-genai/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/langchain/index.d.ts +4 -0
- package/build/types/integrations/tracing/langchain/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/langchain/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/langgraph/index.d.ts +74 -0
- package/build/types/integrations/tracing/langgraph/index.d.ts.map +1 -0
- package/build/types/integrations/tracing/langgraph/instrumentation.d.ts +19 -0
- package/build/types/integrations/tracing/langgraph/instrumentation.d.ts.map +1 -0
- package/build/types/integrations/tracing/openai/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis.d.ts +16 -0
- package/build/types/integrations/tracing/redis.d.ts.map +1 -1
- package/build/types-ts3.8/index.d.ts +1 -0
- package/build/types-ts3.8/integrations/tracing/langchain/index.d.ts +4 -0
- package/build/types-ts3.8/integrations/tracing/langgraph/index.d.ts +74 -0
- package/build/types-ts3.8/integrations/tracing/langgraph/instrumentation.d.ts +19 -0
- package/build/types-ts3.8/integrations/tracing/redis.d.ts +16 -0
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/langchain/index.ts"],"sourcesContent":["import type { IntegrationFn, LangChainOptions } from '@sentry/core';\nimport { defineIntegration, LANGCHAIN_INTEGRATION_NAME } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\nimport { SentryLangChainInstrumentation } from './instrumentation';\n\nexport const instrumentLangChain = generateInstrumentOnce<LangChainOptions>(\n LANGCHAIN_INTEGRATION_NAME,\n options => new SentryLangChainInstrumentation(options),\n);\n\nconst _langChainIntegration = ((options: LangChainOptions = {}) => {\n return {\n name: LANGCHAIN_INTEGRATION_NAME,\n setupOnce() {\n instrumentLangChain(options);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for LangChain.\n *\n * This integration is enabled by default.\n *\n * When configured, this integration automatically instruments LangChain runnable instances\n * to capture telemetry data by injecting Sentry callback handlers into all LangChain calls.\n *\n * @example\n * ```javascript\n * import * as Sentry from '@sentry/node';\n * import { ChatOpenAI } from '@langchain/openai';\n *\n * Sentry.init({\n * integrations: [Sentry.langChainIntegration()],\n * sendDefaultPii: true, // Enable to record inputs/outputs\n * });\n *\n * // LangChain calls are automatically instrumented\n * const model = new ChatOpenAI();\n * await model.invoke(\"What is the capital of France?\");\n * ```\n *\n * ## Manual Callback Handler\n *\n * You can also manually add the Sentry callback handler alongside other callbacks:\n *\n * @example\n * ```javascript\n * import * as Sentry from '@sentry/node';\n * import { ChatOpenAI } from '@langchain/openai';\n *\n * const sentryHandler = Sentry.createLangChainCallbackHandler({\n * recordInputs: true,\n * recordOutputs: true\n * });\n *\n * const model = new ChatOpenAI();\n * await model.invoke(\n * \"What is the capital of France?\",\n * { callbacks: [sentryHandler, myOtherCallback] }\n * );\n * ```\n *\n * ## Options\n *\n * - `recordInputs`: Whether to record input messages/prompts (default: respects `sendDefaultPii` client option)\n * - `recordOutputs`: Whether to record response text (default: respects `sendDefaultPii` client option)\n *\n * ### Default Behavior\n *\n * By default, the integration will:\n * - Record inputs and outputs ONLY if `sendDefaultPii` is set to `true` in your Sentry client options\n * - Otherwise, inputs and outputs are NOT recorded unless explicitly enabled\n *\n * @example\n * ```javascript\n * // Record inputs and outputs when sendDefaultPii is false\n * Sentry.init({\n * integrations: [\n * Sentry.langChainIntegration({\n * recordInputs: true,\n * recordOutputs: true\n * })\n * ],\n * });\n *\n * // Never record inputs/outputs regardless of sendDefaultPii\n * Sentry.init({\n * sendDefaultPii: true,\n * integrations: [\n * Sentry.langChainIntegration({\n * recordInputs: false,\n * recordOutputs: false\n * })\n * ],\n * });\n * ```\n *\n * ## Supported Events\n *\n * The integration captures the following LangChain lifecycle events:\n * - LLM/Chat Model: start, end, error\n * - Chain: start, end, error\n * - Tool: start, end, error\n *\n */\nexport const langChainIntegration = defineIntegration(_langChainIntegration);\n"],"names":["generateInstrumentOnce","LANGCHAIN_INTEGRATION_NAME","SentryLangChainInstrumentation","defineIntegration"],"mappings":";;;;;;AAKO,MAAM,mBAAA,GAAsBA,+BAAsB;AACzD,EAAEC,+BAA0B;AAC5B,EAAE,WAAW,IAAIC,8CAA8B,CAAC,OAAO,CAAC;AACxD;;AAEA,MAAM,qBAAA,IAAyB,CAAC,OAAO,GAAqB,EAAE,KAAK;AACnE,EAAE,OAAO;AACT,IAAI,IAAI,EAAED,+BAA0B;AACpC,IAAI,SAAS,GAAG;AAChB,MAAM,mBAAmB,CAAC,OAAO,CAAC;AAClC,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/langchain/index.ts"],"sourcesContent":["import type { IntegrationFn, LangChainOptions } from '@sentry/core';\nimport { defineIntegration, LANGCHAIN_INTEGRATION_NAME } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\nimport { SentryLangChainInstrumentation } from './instrumentation';\n\nexport const instrumentLangChain = generateInstrumentOnce<LangChainOptions>(\n LANGCHAIN_INTEGRATION_NAME,\n options => new SentryLangChainInstrumentation(options),\n);\n\nconst _langChainIntegration = ((options: LangChainOptions = {}) => {\n return {\n name: LANGCHAIN_INTEGRATION_NAME,\n setupOnce() {\n instrumentLangChain(options);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for LangChain.\n *\n * This integration is enabled by default.\n *\n * When configured, this integration automatically instruments LangChain runnable instances\n * to capture telemetry data by injecting Sentry callback handlers into all LangChain calls.\n *\n * **Important:** This integration automatically skips wrapping the OpenAI, Anthropic, and Google GenAI\n * providers to prevent duplicate spans when using LangChain with these AI providers.\n * LangChain handles the instrumentation for all underlying AI providers.\n *\n * @example\n * ```javascript\n * import * as Sentry from '@sentry/node';\n * import { ChatOpenAI } from '@langchain/openai';\n *\n * Sentry.init({\n * integrations: [Sentry.langChainIntegration()],\n * sendDefaultPii: true, // Enable to record inputs/outputs\n * });\n *\n * // LangChain calls are automatically instrumented\n * const model = new ChatOpenAI();\n * await model.invoke(\"What is the capital of France?\");\n * ```\n *\n * ## Manual Callback Handler\n *\n * You can also manually add the Sentry callback handler alongside other callbacks:\n *\n * @example\n * ```javascript\n * import * as Sentry from '@sentry/node';\n * import { ChatOpenAI } from '@langchain/openai';\n *\n * const sentryHandler = Sentry.createLangChainCallbackHandler({\n * recordInputs: true,\n * recordOutputs: true\n * });\n *\n * const model = new ChatOpenAI();\n * await model.invoke(\n * \"What is the capital of France?\",\n * { callbacks: [sentryHandler, myOtherCallback] }\n * );\n * ```\n *\n * ## Options\n *\n * - `recordInputs`: Whether to record input messages/prompts (default: respects `sendDefaultPii` client option)\n * - `recordOutputs`: Whether to record response text (default: respects `sendDefaultPii` client option)\n *\n * ### Default Behavior\n *\n * By default, the integration will:\n * - Record inputs and outputs ONLY if `sendDefaultPii` is set to `true` in your Sentry client options\n * - Otherwise, inputs and outputs are NOT recorded unless explicitly enabled\n *\n * @example\n * ```javascript\n * // Record inputs and outputs when sendDefaultPii is false\n * Sentry.init({\n * integrations: [\n * Sentry.langChainIntegration({\n * recordInputs: true,\n * recordOutputs: true\n * })\n * ],\n * });\n *\n * // Never record inputs/outputs regardless of sendDefaultPii\n * Sentry.init({\n * sendDefaultPii: true,\n * integrations: [\n * Sentry.langChainIntegration({\n * recordInputs: false,\n * recordOutputs: false\n * })\n * ],\n * });\n * ```\n *\n * ## Supported Events\n *\n * The integration captures the following LangChain lifecycle events:\n * - LLM/Chat Model: start, end, error\n * - Chain: start, end, error\n * - Tool: start, end, error\n *\n */\nexport const langChainIntegration = defineIntegration(_langChainIntegration);\n"],"names":["generateInstrumentOnce","LANGCHAIN_INTEGRATION_NAME","SentryLangChainInstrumentation","defineIntegration"],"mappings":";;;;;;AAKO,MAAM,mBAAA,GAAsBA,+BAAsB;AACzD,EAAEC,+BAA0B;AAC5B,EAAE,WAAW,IAAIC,8CAA8B,CAAC,OAAO,CAAC;AACxD;;AAEA,MAAM,qBAAA,IAAyB,CAAC,OAAO,GAAqB,EAAE,KAAK;AACnE,EAAE,OAAO;AACT,IAAI,IAAI,EAAED,+BAA0B;AACpC,IAAI,SAAS,GAAG;AAChB,MAAM,mBAAmB,CAAC,OAAO,CAAC;AAClC,IAAI,CAAC;AACL,GAAG;AACH,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,oBAAA,GAAuBE,sBAAiB,CAAC,qBAAqB;;;;;"}
|
|
@@ -129,14 +129,20 @@ class SentryLangChainInstrumentation extends instrumentation.InstrumentationBase
|
|
|
129
129
|
* This is called when a LangChain provider package is loaded
|
|
130
130
|
*/
|
|
131
131
|
_patch(exports) {
|
|
132
|
+
// Skip AI provider wrapping now that LangChain is actually being used
|
|
133
|
+
// This prevents duplicate spans from Anthropic/OpenAI/GoogleGenAI standalone integrations
|
|
134
|
+
core._INTERNAL_skipAiProviderWrapping([
|
|
135
|
+
core.OPENAI_INTEGRATION_NAME,
|
|
136
|
+
core.ANTHROPIC_AI_INTEGRATION_NAME,
|
|
137
|
+
core.GOOGLE_GENAI_INTEGRATION_NAME,
|
|
138
|
+
]);
|
|
139
|
+
|
|
132
140
|
const client = core.getClient();
|
|
133
141
|
const defaultPii = Boolean(client?.getOptions().sendDefaultPii);
|
|
134
142
|
|
|
135
143
|
const config = this.getConfig();
|
|
136
144
|
|
|
137
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
138
145
|
const recordInputs = config?.recordInputs ?? defaultPii;
|
|
139
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
140
146
|
const recordOutputs = config?.recordOutputs ?? defaultPii;
|
|
141
147
|
|
|
142
148
|
// Create a shared handler instance
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sources":["../../../../../src/integrations/tracing/langchain/instrumentation.ts"],"sourcesContent":["import {\n type InstrumentationConfig,\n type InstrumentationModuleDefinition,\n InstrumentationBase,\n InstrumentationNodeModuleDefinition,\n InstrumentationNodeModuleFile,\n} from '@opentelemetry/instrumentation';\nimport type { LangChainOptions } from '@sentry/core';\nimport { createLangChainCallbackHandler, getClient, SDK_VERSION } from '@sentry/core';\n\nconst supportedVersions = ['>=0.1.0 <1.0.0'];\n\ntype LangChainInstrumentationOptions = InstrumentationConfig & LangChainOptions;\n\n/**\n * Represents the patched shape of LangChain provider package exports\n */\ninterface PatchedLangChainExports {\n [key: string]: unknown;\n}\n\n/**\n * Augments a callback handler list with Sentry's handler if not already present\n */\nfunction augmentCallbackHandlers(handlers: unknown, sentryHandler: unknown): unknown {\n // Handle null/undefined - return array with just our handler\n if (!handlers) {\n return [sentryHandler];\n }\n\n // If handlers is already an array\n if (Array.isArray(handlers)) {\n // Check if our handler is already in the list\n if (handlers.includes(sentryHandler)) {\n return handlers;\n }\n // Add our handler to the list\n return [...handlers, sentryHandler];\n }\n\n // If it's a single handler object, convert to array\n if (typeof handlers === 'object') {\n return [handlers, sentryHandler];\n }\n\n // Unknown type - return original\n return handlers;\n}\n\n/**\n * Wraps Runnable methods (invoke, stream, batch) to inject Sentry callbacks at request time\n * Uses a Proxy to intercept method calls and augment the options.callbacks\n */\nfunction wrapRunnableMethod(\n originalMethod: (...args: unknown[]) => unknown,\n sentryHandler: unknown,\n _methodName: string,\n): (...args: unknown[]) => unknown {\n return new Proxy(originalMethod, {\n apply(target, thisArg, args: unknown[]): unknown {\n // LangChain Runnable method signatures:\n // invoke(input, options?) - options contains callbacks\n // stream(input, options?) - options contains callbacks\n // batch(inputs, options?) - options contains callbacks\n\n // Options is typically the second argument\n const optionsIndex = 1;\n let options = args[optionsIndex] as Record<string, unknown> | undefined;\n\n // If options don't exist or aren't an object, create them\n if (!options || typeof options !== 'object' || Array.isArray(options)) {\n options = {};\n args[optionsIndex] = options;\n }\n\n // Inject our callback handler into options.callbacks (request time callbacks)\n const existingCallbacks = options.callbacks;\n const augmentedCallbacks = augmentCallbackHandlers(existingCallbacks, sentryHandler);\n options.callbacks = augmentedCallbacks;\n\n // Call original method with augmented options\n return Reflect.apply(target, thisArg, args);\n },\n }) as (...args: unknown[]) => unknown;\n}\n\n/**\n * Sentry LangChain instrumentation using OpenTelemetry.\n */\nexport class SentryLangChainInstrumentation extends InstrumentationBase<LangChainInstrumentationOptions> {\n public constructor(config: LangChainInstrumentationOptions = {}) {\n super('@sentry/instrumentation-langchain', SDK_VERSION, config);\n }\n\n /**\n * Initializes the instrumentation by defining the modules to be patched.\n * We patch the BaseChatModel class methods to inject callbacks\n *\n * We hook into provider packages (@langchain/anthropic, @langchain/openai, etc.)\n * because @langchain/core is often bundled and not loaded as a separate module\n */\n public init(): InstrumentationModuleDefinition | InstrumentationModuleDefinition[] {\n const modules: InstrumentationModuleDefinition[] = [];\n\n // Hook into common LangChain provider packages\n const providerPackages = [\n '@langchain/anthropic',\n '@langchain/openai',\n '@langchain/google-genai',\n '@langchain/mistralai',\n '@langchain/google-vertexai',\n '@langchain/groq',\n ];\n\n for (const packageName of providerPackages) {\n // In CJS, LangChain packages re-export from dist/index.cjs files.\n // Patching only the root module sometimes misses the real implementation or\n // gets overwritten when that file is loaded. We add a file-level patch so that\n // _patch runs again on the concrete implementation\n modules.push(\n new InstrumentationNodeModuleDefinition(\n packageName,\n supportedVersions,\n this._patch.bind(this),\n exports => exports,\n [\n new InstrumentationNodeModuleFile(\n `${packageName}/dist/index.cjs`,\n supportedVersions,\n this._patch.bind(this),\n exports => exports,\n ),\n ],\n ),\n );\n }\n\n return modules;\n }\n\n /**\n * Core patch logic - patches chat model methods to inject Sentry callbacks\n * This is called when a LangChain provider package is loaded\n */\n private _patch(exports: PatchedLangChainExports): PatchedLangChainExports | void {\n const client = getClient();\n const defaultPii = Boolean(client?.getOptions().sendDefaultPii);\n\n const config = this.getConfig();\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const recordInputs = config?.recordInputs ?? defaultPii;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const recordOutputs = config?.recordOutputs ?? defaultPii;\n\n // Create a shared handler instance\n const sentryHandler = createLangChainCallbackHandler({\n recordInputs,\n recordOutputs,\n });\n\n // Patch Runnable methods to inject callbacks at request time\n // This directly manipulates options.callbacks that LangChain uses\n this._patchRunnableMethods(exports, sentryHandler);\n\n return exports;\n }\n\n /**\n * Patches chat model methods (invoke, stream, batch) to inject Sentry callbacks\n * Finds a chat model class from the provider package exports and patches its prototype methods\n */\n private _patchRunnableMethods(exports: PatchedLangChainExports, sentryHandler: unknown): void {\n // Known chat model class names for each provider\n const knownChatModelNames = [\n 'ChatAnthropic',\n 'ChatOpenAI',\n 'ChatGoogleGenerativeAI',\n 'ChatMistralAI',\n 'ChatVertexAI',\n 'ChatGroq',\n ];\n\n // Find a chat model class in the exports by checking known class names\n const chatModelClass = Object.values(exports).find(exp => {\n if (typeof exp !== 'function') {\n return false;\n }\n return knownChatModelNames.includes(exp.name);\n }) as { prototype: unknown; name: string } | undefined;\n\n if (!chatModelClass) {\n return;\n }\n\n // Patch directly on chatModelClass.prototype\n const targetProto = chatModelClass.prototype as Record<string, unknown>;\n\n // Patch the methods (invoke, stream, batch)\n // All chat model instances will inherit these patched methods\n const methodsToPatch = ['invoke', 'stream', 'batch'] as const;\n\n for (const methodName of methodsToPatch) {\n const method = targetProto[methodName];\n if (typeof method === 'function') {\n targetProto[methodName] = wrapRunnableMethod(\n method as (...args: unknown[]) => unknown,\n sentryHandler,\n methodName,\n );\n }\n }\n }\n}\n"],"names":["InstrumentationBase","SDK_VERSION","InstrumentationNodeModuleDefinition","InstrumentationNodeModuleFile","getClient","createLangChainCallbackHandler"],"mappings":";;;;;AAUA,MAAM,iBAAA,GAAoB,CAAC,gBAAgB,CAAC;;AAW5C;AACA;AACA;AACA,SAAS,uBAAuB,CAAC,QAAQ,EAAW,aAAa,EAAoB;AACrF;AACA,EAAE,IAAI,CAAC,QAAQ,EAAE;AACjB,IAAI,OAAO,CAAC,aAAa,CAAC;AAC1B;;AAEA;AACA,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;AAC/B;AACA,IAAI,IAAI,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;AAC1C,MAAM,OAAO,QAAQ;AACrB;AACA;AACA,IAAI,OAAO,CAAC,GAAG,QAAQ,EAAE,aAAa,CAAC;AACvC;;AAEA;AACA,EAAE,IAAI,OAAO,QAAA,KAAa,QAAQ,EAAE;AACpC,IAAI,OAAO,CAAC,QAAQ,EAAE,aAAa,CAAC;AACpC;;AAEA;AACA,EAAE,OAAO,QAAQ;AACjB;;AAEA;AACA;AACA;AACA;AACA,SAAS,kBAAkB;AAC3B,EAAE,cAAc;AAChB,EAAE,aAAa;AACf,EAAE,WAAW;AACb,EAAmC;AACnC,EAAE,OAAO,IAAI,KAAK,CAAC,cAAc,EAAE;AACnC,IAAI,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAsB;AACrD;AACA;AACA;AACA;;AAEA;AACA,MAAM,MAAM,YAAA,GAAe,CAAC;AAC5B,MAAM,IAAI,OAAA,GAAU,IAAI,CAA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,OAAA,mBAAA,CAAA,QAAA,CAAA,GAAA,CAAA,IAAA,CAAA;AACA,KAAA,CAAA;;AAEA,IAAA,IAAA,CAAA,cAAA,EAAA;AACA,MAAA;AACA;;AAEA;AACA,IAAA,MAAA,WAAA,GAAA,cAAA,CAAA,SAAA;;AAEA;AACA;AACA,IAAA,MAAA,cAAA,GAAA,CAAA,QAAA,EAAA,QAAA,EAAA,OAAA,CAAA;;AAEA,IAAA,KAAA,MAAA,UAAA,IAAA,cAAA,EAAA;AACA,MAAA,MAAA,MAAA,GAAA,WAAA,CAAA,UAAA,CAAA;AACA,MAAA,IAAA,OAAA,MAAA,KAAA,UAAA,EAAA;AACA,QAAA,WAAA,CAAA,UAAA,CAAA,GAAA,kBAAA;AACA,UAAA,MAAA;AACA,UAAA,aAEA,CAAA;AACA;AACA;AACA;AACA;;;;"}
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sources":["../../../../../src/integrations/tracing/langchain/instrumentation.ts"],"sourcesContent":["import {\n type InstrumentationConfig,\n type InstrumentationModuleDefinition,\n InstrumentationBase,\n InstrumentationNodeModuleDefinition,\n InstrumentationNodeModuleFile,\n} from '@opentelemetry/instrumentation';\nimport type { LangChainOptions } from '@sentry/core';\nimport {\n _INTERNAL_skipAiProviderWrapping,\n ANTHROPIC_AI_INTEGRATION_NAME,\n createLangChainCallbackHandler,\n getClient,\n GOOGLE_GENAI_INTEGRATION_NAME,\n OPENAI_INTEGRATION_NAME,\n SDK_VERSION,\n} from '@sentry/core';\n\nconst supportedVersions = ['>=0.1.0 <1.0.0'];\n\ntype LangChainInstrumentationOptions = InstrumentationConfig & LangChainOptions;\n\n/**\n * Represents the patched shape of LangChain provider package exports\n */\ninterface PatchedLangChainExports {\n [key: string]: unknown;\n}\n\n/**\n * Augments a callback handler list with Sentry's handler if not already present\n */\nfunction augmentCallbackHandlers(handlers: unknown, sentryHandler: unknown): unknown {\n // Handle null/undefined - return array with just our handler\n if (!handlers) {\n return [sentryHandler];\n }\n\n // If handlers is already an array\n if (Array.isArray(handlers)) {\n // Check if our handler is already in the list\n if (handlers.includes(sentryHandler)) {\n return handlers;\n }\n // Add our handler to the list\n return [...handlers, sentryHandler];\n }\n\n // If it's a single handler object, convert to array\n if (typeof handlers === 'object') {\n return [handlers, sentryHandler];\n }\n\n // Unknown type - return original\n return handlers;\n}\n\n/**\n * Wraps Runnable methods (invoke, stream, batch) to inject Sentry callbacks at request time\n * Uses a Proxy to intercept method calls and augment the options.callbacks\n */\nfunction wrapRunnableMethod(\n originalMethod: (...args: unknown[]) => unknown,\n sentryHandler: unknown,\n _methodName: string,\n): (...args: unknown[]) => unknown {\n return new Proxy(originalMethod, {\n apply(target, thisArg, args: unknown[]): unknown {\n // LangChain Runnable method signatures:\n // invoke(input, options?) - options contains callbacks\n // stream(input, options?) - options contains callbacks\n // batch(inputs, options?) - options contains callbacks\n\n // Options is typically the second argument\n const optionsIndex = 1;\n let options = args[optionsIndex] as Record<string, unknown> | undefined;\n\n // If options don't exist or aren't an object, create them\n if (!options || typeof options !== 'object' || Array.isArray(options)) {\n options = {};\n args[optionsIndex] = options;\n }\n\n // Inject our callback handler into options.callbacks (request time callbacks)\n const existingCallbacks = options.callbacks;\n const augmentedCallbacks = augmentCallbackHandlers(existingCallbacks, sentryHandler);\n options.callbacks = augmentedCallbacks;\n\n // Call original method with augmented options\n return Reflect.apply(target, thisArg, args);\n },\n }) as (...args: unknown[]) => unknown;\n}\n\n/**\n * Sentry LangChain instrumentation using OpenTelemetry.\n */\nexport class SentryLangChainInstrumentation extends InstrumentationBase<LangChainInstrumentationOptions> {\n public constructor(config: LangChainInstrumentationOptions = {}) {\n super('@sentry/instrumentation-langchain', SDK_VERSION, config);\n }\n\n /**\n * Initializes the instrumentation by defining the modules to be patched.\n * We patch the BaseChatModel class methods to inject callbacks\n *\n * We hook into provider packages (@langchain/anthropic, @langchain/openai, etc.)\n * because @langchain/core is often bundled and not loaded as a separate module\n */\n public init(): InstrumentationModuleDefinition | InstrumentationModuleDefinition[] {\n const modules: InstrumentationModuleDefinition[] = [];\n\n // Hook into common LangChain provider packages\n const providerPackages = [\n '@langchain/anthropic',\n '@langchain/openai',\n '@langchain/google-genai',\n '@langchain/mistralai',\n '@langchain/google-vertexai',\n '@langchain/groq',\n ];\n\n for (const packageName of providerPackages) {\n // In CJS, LangChain packages re-export from dist/index.cjs files.\n // Patching only the root module sometimes misses the real implementation or\n // gets overwritten when that file is loaded. We add a file-level patch so that\n // _patch runs again on the concrete implementation\n modules.push(\n new InstrumentationNodeModuleDefinition(\n packageName,\n supportedVersions,\n this._patch.bind(this),\n exports => exports,\n [\n new InstrumentationNodeModuleFile(\n `${packageName}/dist/index.cjs`,\n supportedVersions,\n this._patch.bind(this),\n exports => exports,\n ),\n ],\n ),\n );\n }\n\n return modules;\n }\n\n /**\n * Core patch logic - patches chat model methods to inject Sentry callbacks\n * This is called when a LangChain provider package is loaded\n */\n private _patch(exports: PatchedLangChainExports): PatchedLangChainExports | void {\n // Skip AI provider wrapping now that LangChain is actually being used\n // This prevents duplicate spans from Anthropic/OpenAI/GoogleGenAI standalone integrations\n _INTERNAL_skipAiProviderWrapping([\n OPENAI_INTEGRATION_NAME,\n ANTHROPIC_AI_INTEGRATION_NAME,\n GOOGLE_GENAI_INTEGRATION_NAME,\n ]);\n\n const client = getClient();\n const defaultPii = Boolean(client?.getOptions().sendDefaultPii);\n\n const config = this.getConfig();\n\n const recordInputs = config?.recordInputs ?? defaultPii;\n const recordOutputs = config?.recordOutputs ?? defaultPii;\n\n // Create a shared handler instance\n const sentryHandler = createLangChainCallbackHandler({\n recordInputs,\n recordOutputs,\n });\n\n // Patch Runnable methods to inject callbacks at request time\n // This directly manipulates options.callbacks that LangChain uses\n this._patchRunnableMethods(exports, sentryHandler);\n\n return exports;\n }\n\n /**\n * Patches chat model methods (invoke, stream, batch) to inject Sentry callbacks\n * Finds a chat model class from the provider package exports and patches its prototype methods\n */\n private _patchRunnableMethods(exports: PatchedLangChainExports, sentryHandler: unknown): void {\n // Known chat model class names for each provider\n const knownChatModelNames = [\n 'ChatAnthropic',\n 'ChatOpenAI',\n 'ChatGoogleGenerativeAI',\n 'ChatMistralAI',\n 'ChatVertexAI',\n 'ChatGroq',\n ];\n\n // Find a chat model class in the exports by checking known class names\n const chatModelClass = Object.values(exports).find(exp => {\n if (typeof exp !== 'function') {\n return false;\n }\n return knownChatModelNames.includes(exp.name);\n }) as { prototype: unknown; name: string } | undefined;\n\n if (!chatModelClass) {\n return;\n }\n\n // Patch directly on chatModelClass.prototype\n const targetProto = chatModelClass.prototype as Record<string, unknown>;\n\n // Patch the methods (invoke, stream, batch)\n // All chat model instances will inherit these patched methods\n const methodsToPatch = ['invoke', 'stream', 'batch'] as const;\n\n for (const methodName of methodsToPatch) {\n const method = targetProto[methodName];\n if (typeof method === 'function') {\n targetProto[methodName] = wrapRunnableMethod(\n method as (...args: unknown[]) => unknown,\n sentryHandler,\n methodName,\n );\n }\n }\n }\n}\n"],"names":["InstrumentationBase","SDK_VERSION","InstrumentationNodeModuleDefinition","InstrumentationNodeModuleFile","_INTERNAL_skipAiProviderWrapping","OPENAI_INTEGRATION_NAME","ANTHROPIC_AI_INTEGRATION_NAME","GOOGLE_GENAI_INTEGRATION_NAME","getClient","createLangChainCallbackHandler"],"mappings":";;;;;AAkBA,MAAM,iBAAA,GAAoB,CAAC,gBAAgB,CAAC;;AAW5C;AACA;AACA;AACA,SAAS,uBAAuB,CAAC,QAAQ,EAAW,aAAa,EAAoB;AACrF;AACA,EAAE,IAAI,CAAC,QAAQ,EAAE;AACjB,IAAI,OAAO,CAAC,aAAa,CAAC;AAC1B,EAAE;;AAEF;AACA,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;AAC/B;AACA,IAAI,IAAI,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;AAC1C,MAAM,OAAO,QAAQ;AACrB,IAAI;AACJ;AACA,IAAI,OAAO,CAAC,GAAG,QAAQ,EAAE,aAA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+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const core = require('@sentry/core');
|
|
4
|
+
const nodeCore = require('@sentry/node-core');
|
|
5
|
+
const instrumentation = require('./instrumentation.js');
|
|
6
|
+
|
|
7
|
+
const instrumentLangGraph = nodeCore.generateInstrumentOnce(
|
|
8
|
+
core.LANGGRAPH_INTEGRATION_NAME,
|
|
9
|
+
options => new instrumentation.SentryLangGraphInstrumentation(options),
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
const _langGraphIntegration = ((options = {}) => {
|
|
13
|
+
return {
|
|
14
|
+
name: core.LANGGRAPH_INTEGRATION_NAME,
|
|
15
|
+
setupOnce() {
|
|
16
|
+
instrumentLangGraph(options);
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
}) ;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Adds Sentry tracing instrumentation for LangGraph.
|
|
23
|
+
*
|
|
24
|
+
* This integration is enabled by default.
|
|
25
|
+
*
|
|
26
|
+
* When configured, this integration automatically instruments LangGraph StateGraph and compiled graph instances
|
|
27
|
+
* to capture telemetry data following OpenTelemetry Semantic Conventions for Generative AI.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```javascript
|
|
31
|
+
* import * as Sentry from '@sentry/node';
|
|
32
|
+
*
|
|
33
|
+
* Sentry.init({
|
|
34
|
+
* integrations: [Sentry.langGraphIntegration()],
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* ## Options
|
|
39
|
+
*
|
|
40
|
+
* - `recordInputs`: Whether to record input messages (default: respects `sendDefaultPii` client option)
|
|
41
|
+
* - `recordOutputs`: Whether to record response text (default: respects `sendDefaultPii` client option)
|
|
42
|
+
*
|
|
43
|
+
* ### Default Behavior
|
|
44
|
+
*
|
|
45
|
+
* By default, the integration will:
|
|
46
|
+
* - Record inputs and outputs ONLY if `sendDefaultPii` is set to `true` in your Sentry client options
|
|
47
|
+
* - Otherwise, inputs and outputs are NOT recorded unless explicitly enabled
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```javascript
|
|
51
|
+
* // Record inputs and outputs when sendDefaultPii is false
|
|
52
|
+
* Sentry.init({
|
|
53
|
+
* integrations: [
|
|
54
|
+
* Sentry.langGraphIntegration({
|
|
55
|
+
* recordInputs: true,
|
|
56
|
+
* recordOutputs: true
|
|
57
|
+
* })
|
|
58
|
+
* ],
|
|
59
|
+
* });
|
|
60
|
+
*
|
|
61
|
+
* // Never record inputs/outputs regardless of sendDefaultPii
|
|
62
|
+
* Sentry.init({
|
|
63
|
+
* sendDefaultPii: true,
|
|
64
|
+
* integrations: [
|
|
65
|
+
* Sentry.langGraphIntegration({
|
|
66
|
+
* recordInputs: false,
|
|
67
|
+
* recordOutputs: false
|
|
68
|
+
* })
|
|
69
|
+
* ],
|
|
70
|
+
* });
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* ## Captured Operations
|
|
74
|
+
*
|
|
75
|
+
* The integration captures the following LangGraph operations:
|
|
76
|
+
* - **Agent Creation** (`StateGraph.compile()`) - Creates a `gen_ai.create_agent` span
|
|
77
|
+
* - **Agent Invocation** (`CompiledGraph.invoke()`) - Creates a `gen_ai.invoke_agent` span
|
|
78
|
+
*
|
|
79
|
+
* ## Captured Data
|
|
80
|
+
*
|
|
81
|
+
* When `recordInputs` and `recordOutputs` are enabled, the integration captures:
|
|
82
|
+
* - Input messages from the graph state
|
|
83
|
+
* - Output messages and LLM responses
|
|
84
|
+
* - Tool calls made during agent execution
|
|
85
|
+
* - Agent and graph names
|
|
86
|
+
* - Available tools configured in the graph
|
|
87
|
+
*
|
|
88
|
+
*/
|
|
89
|
+
const langGraphIntegration = core.defineIntegration(_langGraphIntegration);
|
|
90
|
+
|
|
91
|
+
exports.instrumentLangGraph = instrumentLangGraph;
|
|
92
|
+
exports.langGraphIntegration = langGraphIntegration;
|
|
93
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/langgraph/index.ts"],"sourcesContent":["import type { IntegrationFn, LangGraphOptions } from '@sentry/core';\nimport { defineIntegration, LANGGRAPH_INTEGRATION_NAME } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\nimport { SentryLangGraphInstrumentation } from './instrumentation';\n\nexport const instrumentLangGraph = generateInstrumentOnce<LangGraphOptions>(\n LANGGRAPH_INTEGRATION_NAME,\n options => new SentryLangGraphInstrumentation(options),\n);\n\nconst _langGraphIntegration = ((options: LangGraphOptions = {}) => {\n return {\n name: LANGGRAPH_INTEGRATION_NAME,\n setupOnce() {\n instrumentLangGraph(options);\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for LangGraph.\n *\n * This integration is enabled by default.\n *\n * When configured, this integration automatically instruments LangGraph StateGraph and compiled graph instances\n * to capture telemetry data following OpenTelemetry Semantic Conventions for Generative AI.\n *\n * @example\n * ```javascript\n * import * as Sentry from '@sentry/node';\n *\n * Sentry.init({\n * integrations: [Sentry.langGraphIntegration()],\n * });\n * ```\n *\n * ## Options\n *\n * - `recordInputs`: Whether to record input messages (default: respects `sendDefaultPii` client option)\n * - `recordOutputs`: Whether to record response text (default: respects `sendDefaultPii` client option)\n *\n * ### Default Behavior\n *\n * By default, the integration will:\n * - Record inputs and outputs ONLY if `sendDefaultPii` is set to `true` in your Sentry client options\n * - Otherwise, inputs and outputs are NOT recorded unless explicitly enabled\n *\n * @example\n * ```javascript\n * // Record inputs and outputs when sendDefaultPii is false\n * Sentry.init({\n * integrations: [\n * Sentry.langGraphIntegration({\n * recordInputs: true,\n * recordOutputs: true\n * })\n * ],\n * });\n *\n * // Never record inputs/outputs regardless of sendDefaultPii\n * Sentry.init({\n * sendDefaultPii: true,\n * integrations: [\n * Sentry.langGraphIntegration({\n * recordInputs: false,\n * recordOutputs: false\n * })\n * ],\n * });\n * ```\n *\n * ## Captured Operations\n *\n * The integration captures the following LangGraph operations:\n * - **Agent Creation** (`StateGraph.compile()`) - Creates a `gen_ai.create_agent` span\n * - **Agent Invocation** (`CompiledGraph.invoke()`) - Creates a `gen_ai.invoke_agent` span\n *\n * ## Captured Data\n *\n * When `recordInputs` and `recordOutputs` are enabled, the integration captures:\n * - Input messages from the graph state\n * - Output messages and LLM responses\n * - Tool calls made during agent execution\n * - Agent and graph names\n * - Available tools configured in the graph\n *\n */\nexport const langGraphIntegration = defineIntegration(_langGraphIntegration);\n"],"names":["generateInstrumentOnce","LANGGRAPH_INTEGRATION_NAME","SentryLangGraphInstrumentation","defineIntegration"],"mappings":";;;;;;AAKO,MAAM,mBAAA,GAAsBA,+BAAsB;AACzD,EAAEC,+BAA0B;AAC5B,EAAE,WAAW,IAAIC,8CAA8B,CAAC,OAAO,CAAC;AACxD;;AAEA,MAAM,qBAAA,IAAyB,CAAC,OAAO,GAAqB,EAAE,KAAK;AACnE,EAAE,OAAO;AACT,IAAI,IAAI,EAAED,+BAA0B;AACpC,IAAI,SAAS,GAAG;AAChB,MAAM,mBAAmB,CAAC,OAAO,CAAC;AAClC,IAAI,CAAC;AACL,GAAG;AACH,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,oBAAA,GAAuBE,sBAAiB,CAAC,qBAAqB;;;;;"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const instrumentation = require('@opentelemetry/instrumentation');
|
|
4
|
+
const core = require('@sentry/core');
|
|
5
|
+
|
|
6
|
+
const supportedVersions = ['>=0.0.0 <2.0.0'];
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Sentry LangGraph instrumentation using OpenTelemetry.
|
|
10
|
+
*/
|
|
11
|
+
class SentryLangGraphInstrumentation extends instrumentation.InstrumentationBase {
|
|
12
|
+
constructor(config = {}) {
|
|
13
|
+
super('@sentry/instrumentation-langgraph', core.SDK_VERSION, config);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Initializes the instrumentation by defining the modules to be patched.
|
|
18
|
+
*/
|
|
19
|
+
init() {
|
|
20
|
+
const module = new instrumentation.InstrumentationNodeModuleDefinition(
|
|
21
|
+
'@langchain/langgraph',
|
|
22
|
+
supportedVersions,
|
|
23
|
+
this._patch.bind(this),
|
|
24
|
+
exports => exports,
|
|
25
|
+
[
|
|
26
|
+
new instrumentation.InstrumentationNodeModuleFile(
|
|
27
|
+
/**
|
|
28
|
+
* In CJS, LangGraph packages re-export from dist/index.cjs files.
|
|
29
|
+
* Patching only the root module sometimes misses the real implementation or
|
|
30
|
+
* gets overwritten when that file is loaded. We add a file-level patch so that
|
|
31
|
+
* _patch runs again on the concrete implementation
|
|
32
|
+
*/
|
|
33
|
+
'@langchain/langgraph/dist/index.cjs',
|
|
34
|
+
supportedVersions,
|
|
35
|
+
this._patch.bind(this),
|
|
36
|
+
exports => exports,
|
|
37
|
+
),
|
|
38
|
+
],
|
|
39
|
+
);
|
|
40
|
+
return module;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Core patch logic applying instrumentation to the LangGraph module.
|
|
45
|
+
*/
|
|
46
|
+
_patch(exports) {
|
|
47
|
+
const client = core.getClient();
|
|
48
|
+
const defaultPii = Boolean(client?.getOptions().sendDefaultPii);
|
|
49
|
+
|
|
50
|
+
const config = this.getConfig();
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
52
|
+
const recordInputs = config.recordInputs ?? defaultPii;
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
54
|
+
const recordOutputs = config.recordOutputs ?? defaultPii;
|
|
55
|
+
|
|
56
|
+
const options = {
|
|
57
|
+
recordInputs,
|
|
58
|
+
recordOutputs,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// Patch StateGraph.compile to instrument both compile() and invoke()
|
|
62
|
+
if (exports.StateGraph && typeof exports.StateGraph === 'function') {
|
|
63
|
+
const StateGraph = exports.StateGraph
|
|
64
|
+
|
|
65
|
+
;
|
|
66
|
+
|
|
67
|
+
StateGraph.prototype.compile = core.instrumentStateGraphCompile(
|
|
68
|
+
StateGraph.prototype.compile ,
|
|
69
|
+
options,
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return exports;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
exports.SentryLangGraphInstrumentation = SentryLangGraphInstrumentation;
|
|
78
|
+
//# sourceMappingURL=instrumentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sources":["../../../../../src/integrations/tracing/langgraph/instrumentation.ts"],"sourcesContent":["import {\n type InstrumentationConfig,\n type InstrumentationModuleDefinition,\n InstrumentationBase,\n InstrumentationNodeModuleDefinition,\n InstrumentationNodeModuleFile,\n} from '@opentelemetry/instrumentation';\nimport type { CompiledGraph, LangGraphOptions } from '@sentry/core';\nimport { getClient, instrumentStateGraphCompile, SDK_VERSION } from '@sentry/core';\n\nconst supportedVersions = ['>=0.0.0 <2.0.0'];\n\ntype LangGraphInstrumentationOptions = InstrumentationConfig & LangGraphOptions;\n\n/**\n * Represents the patched shape of the LangGraph module export.\n */\ninterface PatchedModuleExports {\n [key: string]: unknown;\n StateGraph?: abstract new (...args: unknown[]) => unknown;\n}\n\n/**\n * Sentry LangGraph instrumentation using OpenTelemetry.\n */\nexport class SentryLangGraphInstrumentation extends InstrumentationBase<LangGraphInstrumentationOptions> {\n public constructor(config: LangGraphInstrumentationOptions = {}) {\n super('@sentry/instrumentation-langgraph', SDK_VERSION, config);\n }\n\n /**\n * Initializes the instrumentation by defining the modules to be patched.\n */\n public init(): InstrumentationModuleDefinition {\n const module = new InstrumentationNodeModuleDefinition(\n '@langchain/langgraph',\n supportedVersions,\n this._patch.bind(this),\n exports => exports,\n [\n new InstrumentationNodeModuleFile(\n /**\n * In CJS, LangGraph packages re-export from dist/index.cjs files.\n * Patching only the root module sometimes misses the real implementation or\n * gets overwritten when that file is loaded. We add a file-level patch so that\n * _patch runs again on the concrete implementation\n */\n '@langchain/langgraph/dist/index.cjs',\n supportedVersions,\n this._patch.bind(this),\n exports => exports,\n ),\n ],\n );\n return module;\n }\n\n /**\n * Core patch logic applying instrumentation to the LangGraph module.\n */\n private _patch(exports: PatchedModuleExports): PatchedModuleExports | void {\n const client = getClient();\n const defaultPii = Boolean(client?.getOptions().sendDefaultPii);\n\n const config = this.getConfig();\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const recordInputs = config.recordInputs ?? defaultPii;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const recordOutputs = config.recordOutputs ?? defaultPii;\n\n const options: LangGraphOptions = {\n recordInputs,\n recordOutputs,\n };\n\n // Patch StateGraph.compile to instrument both compile() and invoke()\n if (exports.StateGraph && typeof exports.StateGraph === 'function') {\n const StateGraph = exports.StateGraph as {\n prototype: Record<string, unknown>;\n };\n\n StateGraph.prototype.compile = instrumentStateGraphCompile(\n StateGraph.prototype.compile as (...args: unknown[]) => CompiledGraph,\n options,\n );\n }\n\n return exports;\n }\n}\n"],"names":["InstrumentationBase","SDK_VERSION","InstrumentationNodeModuleDefinition","InstrumentationNodeModuleFile","getClient","instrumentStateGraphCompile"],"mappings":";;;;;AAUA,MAAM,iBAAA,GAAoB,C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UAAU,EAAE;AACxE,MAAM,MAAM,UAAA,GAAa,OAAO,CAAC;;AAE3B;;AAEN,MAAM,UAAU,CAAC,SAAS,CAAC,OAAA,GAAUC,gCAA2B;AAChE,QAAQ,UAAU,CAAC,SAAS,CAAC,OAAA;AAC7B,QAAQ,OAAO;AACf,OAAO;AACP,IAAI;;AAEJ,IAAI,OAAO,OAAO;AAClB,EAAE;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lrumemoizer.js","sources":["../../../../src/integrations/tracing/lrumemoizer.ts"],"sourcesContent":["import { LruMemoizerInstrumentation } from '@opentelemetry/instrumentation-lru-memoizer';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'LruMemoizer';\n\nexport const instrumentLruMemoizer = generateInstrumentOnce(INTEGRATION_NAME, () => new LruMemoizerInstrumentation());\n\nconst _lruMemoizerIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentLruMemoizer();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [lru-memoizer](https://www.npmjs.com/package/lru-memoizer) library.\n *\n * For more information, see the [`lruMemoizerIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/lrumemoizer/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.lruMemoizerIntegration()],\n * });\n */\nexport const lruMemoizerIntegration = defineIntegration(_lruMemoizerIntegration);\n"],"names":["generateInstrumentOnce","LruMemoizerInstrumentation","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,aAAa;;AAE/B,MAAM,qBAAA,GAAwBA,+BAAsB,CAAC,gBAAgB,EAAE,MAAM,IAAIC,qDAA0B,EAAE;;AAEpH,MAAM,uBAAA,IAA2B,MAAM;AACvC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,qBAAqB,EAAE;AAC7B,
|
|
1
|
+
{"version":3,"file":"lrumemoizer.js","sources":["../../../../src/integrations/tracing/lrumemoizer.ts"],"sourcesContent":["import { LruMemoizerInstrumentation } from '@opentelemetry/instrumentation-lru-memoizer';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'LruMemoizer';\n\nexport const instrumentLruMemoizer = generateInstrumentOnce(INTEGRATION_NAME, () => new LruMemoizerInstrumentation());\n\nconst _lruMemoizerIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentLruMemoizer();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [lru-memoizer](https://www.npmjs.com/package/lru-memoizer) library.\n *\n * For more information, see the [`lruMemoizerIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/lrumemoizer/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.lruMemoizerIntegration()],\n * });\n */\nexport const lruMemoizerIntegration = defineIntegration(_lruMemoizerIntegration);\n"],"names":["generateInstrumentOnce","LruMemoizerInstrumentation","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,aAAa;;AAE/B,MAAM,qBAAA,GAAwBA,+BAAsB,CAAC,gBAAgB,EAAE,MAAM,IAAIC,qDAA0B,EAAE;;AAEpH,MAAM,uBAAA,IAA2B,MAAM;AACvC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,qBAAqB,EAAE;AAC7B,IAAI,CAAC;AACL,GAAG;AACH,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,sBAAA,GAAyBC,sBAAiB,CAAC,uBAAuB;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mongo.js","sources":["../../../../src/integrations/tracing/mongo.ts"],"sourcesContent":["import { MongoDBInstrumentation } from '@opentelemetry/instrumentation-mongodb';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { addOriginToSpan, generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Mongo';\n\nexport const instrumentMongo = generateInstrumentOnce(\n INTEGRATION_NAME,\n () =>\n new MongoDBInstrumentation({\n dbStatementSerializer: _defaultDbStatementSerializer,\n responseHook(span) {\n addOriginToSpan(span, 'auto.db.otel.mongo');\n },\n }),\n);\n\n/**\n * Replaces values in document with '?', hiding PII and helping grouping.\n */\nexport function _defaultDbStatementSerializer(commandObj: Record<string, unknown>): string {\n const resultObj = _scrubStatement(commandObj);\n return JSON.stringify(resultObj);\n}\n\nfunction _scrubStatement(value: unknown): unknown {\n if (Array.isArray(value)) {\n return value.map(element => _scrubStatement(element));\n }\n\n if (isCommandObj(value)) {\n const initial: Record<string, unknown> = {};\n return Object.entries(value)\n .map(([key, element]) => [key, _scrubStatement(element)])\n .reduce((prev, current) => {\n if (isCommandEntry(current)) {\n prev[current[0]] = current[1];\n }\n return prev;\n }, initial);\n }\n\n // A value like string or number, possible contains PII, scrub it\n return '?';\n}\n\nfunction isCommandObj(value: Record<string, unknown> | unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !isBuffer(value);\n}\n\nfunction isBuffer(value: unknown): boolean {\n let isBuffer = false;\n if (typeof Buffer !== 'undefined') {\n isBuffer = Buffer.isBuffer(value);\n }\n return isBuffer;\n}\n\nfunction isCommandEntry(value: [string, unknown] | unknown): value is [string, unknown] {\n return Array.isArray(value);\n}\n\nconst _mongoIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentMongo();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [mongodb](https://www.npmjs.com/package/mongodb) library.\n *\n * For more information, see the [`mongoIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/mongo/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.mongoIntegration()],\n * });\n * ```\n */\nexport const mongoIntegration = defineIntegration(_mongoIntegration);\n"],"names":["generateInstrumentOnce","MongoDBInstrumentation","addOriginToSpan","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,OAAO;;AAEzB,MAAM,eAAA,GAAkBA,+BAAsB;AACrD,EAAE,gBAAgB;AAClB,EAAE;AACF,IAAI,IAAIC,6CAAsB,CAAC;AAC/B,MAAM,qBAAqB,EAAE,6BAA6B;AAC1D,MAAM,YAAY,CAAC,IAAI,EAAE;AACzB,QAAQC,wBAAe,CAAC,IAAI,EAAE,oBAAoB,CAAC;AACnD,
|
|
1
|
+
{"version":3,"file":"mongo.js","sources":["../../../../src/integrations/tracing/mongo.ts"],"sourcesContent":["import { MongoDBInstrumentation } from '@opentelemetry/instrumentation-mongodb';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { addOriginToSpan, generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Mongo';\n\nexport const instrumentMongo = generateInstrumentOnce(\n INTEGRATION_NAME,\n () =>\n new MongoDBInstrumentation({\n dbStatementSerializer: _defaultDbStatementSerializer,\n responseHook(span) {\n addOriginToSpan(span, 'auto.db.otel.mongo');\n },\n }),\n);\n\n/**\n * Replaces values in document with '?', hiding PII and helping grouping.\n */\nexport function _defaultDbStatementSerializer(commandObj: Record<string, unknown>): string {\n const resultObj = _scrubStatement(commandObj);\n return JSON.stringify(resultObj);\n}\n\nfunction _scrubStatement(value: unknown): unknown {\n if (Array.isArray(value)) {\n return value.map(element => _scrubStatement(element));\n }\n\n if (isCommandObj(value)) {\n const initial: Record<string, unknown> = {};\n return Object.entries(value)\n .map(([key, element]) => [key, _scrubStatement(element)])\n .reduce((prev, current) => {\n if (isCommandEntry(current)) {\n prev[current[0]] = current[1];\n }\n return prev;\n }, initial);\n }\n\n // A value like string or number, possible contains PII, scrub it\n return '?';\n}\n\nfunction isCommandObj(value: Record<string, unknown> | unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !isBuffer(value);\n}\n\nfunction isBuffer(value: unknown): boolean {\n let isBuffer = false;\n if (typeof Buffer !== 'undefined') {\n isBuffer = Buffer.isBuffer(value);\n }\n return isBuffer;\n}\n\nfunction isCommandEntry(value: [string, unknown] | unknown): value is [string, unknown] {\n return Array.isArray(value);\n}\n\nconst _mongoIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentMongo();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [mongodb](https://www.npmjs.com/package/mongodb) library.\n *\n * For more information, see the [`mongoIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/mongo/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.mongoIntegration()],\n * });\n * ```\n */\nexport const mongoIntegration = defineIntegration(_mongoIntegration);\n"],"names":["generateInstrumentOnce","MongoDBInstrumentation","addOriginToSpan","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,OAAO;;AAEzB,MAAM,eAAA,GAAkBA,+BAAsB;AACrD,EAAE,gBAAgB;AAClB,EAAE;AACF,IAAI,IAAIC,6CAAsB,CAAC;AAC/B,MAAM,qBAAqB,EAAE,6BAA6B;AAC1D,MAAM,YAAY,CAAC,IAAI,EAAE;AACzB,QAAQC,wBAAe,CAAC,IAAI,EAAE,oBAAoB,CAAC;AACnD,MAAM,CAAC;AACP,KAAK,CAAC;AACN;;AAEA;AACA;AACA;A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AAC;AACrC,EAAE;AACF,EAAE,OAAO,QAAQ;AACjB;;AAEA,SAAS,cAAc,CAAC,KAAK,EAA2D;AACxF,EAAE,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;AAC7B;;AAEA,MAAM,iBAAA,IAAqB,MAAM;AACjC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,eAAe,EAAE;AACvB,IAAI,CAAC;AACL,GAAG;AACH,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,gBAAA,GAAmBC,sBAAiB,CAAC,iBAAiB;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mongoose.js","sources":["../../../../src/integrations/tracing/mongoose.ts"],"sourcesContent":["import { MongooseInstrumentation } from '@opentelemetry/instrumentation-mongoose';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { addOriginToSpan, generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Mongoose';\n\nexport const instrumentMongoose = generateInstrumentOnce(\n INTEGRATION_NAME,\n () =>\n new MongooseInstrumentation({\n responseHook(span) {\n addOriginToSpan(span, 'auto.db.otel.mongoose');\n },\n }),\n);\n\nconst _mongooseIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentMongoose();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [mongoose](https://www.npmjs.com/package/mongoose) library.\n *\n * For more information, see the [`mongooseIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/mongoose/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.mongooseIntegration()],\n * });\n * ```\n */\nexport const mongooseIntegration = defineIntegration(_mongooseIntegration);\n"],"names":["generateInstrumentOnce","MongooseInstrumentation","addOriginToSpan","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,UAAU;;AAE5B,MAAM,kBAAA,GAAqBA,+BAAsB;AACxD,EAAE,gBAAgB;AAClB,EAAE;AACF,IAAI,IAAIC,+CAAuB,CAAC;AAChC,MAAM,YAAY,CAAC,IAAI,EAAE;AACzB,QAAQC,wBAAe,CAAC,IAAI,EAAE,uBAAuB,CAAC;AACtD,
|
|
1
|
+
{"version":3,"file":"mongoose.js","sources":["../../../../src/integrations/tracing/mongoose.ts"],"sourcesContent":["import { MongooseInstrumentation } from '@opentelemetry/instrumentation-mongoose';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { addOriginToSpan, generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Mongoose';\n\nexport const instrumentMongoose = generateInstrumentOnce(\n INTEGRATION_NAME,\n () =>\n new MongooseInstrumentation({\n responseHook(span) {\n addOriginToSpan(span, 'auto.db.otel.mongoose');\n },\n }),\n);\n\nconst _mongooseIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentMongoose();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [mongoose](https://www.npmjs.com/package/mongoose) library.\n *\n * For more information, see the [`mongooseIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/mongoose/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.mongooseIntegration()],\n * });\n * ```\n */\nexport const mongooseIntegration = defineIntegration(_mongooseIntegration);\n"],"names":["generateInstrumentOnce","MongooseInstrumentation","addOriginToSpan","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,UAAU;;AAE5B,MAAM,kBAAA,GAAqBA,+BAAsB;AACxD,EAAE,gBAAgB;AAClB,EAAE;AACF,IAAI,IAAIC,+CAAuB,CAAC;AAChC,MAAM,YAAY,CAAC,IAAI,EAAE;AACzB,QAAQC,wBAAe,CAAC,IAAI,EAAE,uBAAuB,CAAC;AACtD,MAAM,CAAC;AACP,KAAK,CAAC;AACN;;AAEA,MAAM,oBAAA,IAAwB,MAAM;AACpC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,kBAAkB,EAAE;AAC1B,IAAI,CAAC;AACL,GAAG;AACH,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,mBAAA,GAAsBC,sBAAiB,CAAC,oBAAoB;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mysql.js","sources":["../../../../src/integrations/tracing/mysql.ts"],"sourcesContent":["import { MySQLInstrumentation } from '@opentelemetry/instrumentation-mysql';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Mysql';\n\nexport const instrumentMysql = generateInstrumentOnce(INTEGRATION_NAME, () => new MySQLInstrumentation({}));\n\nconst _mysqlIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentMysql();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [mysql](https://www.npmjs.com/package/mysql) library.\n *\n * For more information, see the [`mysqlIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/mysql/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.mysqlIntegration()],\n * });\n * ```\n */\nexport const mysqlIntegration = defineIntegration(_mysqlIntegration);\n"],"names":["generateInstrumentOnce","MySQLInstrumentation","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,OAAO;;MAEnB,eAAA,GAAkBA,+BAAsB,CAAC,gBAAgB,EAAE,MAAM,IAAIC,yCAAoB,CAAC,EAAE,CAAC;;AAE1G,MAAM,iBAAA,IAAqB,MAAM;AACjC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,eAAe,EAAE;AACvB,
|
|
1
|
+
{"version":3,"file":"mysql.js","sources":["../../../../src/integrations/tracing/mysql.ts"],"sourcesContent":["import { MySQLInstrumentation } from '@opentelemetry/instrumentation-mysql';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Mysql';\n\nexport const instrumentMysql = generateInstrumentOnce(INTEGRATION_NAME, () => new MySQLInstrumentation({}));\n\nconst _mysqlIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentMysql();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [mysql](https://www.npmjs.com/package/mysql) library.\n *\n * For more information, see the [`mysqlIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/mysql/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.mysqlIntegration()],\n * });\n * ```\n */\nexport const mysqlIntegration = defineIntegration(_mysqlIntegration);\n"],"names":["generateInstrumentOnce","MySQLInstrumentation","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,OAAO;;MAEnB,eAAA,GAAkBA,+BAAsB,CAAC,gBAAgB,EAAE,MAAM,IAAIC,yCAAoB,CAAC,EAAE,CAAC;;AAE1G,MAAM,iBAAA,IAAqB,MAAM;AACjC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,eAAe,EAAE;AACvB,IAAI,CAAC;AACL,GAAG;AACH,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,gBAAA,GAAmBC,sBAAiB,CAAC,iBAAiB;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mysql2.js","sources":["../../../../src/integrations/tracing/mysql2.ts"],"sourcesContent":["import { MySQL2Instrumentation } from '@opentelemetry/instrumentation-mysql2';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { addOriginToSpan, generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Mysql2';\n\nexport const instrumentMysql2 = generateInstrumentOnce(\n INTEGRATION_NAME,\n () =>\n new MySQL2Instrumentation({\n responseHook(span) {\n addOriginToSpan(span, 'auto.db.otel.mysql2');\n },\n }),\n);\n\nconst _mysql2Integration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentMysql2();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [mysql2](https://www.npmjs.com/package/mysql2) library.\n *\n * For more information, see the [`mysql2Integration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/mysql2/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.mysqlIntegration()],\n * });\n * ```\n */\nexport const mysql2Integration = defineIntegration(_mysql2Integration);\n"],"names":["generateInstrumentOnce","MySQL2Instrumentation","addOriginToSpan","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,QAAQ;;AAE1B,MAAM,gBAAA,GAAmBA,+BAAsB;AACtD,EAAE,gBAAgB;AAClB,EAAE;AACF,IAAI,IAAIC,2CAAqB,CAAC;AAC9B,MAAM,YAAY,CAAC,IAAI,EAAE;AACzB,QAAQC,wBAAe,CAAC,IAAI,EAAE,qBAAqB,CAAC;AACpD,
|
|
1
|
+
{"version":3,"file":"mysql2.js","sources":["../../../../src/integrations/tracing/mysql2.ts"],"sourcesContent":["import { MySQL2Instrumentation } from '@opentelemetry/instrumentation-mysql2';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { addOriginToSpan, generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Mysql2';\n\nexport const instrumentMysql2 = generateInstrumentOnce(\n INTEGRATION_NAME,\n () =>\n new MySQL2Instrumentation({\n responseHook(span) {\n addOriginToSpan(span, 'auto.db.otel.mysql2');\n },\n }),\n);\n\nconst _mysql2Integration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentMysql2();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [mysql2](https://www.npmjs.com/package/mysql2) library.\n *\n * For more information, see the [`mysql2Integration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/mysql2/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.mysqlIntegration()],\n * });\n * ```\n */\nexport const mysql2Integration = defineIntegration(_mysql2Integration);\n"],"names":["generateInstrumentOnce","MySQL2Instrumentation","addOriginToSpan","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,QAAQ;;AAE1B,MAAM,gBAAA,GAAmBA,+BAAsB;AACtD,EAAE,gBAAgB;AAClB,EAAE;AACF,IAAI,IAAIC,2CAAqB,CAAC;AAC9B,MAAM,YAAY,CAAC,IAAI,EAAE;AACzB,QAAQC,wBAAe,CAAC,IAAI,EAAE,qBAAqB,CAAC;AACpD,MAAM,CAAC;AACP,KAAK,CAAC;AACN;;AAEA,MAAM,kBAAA,IAAsB,MAAM;AAClC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,gBAAgB,EAAE;AACxB,IAAI,CAAC;AACL,GAAG;AACH,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,iBAAA,GAAoBC,sBAAiB,CAAC,kBAAkB;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/openai/index.ts"],"sourcesContent":["import type { IntegrationFn, OpenAiOptions } from '@sentry/core';\nimport { defineIntegration, OPENAI_INTEGRATION_NAME } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\nimport { SentryOpenAiInstrumentation } from './instrumentation';\n\nexport const instrumentOpenAi = generateInstrumentOnce(\n OPENAI_INTEGRATION_NAME,\n () => new SentryOpenAiInstrumentation({}),\n);\n\nconst _openAiIntegration = ((options: OpenAiOptions = {}) => {\n return {\n name: OPENAI_INTEGRATION_NAME,\n options,\n setupOnce() {\n instrumentOpenAi();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the OpenAI SDK.\n *\n * This integration is enabled by default.\n *\n * When configured, this integration automatically instruments OpenAI SDK client instances\n * to capture telemetry data following OpenTelemetry Semantic Conventions for Generative AI.\n *\n * @example\n * ```javascript\n * import * as Sentry from '@sentry/node';\n *\n * Sentry.init({\n * integrations: [Sentry.openAIIntegration()],\n * });\n * ```\n *\n * ## Options\n *\n * - `recordInputs`: Whether to record prompt messages (default: respects `sendDefaultPii` client option)\n * - `recordOutputs`: Whether to record response text (default: respects `sendDefaultPii` client option)\n *\n * ### Default Behavior\n *\n * By default, the integration will:\n * - Record inputs and outputs ONLY if `sendDefaultPii` is set to `true` in your Sentry client options\n * - Otherwise, inputs and outputs are NOT recorded unless explicitly enabled\n *\n * @example\n * ```javascript\n * // Record inputs and outputs when sendDefaultPii is false\n * Sentry.init({\n * integrations: [\n * Sentry.openAIIntegration({\n * recordInputs: true,\n * recordOutputs: true\n * })\n * ],\n * });\n *\n * // Never record inputs/outputs regardless of sendDefaultPii\n * Sentry.init({\n * sendDefaultPii: true,\n * integrations: [\n * Sentry.openAIIntegration({\n * recordInputs: false,\n * recordOutputs: false\n * })\n * ],\n * });\n * ```\n *\n */\nexport const openAIIntegration = defineIntegration(_openAiIntegration);\n"],"names":["generateInstrumentOnce","OPENAI_INTEGRATION_NAME","SentryOpenAiInstrumentation","defineIntegration"],"mappings":";;;;;;AAKO,MAAM,gBAAA,GAAmBA,+BAAsB;AACtD,EAAEC,4BAAuB;AACzB,EAAE,MAAM,IAAIC,2CAA2B,CAAC,EAAE,CAAC;AAC3C;;AAEA,MAAM,kBAAA,IAAsB,CAAC,OAAO,GAAkB,EAAE,KAAK;AAC7D,EAAE,OAAO;AACT,IAAI,IAAI,EAAED,4BAAuB;AACjC,IAAI,OAAO;AACX,IAAI,SAAS,GAAG;AAChB,MAAM,gBAAgB,EAAE;AACxB,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/openai/index.ts"],"sourcesContent":["import type { IntegrationFn, OpenAiOptions } from '@sentry/core';\nimport { defineIntegration, OPENAI_INTEGRATION_NAME } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\nimport { SentryOpenAiInstrumentation } from './instrumentation';\n\nexport const instrumentOpenAi = generateInstrumentOnce(\n OPENAI_INTEGRATION_NAME,\n () => new SentryOpenAiInstrumentation({}),\n);\n\nconst _openAiIntegration = ((options: OpenAiOptions = {}) => {\n return {\n name: OPENAI_INTEGRATION_NAME,\n options,\n setupOnce() {\n instrumentOpenAi();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the OpenAI SDK.\n *\n * This integration is enabled by default.\n *\n * When configured, this integration automatically instruments OpenAI SDK client instances\n * to capture telemetry data following OpenTelemetry Semantic Conventions for Generative AI.\n *\n * @example\n * ```javascript\n * import * as Sentry from '@sentry/node';\n *\n * Sentry.init({\n * integrations: [Sentry.openAIIntegration()],\n * });\n * ```\n *\n * ## Options\n *\n * - `recordInputs`: Whether to record prompt messages (default: respects `sendDefaultPii` client option)\n * - `recordOutputs`: Whether to record response text (default: respects `sendDefaultPii` client option)\n *\n * ### Default Behavior\n *\n * By default, the integration will:\n * - Record inputs and outputs ONLY if `sendDefaultPii` is set to `true` in your Sentry client options\n * - Otherwise, inputs and outputs are NOT recorded unless explicitly enabled\n *\n * @example\n * ```javascript\n * // Record inputs and outputs when sendDefaultPii is false\n * Sentry.init({\n * integrations: [\n * Sentry.openAIIntegration({\n * recordInputs: true,\n * recordOutputs: true\n * })\n * ],\n * });\n *\n * // Never record inputs/outputs regardless of sendDefaultPii\n * Sentry.init({\n * sendDefaultPii: true,\n * integrations: [\n * Sentry.openAIIntegration({\n * recordInputs: false,\n * recordOutputs: false\n * })\n * ],\n * });\n * ```\n *\n */\nexport const openAIIntegration = defineIntegration(_openAiIntegration);\n"],"names":["generateInstrumentOnce","OPENAI_INTEGRATION_NAME","SentryOpenAiInstrumentation","defineIntegration"],"mappings":";;;;;;AAKO,MAAM,gBAAA,GAAmBA,+BAAsB;AACtD,EAAEC,4BAAuB;AACzB,EAAE,MAAM,IAAIC,2CAA2B,CAAC,EAAE,CAAC;AAC3C;;AAEA,MAAM,kBAAA,IAAsB,CAAC,OAAO,GAAkB,EAAE,KAAK;AAC7D,EAAE,OAAO;AACT,IAAI,IAAI,EAAED,4BAAuB;AACjC,IAAI,OAAO;AACX,IAAI,SAAS,GAAG;AAChB,MAAM,gBAAgB,EAAE;AACxB,IAAI,CAAC;AACL,GAAG;AACH,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,iBAAA,GAAoBE,sBAAiB,CAAC,kBAAkB;;;;;"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3
3
|
const instrumentation = require('@opentelemetry/instrumentation');
|
|
4
4
|
const core = require('@sentry/core');
|
|
5
5
|
|
|
6
|
-
const supportedVersions = ['>=4.0.0 <
|
|
6
|
+
const supportedVersions = ['>=4.0.0 <7'];
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Determines telemetry recording settings.
|
|
@@ -40,6 +40,11 @@ class SentryOpenAiInstrumentation extends instrumentation.InstrumentationBase {
|
|
|
40
40
|
const Original = exports.OpenAI;
|
|
41
41
|
|
|
42
42
|
const WrappedOpenAI = function ( ...args) {
|
|
43
|
+
// Check if wrapping should be skipped (e.g., when LangChain is handling instrumentation)
|
|
44
|
+
if (core._INTERNAL_shouldSkipAiProviderWrapping(core.OPENAI_INTEGRATION_NAME)) {
|
|
45
|
+
return Reflect.construct(Original, args) ;
|
|
46
|
+
}
|
|
47
|
+
|
|
43
48
|
const instance = Reflect.construct(Original, args);
|
|
44
49
|
const client = core.getClient();
|
|
45
50
|
const integration = client?.getIntegrationByName(core.OPENAI_INTEGRATION_NAME);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sources":["../../../../../src/integrations/tracing/openai/instrumentation.ts"],"sourcesContent":["import {\n type InstrumentationConfig,\n type InstrumentationModuleDefinition,\n InstrumentationBase,\n InstrumentationNodeModuleDefinition,\n} from '@opentelemetry/instrumentation';\nimport type { Integration, OpenAiClient, OpenAiOptions } from '@sentry/core';\nimport {
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sources":["../../../../../src/integrations/tracing/openai/instrumentation.ts"],"sourcesContent":["import {\n type InstrumentationConfig,\n type InstrumentationModuleDefinition,\n InstrumentationBase,\n InstrumentationNodeModuleDefinition,\n} from '@opentelemetry/instrumentation';\nimport type { Integration, OpenAiClient, OpenAiOptions } from '@sentry/core';\nimport {\n _INTERNAL_shouldSkipAiProviderWrapping,\n getClient,\n instrumentOpenAiClient,\n OPENAI_INTEGRATION_NAME,\n SDK_VERSION,\n} from '@sentry/core';\n\nconst supportedVersions = ['>=4.0.0 <7'];\n\nexport interface OpenAiIntegration extends Integration {\n options: OpenAiOptions;\n}\n\n/**\n * Represents the patched shape of the OpenAI module export.\n */\ninterface PatchedModuleExports {\n [key: string]: unknown;\n OpenAI: abstract new (...args: unknown[]) => OpenAiClient;\n}\n\n/**\n * Determines telemetry recording settings.\n */\nfunction determineRecordingSettings(\n integrationOptions: OpenAiOptions | undefined,\n defaultEnabled: boolean,\n): { recordInputs: boolean; recordOutputs: boolean } {\n const recordInputs = integrationOptions?.recordInputs ?? defaultEnabled;\n const recordOutputs = integrationOptions?.recordOutputs ?? defaultEnabled;\n return { recordInputs, recordOutputs };\n}\n\n/**\n * Sentry OpenAI instrumentation using OpenTelemetry.\n */\nexport class SentryOpenAiInstrumentation extends InstrumentationBase<InstrumentationConfig> {\n public constructor(config: InstrumentationConfig = {}) {\n super('@sentry/instrumentation-openai', SDK_VERSION, config);\n }\n\n /**\n * Initializes the instrumentation by defining the modules to be patched.\n */\n public init(): InstrumentationModuleDefinition {\n const module = new InstrumentationNodeModuleDefinition('openai', supportedVersions, this._patch.bind(this));\n return module;\n }\n\n /**\n * Core patch logic applying instrumentation to the OpenAI client constructor.\n */\n private _patch(exports: PatchedModuleExports): PatchedModuleExports | void {\n const Original = exports.OpenAI;\n\n const WrappedOpenAI = function (this: unknown, ...args: unknown[]) {\n // Check if wrapping should be skipped (e.g., when LangChain is handling instrumentation)\n if (_INTERNAL_shouldSkipAiProviderWrapping(OPENAI_INTEGRATION_NAME)) {\n return Reflect.construct(Original, args) as OpenAiClient;\n }\n\n const instance = Reflect.construct(Original, args);\n const client = getClient();\n const integration = client?.getIntegrationByName<OpenAiIntegration>(OPENAI_INTEGRATION_NAME);\n const integrationOpts = integration?.options;\n const defaultPii = Boolean(client?.getOptions().sendDefaultPii);\n\n const { recordInputs, recordOutputs } = determineRecordingSettings(integrationOpts, defaultPii);\n\n return instrumentOpenAiClient(instance as OpenAiClient, {\n recordInputs,\n recordOutputs,\n });\n } as unknown as abstract new (...args: unknown[]) => OpenAiClient;\n\n // Preserve static and prototype chains\n Object.setPrototypeOf(WrappedOpenAI, Original);\n Object.setPrototypeOf(WrappedOpenAI.prototype, Original.prototype);\n\n for (const key of Object.getOwnPropertyNames(Original)) {\n if (!['length', 'name', 'prototype'].includes(key)) {\n const descriptor = Object.getOwnPropertyDescriptor(Original, key);\n if (descriptor) {\n Object.defineProperty(WrappedOpenAI, key, descriptor);\n }\n }\n }\n\n // Constructor replacement - handle read-only properties\n // The OpenAI property might have only a getter, so use defineProperty\n try {\n exports.OpenAI = WrappedOpenAI;\n } catch (error) {\n // If direct assignment fails, override the property descriptor\n Object.defineProperty(exports, 'OpenAI', {\n value: WrappedOpenAI,\n writable: true,\n configurable: true,\n enumerable: true,\n });\n }\n\n // Wrap the default export if it points to the original constructor\n // Constructor replacement - handle read-only properties\n // The OpenAI property might have only a getter, so use defineProperty\n if (exports.default === Original) {\n try {\n exports.default = WrappedOpenAI;\n } catch (error) {\n // If direct assignment fails, override the property descriptor\n Object.defineProperty(exports, 'default', {\n value: WrappedOpenAI,\n writable: true,\n configurable: true,\n enumerable: true,\n });\n }\n }\n return exports;\n }\n}\n"],"names":["InstrumentationBase","SDK_VERSION","InstrumentationNodeModuleDefinition","_INTERNAL_shouldSkipAiProviderWrapping","OPENAI_INTEGRATION_NAME","getClient","instrumentOpenAiClient"],"mappings":";;;;;AAeA,MAAM,iBAAA,GAAoB,CAAC,YAAY,CAAC;;AAcxC;AACA;AACA;AACA,SAAS,0BAA0B;AACnC,EAAE,kBAAkB;AACpB,EAAE,cAAc;AAChB,EAAqD;AACrD,EAAE,MAAM,YAAA,GAAe,kBAAkB,EAAE,YAAA,IAAgB,cAAc;AACzE,EAAE,MAAM,aAAA,GAAgB,kBAAkB,EAAE,aAAA,IAAiB,cAAc;AAC3E,EAA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,QAAQ,EAAE,IAAI;AACxB,UAAU,YAAY,EAAE,IAAI;AAC5B,UAAU,UAAU,EAAE,IAAI;AAC1B,SAAS,CAAC;AACV,MAAM;AACN,IAAI;AACJ,IAAI,OAAO,OAAO;AAClB,EAAE;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres.js","sources":["../../../../src/integrations/tracing/postgres.ts"],"sourcesContent":["import { PgInstrumentation } from '@opentelemetry/instrumentation-pg';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { addOriginToSpan, generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Postgres';\n\nexport const instrumentPostgres = generateInstrumentOnce(\n INTEGRATION_NAME,\n () =>\n new PgInstrumentation({\n requireParentSpan: true,\n requestHook(span) {\n addOriginToSpan(span, 'auto.db.otel.postgres');\n },\n }),\n);\n\nconst _postgresIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentPostgres();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [pg](https://www.npmjs.com/package/pg) library.\n *\n * For more information, see the [`postgresIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/postgres/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.postgresIntegration()],\n * });\n * ```\n */\nexport const postgresIntegration = defineIntegration(_postgresIntegration);\n"],"names":["generateInstrumentOnce","PgInstrumentation","addOriginToSpan","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,UAAU;;AAE5B,MAAM,kBAAA,GAAqBA,+BAAsB;AACxD,EAAE,gBAAgB;AAClB,EAAE;AACF,IAAI,IAAIC,mCAAiB,CAAC;AAC1B,MAAM,iBAAiB,EAAE,IAAI;AAC7B,MAAM,WAAW,CAAC,IAAI,EAAE;AACxB,QAAQC,wBAAe,CAAC,IAAI,EAAE,uBAAuB,CAAC;AACtD,
|
|
1
|
+
{"version":3,"file":"postgres.js","sources":["../../../../src/integrations/tracing/postgres.ts"],"sourcesContent":["import { PgInstrumentation } from '@opentelemetry/instrumentation-pg';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport { addOriginToSpan, generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'Postgres';\n\nexport const instrumentPostgres = generateInstrumentOnce(\n INTEGRATION_NAME,\n () =>\n new PgInstrumentation({\n requireParentSpan: true,\n requestHook(span) {\n addOriginToSpan(span, 'auto.db.otel.postgres');\n },\n }),\n);\n\nconst _postgresIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentPostgres();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [pg](https://www.npmjs.com/package/pg) library.\n *\n * For more information, see the [`postgresIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/postgres/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.postgresIntegration()],\n * });\n * ```\n */\nexport const postgresIntegration = defineIntegration(_postgresIntegration);\n"],"names":["generateInstrumentOnce","PgInstrumentation","addOriginToSpan","defineIntegration"],"mappings":";;;;;;AAKA,MAAM,gBAAA,GAAmB,UAAU;;AAE5B,MAAM,kBAAA,GAAqBA,+BAAsB;AACxD,EAAE,gBAAgB;AAClB,EAAE;AACF,IAAI,IAAIC,mCAAiB,CAAC;AAC1B,MAAM,iBAAiB,EAAE,IAAI;AAC7B,MAAM,WAAW,CAAC,IAAI,EAAE;AACxB,QAAQC,wBAAe,CAAC,IAAI,EAAE,uBAAuB,CAAC;AACtD,MAAM,CAAC;AACP,KAAK,CAAC;AACN;;AAEA,MAAM,oBAAA,IAAwB,MAAM;AACpC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,kBAAkB,EAAE;AAC1B,IAAI,CAAC;AACL,GAAG;AACH,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,mBAAA,GAAsBC,sBAAiB,CAAC,oBAAoB;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgresjs.js","sources":["../../../../src/integrations/tracing/postgresjs.ts"],"sourcesContent":["// Instrumentation for https://github.com/porsager/postgres\nimport { context, trace } from '@opentelemetry/api';\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport {\n InstrumentationBase,\n InstrumentationNodeModuleDefinition,\n InstrumentationNodeModuleFile,\n safeExecuteInTheMiddle,\n} from '@opentelemetry/instrumentation';\nimport {\n ATTR_DB_NAMESPACE,\n ATTR_DB_OPERATION_NAME,\n ATTR_DB_QUERY_TEXT,\n ATTR_DB_RESPONSE_STATUS_CODE,\n ATTR_DB_SYSTEM_NAME,\n ATTR_ERROR_TYPE,\n ATTR_SERVER_ADDRESS,\n ATTR_SERVER_PORT,\n} from '@opentelemetry/semantic-conventions';\nimport type { IntegrationFn, Span } from '@sentry/core';\nimport {\n debug,\n defineIntegration,\n getCurrentScope,\n SDK_VERSION,\n SPAN_STATUS_ERROR,\n startSpanManual,\n} from '@sentry/core';\nimport { addOriginToSpan, generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'PostgresJs';\nconst SUPPORTED_VERSIONS = ['>=3.0.0 <4'];\n\ntype PostgresConnectionContext = {\n ATTR_DB_NAMESPACE?: string; // Database name\n ATTR_SERVER_ADDRESS?: string; // Hostname or IP address of the database server\n ATTR_SERVER_PORT?: string; // Port number of the database server\n};\n\ntype PostgresJsInstrumentationConfig = InstrumentationConfig & {\n /**\n * Whether to require a parent span for the instrumentation.\n * If set to true, the instrumentation will only create spans if there is a parent span\n * available in the current scope.\n * @default true\n */\n requireParentSpan?: boolean;\n /**\n * Hook to modify the span before it is started.\n * This can be used to set additional attributes or modify the span in any way.\n */\n requestHook?: (span: Span, sanitizedSqlQuery: string, postgresConnectionContext?: PostgresConnectionContext) => void;\n};\n\nexport const instrumentPostgresJs = generateInstrumentOnce(\n INTEGRATION_NAME,\n (options?: PostgresJsInstrumentationConfig) =>\n new PostgresJsInstrumentation({\n requireParentSpan: options?.requireParentSpan ?? true,\n requestHook: options?.requestHook,\n }),\n);\n\n/**\n * Instrumentation for the [postgres](https://www.npmjs.com/package/postgres) library.\n * This instrumentation captures postgresjs queries and their attributes,\n */\nexport class PostgresJsInstrumentation extends InstrumentationBase<PostgresJsInstrumentationConfig> {\n public constructor(config: PostgresJsInstrumentationConfig) {\n super('sentry-postgres-js', SDK_VERSION, config);\n }\n\n /**\n * Initializes the instrumentation.\n */\n public init(): InstrumentationNodeModuleDefinition[] {\n const instrumentationModule = new InstrumentationNodeModuleDefinition('postgres', SUPPORTED_VERSIONS);\n\n ['src', 'cf/src', 'cjs/src'].forEach(path => {\n instrumentationModule.files.push(\n new InstrumentationNodeModuleFile(\n `postgres/${path}/connection.js`,\n ['*'],\n this._patchConnection.bind(this),\n this._unwrap.bind(this),\n ),\n );\n\n instrumentationModule.files.push(\n new InstrumentationNodeModuleFile(\n `postgres/${path}/query.js`,\n SUPPORTED_VERSIONS,\n this._patchQuery.bind(this),\n this._unwrap.bind(this),\n ),\n );\n });\n\n return [instrumentationModule];\n }\n\n /**\n * Determines whether a span should be created based on the current context.\n * If `requireParentSpan` is set to true in the configuration, a span will\n * only be created if there is a parent span available.\n */\n private _shouldCreateSpans(): boolean {\n const config = this.getConfig();\n const hasParentSpan = trace.getSpan(context.active()) !== undefined;\n return hasParentSpan || !config.requireParentSpan;\n }\n\n /**\n * Patches the reject method of the Query class to set the span status and end it\n */\n private _patchReject(rejectTarget: any, span: Span): any {\n return new Proxy(rejectTarget, {\n apply: (\n rejectTarget,\n rejectThisArg,\n rejectArgs: {\n message?: string;\n code?: string;\n name?: string;\n }[],\n ) => {\n span.setStatus({\n code: SPAN_STATUS_ERROR,\n // This message is the error message from the rejectArgs, when available\n // e.g \"relation 'User' does not exist\"\n message: rejectArgs?.[0]?.message || 'internal_error',\n });\n\n const result = Reflect.apply(rejectTarget, rejectThisArg, rejectArgs);\n\n // This status code is PG error code, e.g. '42P01' for \"relation does not exist\"\n // https://www.postgresql.org/docs/current/errcodes-appendix.html\n span.setAttribute(ATTR_DB_RESPONSE_STATUS_CODE, rejectArgs?.[0]?.code || 'Unknown error');\n // This is the error type, e.g. 'PostgresError' for a Postgres error\n span.setAttribute(ATTR_ERROR_TYPE, rejectArgs?.[0]?.name || 'Unknown error');\n\n span.end();\n return result;\n },\n });\n }\n\n /**\n * Patches the resolve method of the Query class to end the span when the query is resolved.\n */\n private _patchResolve(resolveTarget: any, span: Span): any {\n return new Proxy(resolveTarget, {\n apply: (resolveTarget, resolveThisArg, resolveArgs: [{ command?: string }]) => {\n const result = Reflect.apply(resolveTarget, resolveThisArg, resolveArgs);\n const sqlCommand = resolveArgs?.[0]?.command;\n\n if (sqlCommand) {\n // SQL command is only available when the query is resolved successfully\n span.setAttribute(ATTR_DB_OPERATION_NAME, sqlCommand);\n }\n span.end();\n return result;\n },\n });\n }\n\n /**\n * Patches the Query class to instrument the handle method.\n */\n private _patchQuery(moduleExports: {\n Query: {\n prototype: {\n handle: any;\n };\n };\n }): any {\n moduleExports.Query.prototype.handle = new Proxy(moduleExports.Query.prototype.handle, {\n apply: async (\n handleTarget,\n handleThisArg: {\n resolve: any;\n reject: any;\n strings?: string[];\n },\n handleArgs,\n ) => {\n if (!this._shouldCreateSpans()) {\n // If we don't need to create spans, just call the original method\n return Reflect.apply(handleTarget, handleThisArg, handleArgs);\n }\n\n const sanitizedSqlQuery = this._sanitizeSqlQuery(handleThisArg.strings?.[0]);\n\n return startSpanManual(\n {\n name: sanitizedSqlQuery || 'postgresjs.query',\n op: 'db',\n },\n (span: Span) => {\n const scope = getCurrentScope();\n const postgresConnectionContext = scope.getScopeData().contexts['postgresjsConnection'] as\n | PostgresConnectionContext\n | undefined;\n\n addOriginToSpan(span, 'auto.db.otel.postgres');\n\n const { requestHook } = this.getConfig();\n\n if (requestHook) {\n safeExecuteInTheMiddle(\n () => requestHook(span, sanitizedSqlQuery, postgresConnectionContext),\n error => {\n if (error) {\n debug.error(`Error in requestHook for ${INTEGRATION_NAME} integration:`, error);\n }\n },\n );\n }\n\n // ATTR_DB_NAMESPACE is used to indicate the database name and the schema name\n // It's only the database name as we don't have the schema information\n const databaseName = postgresConnectionContext?.ATTR_DB_NAMESPACE || '<unknown database>';\n const databaseHost = postgresConnectionContext?.ATTR_SERVER_ADDRESS || '<unknown host>';\n const databasePort = postgresConnectionContext?.ATTR_SERVER_PORT || '<unknown port>';\n\n span.setAttribute(ATTR_DB_SYSTEM_NAME, 'postgres');\n span.setAttribute(ATTR_DB_NAMESPACE, databaseName);\n span.setAttribute(ATTR_SERVER_ADDRESS, databaseHost);\n span.setAttribute(ATTR_SERVER_PORT, databasePort);\n span.setAttribute(ATTR_DB_QUERY_TEXT, sanitizedSqlQuery);\n\n handleThisArg.resolve = this._patchResolve(handleThisArg.resolve, span);\n handleThisArg.reject = this._patchReject(handleThisArg.reject, span);\n\n try {\n return Reflect.apply(handleTarget, handleThisArg, handleArgs);\n } catch (error) {\n span.setStatus({\n code: SPAN_STATUS_ERROR,\n });\n span.end();\n throw error; // Re-throw the error to propagate it\n }\n },\n );\n },\n });\n\n return moduleExports;\n }\n\n /**\n * Patches the Connection class to set the database, host, and port attributes\n * when a new connection is created.\n */\n private _patchConnection(Connection: any): any {\n return new Proxy(Connection, {\n apply: (connectionTarget, thisArg, connectionArgs: { database: string; host: string[]; port: number[] }[]) => {\n const databaseName = connectionArgs[0]?.database || '<unknown database>';\n const databaseHost = connectionArgs[0]?.host?.[0] || '<unknown host>';\n const databasePort = connectionArgs[0]?.port?.[0] || '<unknown port>';\n\n const scope = getCurrentScope();\n scope.setContext('postgresjsConnection', {\n ATTR_DB_NAMESPACE: databaseName,\n ATTR_SERVER_ADDRESS: databaseHost,\n ATTR_SERVER_PORT: databasePort,\n });\n\n return Reflect.apply(connectionTarget, thisArg, connectionArgs);\n },\n });\n }\n\n /**\n * Sanitize SQL query as per the OTEL semantic conventions\n * https://opentelemetry.io/docs/specs/semconv/database/database-spans/#sanitization-of-dbquerytext\n */\n private _sanitizeSqlQuery(sqlQuery: string | undefined): string {\n if (!sqlQuery) {\n return 'Unknown SQL Query';\n }\n\n return (\n sqlQuery\n .replace(/\\s+/g, ' ')\n .trim() // Remove extra spaces including newlines and trim\n .substring(0, 1024) // Truncate to 1024 characters\n .replace(/--.*?(\\r?\\n|$)/g, '') // Single line comments\n .replace(/\\/\\*[\\s\\S]*?\\*\\//g, '') // Multi-line comments\n .replace(/;\\s*$/, '') // Remove trailing semicolons\n .replace(/\\b\\d+\\b/g, '?') // Replace standalone numbers\n // Collapse whitespace to a single space\n .replace(/\\s+/g, ' ')\n // Collapse IN and in clauses\n // eg. IN (?, ?, ?, ?) to IN (?)\n .replace(/\\bIN\\b\\s*\\(\\s*\\?(?:\\s*,\\s*\\?)*\\s*\\)/g, 'IN (?)')\n );\n }\n}\n\nconst _postgresJsIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentPostgresJs();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [postgres](https://www.npmjs.com/package/postgres) library.\n *\n * For more information, see the [`postgresIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/postgres/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.postgresJsIntegration()],\n * });\n * ```\n */\n\nexport const postgresJsIntegration = defineIntegration(_postgresJsIntegration);\n"],"names":["generateInstrumentOnce","InstrumentationBase","SDK_VERSION","InstrumentationNodeModuleDefinition","InstrumentationNodeModuleFile","trace","context","SPAN_STATUS_ERROR","ATTR_DB_RESPONSE_STATUS_CODE","ATTR_ERROR_TYPE","ATTR_DB_OPERATION_NAME","startSpanManual","getCurrentScope","addOriginToSpan","safeExecuteInTheMiddle","debug","ATTR_DB_SYSTEM_NAME","ATTR_DB_NAMESPACE","ATTR_SERVER_ADDRESS","ATTR_SERVER_PORT","ATTR_DB_QUERY_TEXT","defineIntegration"],"mappings":";;;;;;;;AAAA;;AA8BA,MAAM,gBAAA,GAAmB,YAAY;AACrC,MAAM,kBAAA,GAAqB,CAAC,YAAY,CAAC;;AAuBlC,MAAM,oBAAA,GAAuBA,+BAAsB;AAC1D,EAAE,gBAAgB;AAClB,EAAE,CAAC,OAAO;AACV,IAAI,IAAI,yBAAyB,CAAC;AAClC,MAAM,iBAAiB,EAAE,OAAO,EAAE,iBAAA,IAAqB,IAAI;AAC3D,MAAM,WAAW,EAAE,OAAO,EAAE,WAAW;AACvC,KAAK,CAAC;AACN;;AAEA;AACA;AACA;AACA;AACO,MAAM,yBAAA,SAAkCC,mCAAmB,CAAkC;AACpG,GAAS,WAAW,CAAC,MAAM,EAAmC;AAC9D,IAAI,KAAK,CAAC,oBAAoB,EAAEC,gBAAW,EAAE,MAAM,CAAC;AACpD;;AAEA;AACA;AACA;AACA,GAAS,IAAI,GAA0C;AACvD,IAAI,MAAM,wBAAwB,IAAIC,mDAAmC,CAAC,UAAU,EAAE,kBAAkB,CAAC;;AAEzG,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,OAAO,CAAC,IAAA,IAAQ;AACjD,MAAM,qBAAqB,CAAC,KAAK,CAAC,IAAI;AACtC,QAAQ,IAAIC,6CAA6B;AACzC,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC;AAC1C,UAAU,CAAC,GAAG,CAAC;AACf,UAAU,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC;AAC1C,UAAU,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,SA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,EAAE,YAAY;AACzC,UAAU,mBAAmB,EAAE,YAAY;AAC3C,UAAU,gBAAgB,EAAE,YAAY;AACxC,SAAS,CAAC;;AAEV,QAAQ,OAAO,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,OAAO,EAAE,cAAc,CAAC;AACvE,OAAO;AACP,KAAK,CAAC;AACN;;AAEA;AACA;AACA;AACA;AACA,GAAU,iBAAiB,CAAC,QAAQ,EAA8B;AAClE,IAAI,IAAI,CAAC,QAAQ,EAAE;AACnB,MAAM,OAAO,mBAAmB;AAChC;;AAEA,IAAI;AACJ,MAAM;AACN,SAAS,OAAO,CAAC,MAAM,EAAE,GAAG;AAC5B,SAAS,IAAI,EAAC;AACd,SAAS,SAAS,CAAC,CAAC,EAAE,IAAI,CAAA;AAC1B,SAAS,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAA;AACtC,SAAS,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAA;AACxC,SAAS,OAAO,CAAC,OAAO,EAAE,EAAE,CAAA;AAC5B,SAAS,OAAO,CAAC,UAAU,EAAE,GAAG,CAAA;AAChC;AACA,SAAS,OAAO,CAAC,MAAM,EAAE,GAAG;AAC5B;AACA;AACA,SAAS,OAAO,CAAC,sCAAsC,EAAE,QAAQ;AACjE;AACA;AACA;;AAEA,MAAM,sBAAA,IAA0B,MAAM;AACtC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,oBAAoB,EAAE;AAC5B,KAAK;AACL,GAAG;AACH,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;MAEa,qBAAA,GAAwBS,sBAAiB,CAAC,sBAAsB;;;;;;"}
|
|
1
|
+
{"version":3,"file":"postgresjs.js","sources":["../../../../src/integrations/tracing/postgresjs.ts"],"sourcesContent":["// Instrumentation for https://github.com/porsager/postgres\nimport { context, trace } from '@opentelemetry/api';\nimport type { InstrumentationConfig } from '@opentelemetry/instrumentation';\nimport {\n InstrumentationBase,\n InstrumentationNodeModuleDefinition,\n InstrumentationNodeModuleFile,\n safeExecuteInTheMiddle,\n} from '@opentelemetry/instrumentation';\nimport {\n ATTR_DB_NAMESPACE,\n ATTR_DB_OPERATION_NAME,\n ATTR_DB_QUERY_TEXT,\n ATTR_DB_RESPONSE_STATUS_CODE,\n ATTR_DB_SYSTEM_NAME,\n ATTR_ERROR_TYPE,\n ATTR_SERVER_ADDRESS,\n ATTR_SERVER_PORT,\n} from '@opentelemetry/semantic-conventions';\nimport type { IntegrationFn, Span } from '@sentry/core';\nimport {\n debug,\n defineIntegration,\n getCurrentScope,\n SDK_VERSION,\n SPAN_STATUS_ERROR,\n startSpanManual,\n} from '@sentry/core';\nimport { addOriginToSpan, generateInstrumentOnce } from '@sentry/node-core';\n\nconst INTEGRATION_NAME = 'PostgresJs';\nconst SUPPORTED_VERSIONS = ['>=3.0.0 <4'];\n\ntype PostgresConnectionContext = {\n ATTR_DB_NAMESPACE?: string; // Database name\n ATTR_SERVER_ADDRESS?: string; // Hostname or IP address of the database server\n ATTR_SERVER_PORT?: string; // Port number of the database server\n};\n\ntype PostgresJsInstrumentationConfig = InstrumentationConfig & {\n /**\n * Whether to require a parent span for the instrumentation.\n * If set to true, the instrumentation will only create spans if there is a parent span\n * available in the current scope.\n * @default true\n */\n requireParentSpan?: boolean;\n /**\n * Hook to modify the span before it is started.\n * This can be used to set additional attributes or modify the span in any way.\n */\n requestHook?: (span: Span, sanitizedSqlQuery: string, postgresConnectionContext?: PostgresConnectionContext) => void;\n};\n\nexport const instrumentPostgresJs = generateInstrumentOnce(\n INTEGRATION_NAME,\n (options?: PostgresJsInstrumentationConfig) =>\n new PostgresJsInstrumentation({\n requireParentSpan: options?.requireParentSpan ?? true,\n requestHook: options?.requestHook,\n }),\n);\n\n/**\n * Instrumentation for the [postgres](https://www.npmjs.com/package/postgres) library.\n * This instrumentation captures postgresjs queries and their attributes,\n */\nexport class PostgresJsInstrumentation extends InstrumentationBase<PostgresJsInstrumentationConfig> {\n public constructor(config: PostgresJsInstrumentationConfig) {\n super('sentry-postgres-js', SDK_VERSION, config);\n }\n\n /**\n * Initializes the instrumentation.\n */\n public init(): InstrumentationNodeModuleDefinition[] {\n const instrumentationModule = new InstrumentationNodeModuleDefinition('postgres', SUPPORTED_VERSIONS);\n\n ['src', 'cf/src', 'cjs/src'].forEach(path => {\n instrumentationModule.files.push(\n new InstrumentationNodeModuleFile(\n `postgres/${path}/connection.js`,\n ['*'],\n this._patchConnection.bind(this),\n this._unwrap.bind(this),\n ),\n );\n\n instrumentationModule.files.push(\n new InstrumentationNodeModuleFile(\n `postgres/${path}/query.js`,\n SUPPORTED_VERSIONS,\n this._patchQuery.bind(this),\n this._unwrap.bind(this),\n ),\n );\n });\n\n return [instrumentationModule];\n }\n\n /**\n * Determines whether a span should be created based on the current context.\n * If `requireParentSpan` is set to true in the configuration, a span will\n * only be created if there is a parent span available.\n */\n private _shouldCreateSpans(): boolean {\n const config = this.getConfig();\n const hasParentSpan = trace.getSpan(context.active()) !== undefined;\n return hasParentSpan || !config.requireParentSpan;\n }\n\n /**\n * Patches the reject method of the Query class to set the span status and end it\n */\n private _patchReject(rejectTarget: any, span: Span): any {\n return new Proxy(rejectTarget, {\n apply: (\n rejectTarget,\n rejectThisArg,\n rejectArgs: {\n message?: string;\n code?: string;\n name?: string;\n }[],\n ) => {\n span.setStatus({\n code: SPAN_STATUS_ERROR,\n // This message is the error message from the rejectArgs, when available\n // e.g \"relation 'User' does not exist\"\n message: rejectArgs?.[0]?.message || 'internal_error',\n });\n\n const result = Reflect.apply(rejectTarget, rejectThisArg, rejectArgs);\n\n // This status code is PG error code, e.g. '42P01' for \"relation does not exist\"\n // https://www.postgresql.org/docs/current/errcodes-appendix.html\n span.setAttribute(ATTR_DB_RESPONSE_STATUS_CODE, rejectArgs?.[0]?.code || 'Unknown error');\n // This is the error type, e.g. 'PostgresError' for a Postgres error\n span.setAttribute(ATTR_ERROR_TYPE, rejectArgs?.[0]?.name || 'Unknown error');\n\n span.end();\n return result;\n },\n });\n }\n\n /**\n * Patches the resolve method of the Query class to end the span when the query is resolved.\n */\n private _patchResolve(resolveTarget: any, span: Span): any {\n return new Proxy(resolveTarget, {\n apply: (resolveTarget, resolveThisArg, resolveArgs: [{ command?: string }]) => {\n const result = Reflect.apply(resolveTarget, resolveThisArg, resolveArgs);\n const sqlCommand = resolveArgs?.[0]?.command;\n\n if (sqlCommand) {\n // SQL command is only available when the query is resolved successfully\n span.setAttribute(ATTR_DB_OPERATION_NAME, sqlCommand);\n }\n span.end();\n return result;\n },\n });\n }\n\n /**\n * Patches the Query class to instrument the handle method.\n */\n private _patchQuery(moduleExports: {\n Query: {\n prototype: {\n handle: any;\n };\n };\n }): any {\n moduleExports.Query.prototype.handle = new Proxy(moduleExports.Query.prototype.handle, {\n apply: async (\n handleTarget,\n handleThisArg: {\n resolve: any;\n reject: any;\n strings?: string[];\n },\n handleArgs,\n ) => {\n if (!this._shouldCreateSpans()) {\n // If we don't need to create spans, just call the original method\n return Reflect.apply(handleTarget, handleThisArg, handleArgs);\n }\n\n const sanitizedSqlQuery = this._sanitizeSqlQuery(handleThisArg.strings?.[0]);\n\n return startSpanManual(\n {\n name: sanitizedSqlQuery || 'postgresjs.query',\n op: 'db',\n },\n (span: Span) => {\n const scope = getCurrentScope();\n const postgresConnectionContext = scope.getScopeData().contexts['postgresjsConnection'] as\n | PostgresConnectionContext\n | undefined;\n\n addOriginToSpan(span, 'auto.db.otel.postgres');\n\n const { requestHook } = this.getConfig();\n\n if (requestHook) {\n safeExecuteInTheMiddle(\n () => requestHook(span, sanitizedSqlQuery, postgresConnectionContext),\n error => {\n if (error) {\n debug.error(`Error in requestHook for ${INTEGRATION_NAME} integration:`, error);\n }\n },\n );\n }\n\n // ATTR_DB_NAMESPACE is used to indicate the database name and the schema name\n // It's only the database name as we don't have the schema information\n const databaseName = postgresConnectionContext?.ATTR_DB_NAMESPACE || '<unknown database>';\n const databaseHost = postgresConnectionContext?.ATTR_SERVER_ADDRESS || '<unknown host>';\n const databasePort = postgresConnectionContext?.ATTR_SERVER_PORT || '<unknown port>';\n\n span.setAttribute(ATTR_DB_SYSTEM_NAME, 'postgres');\n span.setAttribute(ATTR_DB_NAMESPACE, databaseName);\n span.setAttribute(ATTR_SERVER_ADDRESS, databaseHost);\n span.setAttribute(ATTR_SERVER_PORT, databasePort);\n span.setAttribute(ATTR_DB_QUERY_TEXT, sanitizedSqlQuery);\n\n handleThisArg.resolve = this._patchResolve(handleThisArg.resolve, span);\n handleThisArg.reject = this._patchReject(handleThisArg.reject, span);\n\n try {\n return Reflect.apply(handleTarget, handleThisArg, handleArgs);\n } catch (error) {\n span.setStatus({\n code: SPAN_STATUS_ERROR,\n });\n span.end();\n throw error; // Re-throw the error to propagate it\n }\n },\n );\n },\n });\n\n return moduleExports;\n }\n\n /**\n * Patches the Connection class to set the database, host, and port attributes\n * when a new connection is created.\n */\n private _patchConnection(Connection: any): any {\n return new Proxy(Connection, {\n apply: (connectionTarget, thisArg, connectionArgs: { database: string; host: string[]; port: number[] }[]) => {\n const databaseName = connectionArgs[0]?.database || '<unknown database>';\n const databaseHost = connectionArgs[0]?.host?.[0] || '<unknown host>';\n const databasePort = connectionArgs[0]?.port?.[0] || '<unknown port>';\n\n const scope = getCurrentScope();\n scope.setContext('postgresjsConnection', {\n ATTR_DB_NAMESPACE: databaseName,\n ATTR_SERVER_ADDRESS: databaseHost,\n ATTR_SERVER_PORT: databasePort,\n });\n\n return Reflect.apply(connectionTarget, thisArg, connectionArgs);\n },\n });\n }\n\n /**\n * Sanitize SQL query as per the OTEL semantic conventions\n * https://opentelemetry.io/docs/specs/semconv/database/database-spans/#sanitization-of-dbquerytext\n */\n private _sanitizeSqlQuery(sqlQuery: string | undefined): string {\n if (!sqlQuery) {\n return 'Unknown SQL Query';\n }\n\n return (\n sqlQuery\n .replace(/\\s+/g, ' ')\n .trim() // Remove extra spaces including newlines and trim\n .substring(0, 1024) // Truncate to 1024 characters\n .replace(/--.*?(\\r?\\n|$)/g, '') // Single line comments\n .replace(/\\/\\*[\\s\\S]*?\\*\\//g, '') // Multi-line comments\n .replace(/;\\s*$/, '') // Remove trailing semicolons\n .replace(/\\b\\d+\\b/g, '?') // Replace standalone numbers\n // Collapse whitespace to a single space\n .replace(/\\s+/g, ' ')\n // Collapse IN and in clauses\n // eg. IN (?, ?, ?, ?) to IN (?)\n .replace(/\\bIN\\b\\s*\\(\\s*\\?(?:\\s*,\\s*\\?)*\\s*\\)/g, 'IN (?)')\n );\n }\n}\n\nconst _postgresJsIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentPostgresJs();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [postgres](https://www.npmjs.com/package/postgres) library.\n *\n * For more information, see the [`postgresIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/postgres/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.postgresJsIntegration()],\n * });\n * ```\n */\n\nexport const postgresJsIntegration = defineIntegration(_postgresJsIntegration);\n"],"names":["generateInstrumentOnce","InstrumentationBase","SDK_VERSION","InstrumentationNodeModuleDefinition","InstrumentationNodeModuleFile","trace","context","SPAN_STATUS_ERROR","ATTR_DB_RESPONSE_STATUS_CODE","ATTR_ERROR_TYPE","ATTR_DB_OPERATION_NAME","startSpanManual","getCurrentScope","addOriginToSpan","safeExecuteInTheMiddle","debug","ATTR_DB_SYSTEM_NAME","ATTR_DB_NAMESPACE","ATTR_SERVER_ADDRESS","ATTR_SERVER_PORT","ATTR_DB_QUERY_TEXT","defineIntegration"],"mappings":";;;;;;;;AAAA;;AA8BA,MAAM,gBAAA,GAAmB,YAAY;AACrC,MAAM,kBAAA,GAAqB,CAAC,YAAY,CAAC;;AAuBlC,MAAM,oBAAA,GAAuBA,+BAAsB;A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