@sentry/node 10.50.0-alpha.0 → 10.51.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 +7 -7
- package/build/cjs/integrations/{node-fetch.js → node-fetch/index.js} +3 -3
- package/build/cjs/integrations/node-fetch/index.js.map +1 -0
- package/build/cjs/integrations/node-fetch/vendored/undici.js +484 -0
- package/build/cjs/integrations/node-fetch/vendored/undici.js.map +1 -0
- package/build/cjs/integrations/tracing/langgraph/instrumentation.js +70 -25
- package/build/cjs/integrations/tracing/langgraph/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/prisma.js +6 -2
- package/build/cjs/integrations/tracing/prisma.js.map +1 -1
- package/build/cjs/sdk/index.js +2 -2
- package/build/cjs/sdk/index.js.map +1 -1
- package/build/esm/index.js +3 -3
- package/build/esm/integrations/{node-fetch.js → node-fetch/index.js} +2 -2
- package/build/esm/integrations/node-fetch/index.js.map +1 -0
- package/build/esm/integrations/node-fetch/vendored/undici.js +482 -0
- package/build/esm/integrations/node-fetch/vendored/undici.js.map +1 -0
- package/build/esm/integrations/tracing/langgraph/instrumentation.js +71 -26
- package/build/esm/integrations/tracing/langgraph/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/prisma.js +6 -2
- package/build/esm/integrations/tracing/prisma.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/sdk/index.js +1 -1
- package/build/types/index.d.ts +2 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/integrations/{node-fetch.d.ts → node-fetch/index.d.ts} +2 -2
- package/build/types/integrations/node-fetch/index.d.ts.map +1 -0
- package/build/types/integrations/node-fetch/vendored/internal-types.d.ts +25 -0
- package/build/types/integrations/node-fetch/vendored/internal-types.d.ts.map +1 -0
- package/build/types/integrations/node-fetch/vendored/types.d.ts +62 -0
- package/build/types/integrations/node-fetch/vendored/types.d.ts.map +1 -0
- package/build/types/integrations/node-fetch/vendored/undici.d.ts +22 -0
- package/build/types/integrations/node-fetch/vendored/undici.d.ts.map +1 -0
- package/build/types/integrations/tracing/langgraph/instrumentation.d.ts +1 -1
- package/build/types/integrations/tracing/langgraph/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/prisma.d.ts.map +1 -1
- package/build/types-ts3.8/index.d.ts +2 -2
- package/build/types-ts3.8/integrations/{node-fetch.d.ts → node-fetch/index.d.ts} +2 -2
- package/build/types-ts3.8/integrations/node-fetch/vendored/internal-types.d.ts +25 -0
- package/build/types-ts3.8/integrations/node-fetch/vendored/types.d.ts +62 -0
- package/build/types-ts3.8/integrations/node-fetch/vendored/undici.d.ts +22 -0
- package/build/types-ts3.8/integrations/tracing/langgraph/instrumentation.d.ts +1 -1
- package/package.json +4 -5
- package/build/cjs/integrations/node-fetch.js.map +0 -1
- package/build/esm/integrations/node-fetch.js.map +0 -1
- package/build/types/integrations/node-fetch.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sources":["../../../../../src/integrations/tracing/langgraph/instrumentation.ts"],"sourcesContent":["import {\n InstrumentationBase,\n type InstrumentationConfig,\n type InstrumentationModuleDefinition,\n InstrumentationNodeModuleDefinition,\n InstrumentationNodeModuleFile,\n} from '@opentelemetry/instrumentation';\nimport type { LangGraphOptions } from '@sentry/core';\nimport { instrumentLangGraph, 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
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sources":["../../../../../src/integrations/tracing/langgraph/instrumentation.ts"],"sourcesContent":["import {\n InstrumentationBase,\n type InstrumentationConfig,\n type InstrumentationModuleDefinition,\n InstrumentationNodeModuleDefinition,\n InstrumentationNodeModuleFile,\n} from '@opentelemetry/instrumentation';\nimport type { CompiledGraph, LangGraphOptions } from '@sentry/core';\nimport { getClient, instrumentCreateReactAgent, instrumentLangGraph, 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 createReactAgent?: (...args: unknown[]) => CompiledGraph;\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 return [\n 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 new InstrumentationNodeModuleFile(\n /**\n * In CJS, the prebuilt submodule re-exports from dist/prebuilt/index.cjs.\n * We add a file-level patch under the main module so that CJS require()\n * of @langchain/langgraph/prebuilt gets patched.\n */\n '@langchain/langgraph/dist/prebuilt/index.cjs',\n supportedVersions,\n this._patch.bind(this),\n exports => exports,\n ),\n ],\n ),\n new InstrumentationNodeModuleDefinition(\n '@langchain/langgraph/prebuilt',\n supportedVersions,\n this._patch.bind(this),\n exports => exports,\n [\n new InstrumentationNodeModuleFile(\n /**\n * In CJS, the prebuilt submodule re-exports from dist/prebuilt/index.cjs.\n * We add file-level patches so _patch runs on the concrete implementation.\n */\n '@langchain/langgraph/dist/prebuilt/index.cjs',\n supportedVersions,\n this._patch.bind(this),\n exports => exports,\n ),\n ],\n ),\n ];\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 options = {\n ...this.getConfig(),\n recordInputs: this.getConfig().recordInputs ?? client?.getOptions().sendDefaultPii,\n recordOutputs: this.getConfig().recordOutputs ?? client?.getOptions().sendDefaultPii,\n };\n\n // Patch StateGraph.compile to instrument both compile() and invoke()\n if (exports.StateGraph && typeof exports.StateGraph === 'function') {\n instrumentLangGraph(exports.StateGraph.prototype as { compile: (...args: unknown[]) => unknown }, options);\n }\n\n // Patch createReactAgent to instrument agent creation and invocation\n if (exports.createReactAgent && typeof exports.createReactAgent === 'function') {\n const originalCreateReactAgent = exports.createReactAgent;\n Object.defineProperty(exports, 'createReactAgent', {\n value: instrumentCreateReactAgent(originalCreateReactAgent as (...args: unknown[]) => CompiledGraph, options),\n writable: true,\n enumerable: true,\n configurable: true,\n });\n }\n\n return exports;\n }\n}\n"],"names":["exports"],"mappings":";;;AAUA,MAAM,iBAAA,GAAoB,CAAC,gBAAgB,CAAC;;AAa5C;AACA;AACA;AACO,MAAM,8BAAA,SAAuC,mBAAmB,CAAkC;AACzG,GAAS,WAAW,CAAC,MAAM,GAAoC,EAAE,EAAE;AACnE,IAAI,KAAK,CAAC,mCAAmC,EAAE,WAAW,EAAE,MAAM,CAAC;AACnE,EAAE;;AAE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S,EAAE;AACzB,MAAM,YAAY,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,YAAA,IAAgB,MAAM,EAAE,UAAU,EAAE,CAAC,cAAc;AACxF,MAAM,aAAa,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,aAAA,IAAiB,MAAM,EAAE,UAAU,EAAE,CAAC,cAAc;AAC1F,KAAK;;AAEL;AACA,IAAI,IAAIA,SAAO,CAAC,UAAA,IAAc,OAAOA,SAAO,CAAC,UAAA,KAAe,UAAU,EAAE;AACxE,MAAM,mBAAmB,CAACA,SAAO,CAAC,UAAU,CAAC,SAAA,GAA2D,OAAO,CAAC;AAChH,IAAI;;AAEJ;AACA,IAAI,IAAIA,SAAO,CAAC,gBAAA,IAAoB,OAAOA,SAAO,CAAC,gBAAA,KAAqB,UAAU,EAAE;AACpF,MAAM,MAAM,wBAAA,GAA2BA,SAAO,CAAC,gBAAgB;AAC/D,MAAM,MAAM,CAAC,cAAc,CAACA,SAAO,EAAE,kBAAkB,EAAE;AACzD,QAAQ,KAAK,EAAE,0BAA0B,CAAC,wBAAA,GAAmE,OAAO,CAAC;AACrH,QAAQ,QAAQ,EAAE,IAAI;AACtB,QAAQ,UAAU,EAAE,IAAI;AACxB,QAAQ,YAAY,EAAE,IAAI;AAC1B,OAAO,CAAC;AACR,IAAI;;AAEJ,IAAI,OAAOA,SAAO;AAClB,EAAE;AACF;;;;"}
|
|
@@ -181,8 +181,12 @@ const prismaIntegration = defineIntegration((options) => {
|
|
|
181
181
|
span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, 'auto.db.otel.prisma');
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
// Make sure we use the query text as the span name, for ex. SELECT * FROM "User" WHERE "id" = $1
|
|
185
|
-
|
|
184
|
+
// Make sure we use the query text as the span name, for ex. SELECT * FROM "User" WHERE "id" = $1.
|
|
185
|
+
// v5/v6 emit `prisma:engine:db_query`; v7 inlined the engine and emits `prisma:client:db_query`.
|
|
186
|
+
if (
|
|
187
|
+
(spanJSON.description === 'prisma:engine:db_query' || spanJSON.description === 'prisma:client:db_query') &&
|
|
188
|
+
spanJSON.data['db.query.text']
|
|
189
|
+
) {
|
|
186
190
|
span.updateName(spanJSON.data['db.query.text'] );
|
|
187
191
|
}
|
|
188
192
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prisma.js","sources":["../../../../src/integrations/tracing/prisma.ts"],"sourcesContent":["import type { Link, Tracer } from '@opentelemetry/api';\nimport { context, SpanKind, trace, TraceFlags } from '@opentelemetry/api';\nimport type { Instrumentation } from '@opentelemetry/instrumentation';\nimport type { IdGenerator } from '@opentelemetry/sdk-trace-base';\nimport { PrismaInstrumentation } from '@prisma/instrumentation';\nimport { consoleSandbox, defineIntegration, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\nimport type { PrismaV5TracingHelper } from './prisma/vendor/v5-tracing-helper';\nimport type { PrismaV6TracingHelper } from './prisma/vendor/v6-tracing-helper';\n\nconst INTEGRATION_NAME = 'Prisma';\n\ntype CompatibilityLayerTraceHelper = PrismaV5TracingHelper & PrismaV6TracingHelper;\n\n// Vendored in from @prisma/instrumentation v5:\ntype V5EngineSpanEvent = {\n span: boolean;\n spans: V5EngineSpan[];\n};\n\ntype V5EngineSpanKind = 'client' | 'internal';\n\ntype V5EngineSpan = {\n span: boolean;\n name: string;\n trace_id: string;\n span_id: string;\n parent_span_id: string;\n start_time: [number, number];\n end_time: [number, number];\n attributes?: Record<string, string>;\n links?: { trace_id: string; span_id: string }[];\n kind: V5EngineSpanKind;\n};\n\nfunction isPrismaV6TracingHelper(helper: unknown): helper is PrismaV6TracingHelper {\n return !!helper && typeof helper === 'object' && 'dispatchEngineSpans' in helper;\n}\n\nfunction getPrismaTracingHelper(): unknown | undefined {\n const prismaInstrumentationObject = (globalThis as Record<string, unknown>).PRISMA_INSTRUMENTATION;\n const prismaTracingHelper =\n prismaInstrumentationObject &&\n typeof prismaInstrumentationObject === 'object' &&\n 'helper' in prismaInstrumentationObject\n ? prismaInstrumentationObject.helper\n : undefined;\n\n return prismaTracingHelper;\n}\n\ntype TracerWithIdGenerator = Tracer & {\n _idGenerator?: IdGenerator;\n};\n\ninterface PrismaOptions {\n /**\n * @deprecated This is no longer used, v5 works out of the box.\n */\n prismaInstrumentation?: Instrumentation;\n /**\n * Configuration passed through to the {@link PrismaInstrumentation} constructor.\n */\n instrumentationConfig?: ConstructorParameters<typeof PrismaInstrumentation>[0];\n}\n\nclass SentryPrismaInteropInstrumentation extends PrismaInstrumentation {\n public constructor(options?: PrismaOptions) {\n super(options?.instrumentationConfig);\n }\n\n public enable(): void {\n super.enable();\n\n // The PrismaIntegration (super class) defines a global variable `global[\"PRISMA_INSTRUMENTATION\"]` when `enable()` is called. This global variable holds a \"TracingHelper\" which Prisma uses internally to create tracing data. It's their way of not depending on OTEL with their main package. The sucky thing is, prisma broke the interface of the tracing helper with the v6 major update. This means that if you use Prisma 5 with the v6 instrumentation (or vice versa) Prisma just blows up, because tries to call methods on the helper that no longer exist.\n // Because we actually want to use the v6 instrumentation and not blow up in Prisma 5 user's faces, what we're doing here is backfilling the v5 method (`createEngineSpan`) with a noop so that no longer crashes when it attempts to call that function.\n const prismaTracingHelper = getPrismaTracingHelper();\n\n if (isPrismaV6TracingHelper(prismaTracingHelper)) {\n // Inspired & adjusted from https://github.com/prisma/prisma/tree/5.22.0/packages/instrumentation\n (prismaTracingHelper as CompatibilityLayerTraceHelper).createEngineSpan = (\n engineSpanEvent: V5EngineSpanEvent,\n ) => {\n const tracer = trace.getTracer('prismaV5Compatibility') as TracerWithIdGenerator;\n\n // Prisma v5 relies on being able to create spans with a specific span & trace ID\n // this is no longer possible in OTEL v2, there is no public API to do this anymore\n // So in order to kind of hack this possibility, we rely on the internal `_idGenerator` property\n // This is used to generate the random IDs, and we overwrite this temporarily to generate static IDs\n // This is flawed and may not work, e.g. if the code is bundled and the private property is renamed\n // in such cases, these spans will not be captured and some Prisma spans will be missing\n const initialIdGenerator = tracer._idGenerator;\n\n if (!initialIdGenerator) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] Could not find _idGenerator on tracer, skipping Prisma v5 compatibility - some Prisma spans may be missing!',\n );\n });\n\n return;\n }\n\n try {\n engineSpanEvent.spans.forEach(engineSpan => {\n const kind = engineSpanKindToOTELSpanKind(engineSpan.kind);\n\n const parentSpanId = engineSpan.parent_span_id;\n const spanId = engineSpan.span_id;\n const traceId = engineSpan.trace_id;\n\n const links: Link[] | undefined = engineSpan.links?.map(link => {\n return {\n context: {\n traceId: link.trace_id,\n spanId: link.span_id,\n traceFlags: TraceFlags.SAMPLED,\n },\n };\n });\n\n const ctx = trace.setSpanContext(context.active(), {\n traceId,\n spanId: parentSpanId,\n traceFlags: TraceFlags.SAMPLED,\n });\n\n context.with(ctx, () => {\n const temporaryIdGenerator: IdGenerator = {\n generateTraceId: () => {\n return traceId;\n },\n generateSpanId: () => {\n return spanId;\n },\n };\n\n tracer._idGenerator = temporaryIdGenerator;\n\n const span = tracer.startSpan(engineSpan.name, {\n kind,\n links,\n startTime: engineSpan.start_time,\n attributes: engineSpan.attributes,\n });\n\n span.end(engineSpan.end_time);\n\n tracer._idGenerator = initialIdGenerator;\n });\n });\n } finally {\n // Ensure we always restore this at the end, even if something errors\n tracer._idGenerator = initialIdGenerator;\n }\n };\n }\n }\n}\n\nfunction engineSpanKindToOTELSpanKind(engineSpanKind: V5EngineSpanKind): SpanKind {\n switch (engineSpanKind) {\n case 'client':\n return SpanKind.CLIENT;\n case 'internal':\n default: // Other span kinds aren't currently supported\n return SpanKind.INTERNAL;\n }\n}\n\nexport const instrumentPrisma = generateInstrumentOnce<PrismaOptions>(INTEGRATION_NAME, options => {\n return new SentryPrismaInteropInstrumentation(options);\n});\n\n/**\n * Adds Sentry tracing instrumentation for the [prisma](https://www.npmjs.com/package/prisma) library.\n * For more information, see the [`prismaIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/prisma/).\n *\n * NOTE: By default, this integration works with Prisma version 6.\n * To get performance instrumentation for other Prisma versions,\n * 1. Install the `@prisma/instrumentation` package with the desired version.\n * 1. Pass a `new PrismaInstrumentation()` instance as exported from `@prisma/instrumentation` to the `prismaInstrumentation` option of this integration:\n *\n * ```js\n * import { PrismaInstrumentation } from '@prisma/instrumentation'\n *\n * Sentry.init({\n * integrations: [\n * prismaIntegration({\n * // Override the default instrumentation that Sentry uses\n * prismaInstrumentation: new PrismaInstrumentation()\n * })\n * ]\n * })\n * ```\n *\n * The passed instrumentation instance will override the default instrumentation instance the integration would use, while the `prismaIntegration` will still ensure data compatibility for the various Prisma versions.\n * 1. Depending on your Prisma version (prior to version 6), add `previewFeatures = [\"tracing\"]` to the client generator block of your Prisma schema:\n *\n * ```\n * generator client {\n * provider = \"prisma-client-js\"\n * previewFeatures = [\"tracing\"]\n * }\n * ```\n */\nexport const prismaIntegration = defineIntegration((options?: PrismaOptions) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentPrisma(options);\n },\n setup(client) {\n // If no tracing helper exists, we skip any work here\n // this means that prisma is not being used\n if (!getPrismaTracingHelper()) {\n return;\n }\n\n client.on('spanStart', span => {\n const spanJSON = spanToJSON(span);\n if (spanJSON.description?.startsWith('prisma:')) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, 'auto.db.otel.prisma');\n }\n\n // Make sure we use the query text as the span name, for ex. SELECT * FROM \"User\" WHERE \"id\" = $1\n if (spanJSON.description === 'prisma:engine:db_query' && spanJSON.data['db.query.text']) {\n span.updateName(spanJSON.data['db.query.text'] as string);\n }\n\n // In Prisma v5.22+, the `db.system` attribute is automatically set\n // On older versions, this is missing, so we add it here\n if (spanJSON.description === 'prisma:engine:db_query' && !spanJSON.data['db.system']) {\n span.setAttribute('db.system', 'prisma');\n }\n });\n },\n };\n});\n"],"names":[],"mapp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I,CAAC;AACzC,QAAQ,IAAI,QAAQ,CAAC,WAAW,EAAE,UAAU,CAAC,SAAS,CAAC,EAAE;AACzD,UAAU,IAAI,CAAC,YAAY,CAAC,gCAAgC,EAAE,qBAAqB,CAAC;AACpF,QAAQ;;AAER;AACA,QAAQ,IAAI,QAAQ,CAAC,gBAAgB,wBAAA,IAA4B,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE;AACjG,UAAU,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAA,EAAY;AACnE,QAAQ;;AAER;AACA;AACA,QAAQ,IAAI,QAAQ,CAAC,gBAAgB,wBAAA,IAA4B,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;AAC9F,UAAU,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,QAAQ,CAAC;AAClD,QAAQ;AACR,MAAM,CAAC,CAAC;AACR,IAAI,CAAC;AACL,GAAG;AACH,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"prisma.js","sources":["../../../../src/integrations/tracing/prisma.ts"],"sourcesContent":["import type { Link, Tracer } from '@opentelemetry/api';\nimport { context, SpanKind, trace, TraceFlags } from '@opentelemetry/api';\nimport type { Instrumentation } from '@opentelemetry/instrumentation';\nimport type { IdGenerator } from '@opentelemetry/sdk-trace-base';\nimport { PrismaInstrumentation } from '@prisma/instrumentation';\nimport { consoleSandbox, defineIntegration, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, spanToJSON } from '@sentry/core';\nimport { generateInstrumentOnce } from '@sentry/node-core';\nimport type { PrismaV5TracingHelper } from './prisma/vendor/v5-tracing-helper';\nimport type { PrismaV6TracingHelper } from './prisma/vendor/v6-tracing-helper';\n\nconst INTEGRATION_NAME = 'Prisma';\n\ntype CompatibilityLayerTraceHelper = PrismaV5TracingHelper & PrismaV6TracingHelper;\n\n// Vendored in from @prisma/instrumentation v5:\ntype V5EngineSpanEvent = {\n span: boolean;\n spans: V5EngineSpan[];\n};\n\ntype V5EngineSpanKind = 'client' | 'internal';\n\ntype V5EngineSpan = {\n span: boolean;\n name: string;\n trace_id: string;\n span_id: string;\n parent_span_id: string;\n start_time: [number, number];\n end_time: [number, number];\n attributes?: Record<string, string>;\n links?: { trace_id: string; span_id: string }[];\n kind: V5EngineSpanKind;\n};\n\nfunction isPrismaV6TracingHelper(helper: unknown): helper is PrismaV6TracingHelper {\n return !!helper && typeof helper === 'object' && 'dispatchEngineSpans' in helper;\n}\n\nfunction getPrismaTracingHelper(): unknown | undefined {\n const prismaInstrumentationObject = (globalThis as Record<string, unknown>).PRISMA_INSTRUMENTATION;\n const prismaTracingHelper =\n prismaInstrumentationObject &&\n typeof prismaInstrumentationObject === 'object' &&\n 'helper' in prismaInstrumentationObject\n ? prismaInstrumentationObject.helper\n : undefined;\n\n return prismaTracingHelper;\n}\n\ntype TracerWithIdGenerator = Tracer & {\n _idGenerator?: IdGenerator;\n};\n\ninterface PrismaOptions {\n /**\n * @deprecated This is no longer used, v5 works out of the box.\n */\n prismaInstrumentation?: Instrumentation;\n /**\n * Configuration passed through to the {@link PrismaInstrumentation} constructor.\n */\n instrumentationConfig?: ConstructorParameters<typeof PrismaInstrumentation>[0];\n}\n\nclass SentryPrismaInteropInstrumentation extends PrismaInstrumentation {\n public constructor(options?: PrismaOptions) {\n super(options?.instrumentationConfig);\n }\n\n public enable(): void {\n super.enable();\n\n // The PrismaIntegration (super class) defines a global variable `global[\"PRISMA_INSTRUMENTATION\"]` when `enable()` is called. This global variable holds a \"TracingHelper\" which Prisma uses internally to create tracing data. It's their way of not depending on OTEL with their main package. The sucky thing is, prisma broke the interface of the tracing helper with the v6 major update. This means that if you use Prisma 5 with the v6 instrumentation (or vice versa) Prisma just blows up, because tries to call methods on the helper that no longer exist.\n // Because we actually want to use the v6 instrumentation and not blow up in Prisma 5 user's faces, what we're doing here is backfilling the v5 method (`createEngineSpan`) with a noop so that no longer crashes when it attempts to call that function.\n const prismaTracingHelper = getPrismaTracingHelper();\n\n if (isPrismaV6TracingHelper(prismaTracingHelper)) {\n // Inspired & adjusted from https://github.com/prisma/prisma/tree/5.22.0/packages/instrumentation\n (prismaTracingHelper as CompatibilityLayerTraceHelper).createEngineSpan = (\n engineSpanEvent: V5EngineSpanEvent,\n ) => {\n const tracer = trace.getTracer('prismaV5Compatibility') as TracerWithIdGenerator;\n\n // Prisma v5 relies on being able to create spans with a specific span & trace ID\n // this is no longer possible in OTEL v2, there is no public API to do this anymore\n // So in order to kind of hack this possibility, we rely on the internal `_idGenerator` property\n // This is used to generate the random IDs, and we overwrite this temporarily to generate static IDs\n // This is flawed and may not work, e.g. if the code is bundled and the private property is renamed\n // in such cases, these spans will not be captured and some Prisma spans will be missing\n const initialIdGenerator = tracer._idGenerator;\n\n if (!initialIdGenerator) {\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] Could not find _idGenerator on tracer, skipping Prisma v5 compatibility - some Prisma spans may be missing!',\n );\n });\n\n return;\n }\n\n try {\n engineSpanEvent.spans.forEach(engineSpan => {\n const kind = engineSpanKindToOTELSpanKind(engineSpan.kind);\n\n const parentSpanId = engineSpan.parent_span_id;\n const spanId = engineSpan.span_id;\n const traceId = engineSpan.trace_id;\n\n const links: Link[] | undefined = engineSpan.links?.map(link => {\n return {\n context: {\n traceId: link.trace_id,\n spanId: link.span_id,\n traceFlags: TraceFlags.SAMPLED,\n },\n };\n });\n\n const ctx = trace.setSpanContext(context.active(), {\n traceId,\n spanId: parentSpanId,\n traceFlags: TraceFlags.SAMPLED,\n });\n\n context.with(ctx, () => {\n const temporaryIdGenerator: IdGenerator = {\n generateTraceId: () => {\n return traceId;\n },\n generateSpanId: () => {\n return spanId;\n },\n };\n\n tracer._idGenerator = temporaryIdGenerator;\n\n const span = tracer.startSpan(engineSpan.name, {\n kind,\n links,\n startTime: engineSpan.start_time,\n attributes: engineSpan.attributes,\n });\n\n span.end(engineSpan.end_time);\n\n tracer._idGenerator = initialIdGenerator;\n });\n });\n } finally {\n // Ensure we always restore this at the end, even if something errors\n tracer._idGenerator = initialIdGenerator;\n }\n };\n }\n }\n}\n\nfunction engineSpanKindToOTELSpanKind(engineSpanKind: V5EngineSpanKind): SpanKind {\n switch (engineSpanKind) {\n case 'client':\n return SpanKind.CLIENT;\n case 'internal':\n default: // Other span kinds aren't currently supported\n return SpanKind.INTERNAL;\n }\n}\n\nexport const instrumentPrisma = generateInstrumentOnce<PrismaOptions>(INTEGRATION_NAME, options => {\n return new SentryPrismaInteropInstrumentation(options);\n});\n\n/**\n * Adds Sentry tracing instrumentation for the [prisma](https://www.npmjs.com/package/prisma) library.\n * For more information, see the [`prismaIntegration` documentation](https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/prisma/).\n *\n * NOTE: By default, this integration works with Prisma version 6.\n * To get performance instrumentation for other Prisma versions,\n * 1. Install the `@prisma/instrumentation` package with the desired version.\n * 1. Pass a `new PrismaInstrumentation()` instance as exported from `@prisma/instrumentation` to the `prismaInstrumentation` option of this integration:\n *\n * ```js\n * import { PrismaInstrumentation } from '@prisma/instrumentation'\n *\n * Sentry.init({\n * integrations: [\n * prismaIntegration({\n * // Override the default instrumentation that Sentry uses\n * prismaInstrumentation: new PrismaInstrumentation()\n * })\n * ]\n * })\n * ```\n *\n * The passed instrumentation instance will override the default instrumentation instance the integration would use, while the `prismaIntegration` will still ensure data compatibility for the various Prisma versions.\n * 1. Depending on your Prisma version (prior to version 6), add `previewFeatures = [\"tracing\"]` to the client generator block of your Prisma schema:\n *\n * ```\n * generator client {\n * provider = \"prisma-client-js\"\n * previewFeatures = [\"tracing\"]\n * }\n * ```\n */\nexport const prismaIntegration = defineIntegration((options?: PrismaOptions) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentPrisma(options);\n },\n setup(client) {\n // If no tracing helper exists, we skip any work here\n // this means that prisma is not being used\n if (!getPrismaTracingHelper()) {\n return;\n }\n\n client.on('spanStart', span => {\n const spanJSON = spanToJSON(span);\n if (spanJSON.description?.startsWith('prisma:')) {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, 'auto.db.otel.prisma');\n }\n\n // Make sure we use the query text as the span name, for ex. SELECT * FROM \"User\" WHERE \"id\" = $1.\n // v5/v6 emit `prisma:engine:db_query`; v7 inlined the engine and emits `prisma:client:db_query`.\n if (\n (spanJSON.description === 'prisma:engine:db_query' || spanJSON.description === 'prisma:client:db_query') &&\n spanJSON.data['db.query.text']\n ) {\n span.updateName(spanJSON.data['db.query.text'] as string);\n }\n\n // In Prisma v5.22+, the `db.system` attribute is automatically set\n // On older versions, this is missing, so we add it here\n if (spanJSON.description === 'prisma:engine:db_query' && !spanJSON.data['db.system']) {\n span.setAttribute('db.system', 'prisma');\n }\n });\n },\n };\n});\n"],"names":[],"mappings":";;;;;AAUA,MAAM,gBAAA,GAAmB,QAAQ;;AAyBjC,SAAS,uBAAuB,CAAC,MAAM,EAA4C;AACnF,EAAE,OAAO,CAAC,CAAC,MAAA,IAAU,OAAO,MAAA,KAAW,QAAA,IAAY,qBAAA,IAAyB,MAAM;AAClF;;AAEA,SAAS,sBAAsB,GAAwB;AACvD,EAAE,MAAM,2BAAA,GAA8B,CAAC,UAAA,GAAuC,sBAAsB;AACpG,EAAE,MAAM,mBAAA;AACR,IAAI,2BAAA;AACJ,IAAI,OAAO,2BAAA,KAAgC,QAAA;AAC3C,IAAI,YAAY;AAChB,QAAQ,2BAA2B,CAAC;AACpC,QAAQ,SAAS;;AAEjB,EAAE,OAAO,mBAAmB;AAC5B;;AAiBA,MAAM,kCAAA,SAA2C,qBAAA,CAAsB;AACvE,GAAS,WAAW,CAAC,OAAO,EAAkB;AAC9C,IAAI,KAAK,CAAC,OAAO,EAAE,qBAAqB,CAAC;AACzC,EAAE;;AAEF,GAAS,MAAM,GAAS;AACxB,IAAI,KAAK,CAAC,MAAM,EAAE;;AAElB;AACA;AACA,IAAI,MAAM,mBAAA,GAAsB,sBAAsB,EAAE;;AAExD,IAAI,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-
{"type":"module","version":"10.
|
|
1
|
+
{"type":"module","version":"10.51.0","sideEffects":false}
|
package/build/esm/sdk/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { applySdkMetadata, hasSpansEnabled } from '@sentry/core';
|
|
2
2
|
import { init as init$1, validateOpenTelemetrySetup, getDefaultIntegrations as getDefaultIntegrations$1 } from '@sentry/node-core';
|
|
3
3
|
import { httpIntegration } from '../integrations/http.js';
|
|
4
|
-
import { nativeNodeFetchIntegration } from '../integrations/node-fetch.js';
|
|
4
|
+
import { nativeNodeFetchIntegration } from '../integrations/node-fetch/index.js';
|
|
5
5
|
import { getAutoPerformanceIntegrations } from '../integrations/tracing/index.js';
|
|
6
6
|
import { initOpenTelemetry } from './initOtel.js';
|
|
7
7
|
|
package/build/types/index.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export { initOpenTelemetry, preloadOpenTelemetry } from './sdk/initOtel';
|
|
|
36
36
|
export { getAutoPerformanceIntegrations } from './integrations/tracing';
|
|
37
37
|
export type { NodeOptions } from './types';
|
|
38
38
|
export { setOpenTelemetryContextAsyncContextStrategy as setNodeAsyncContextStrategy, } from '@sentry/opentelemetry';
|
|
39
|
-
export { addBreadcrumb, isInitialized, isEnabled, getGlobalScope, lastEventId, close, createTransport, flush, SDK_VERSION, getSpanStatusFromHttpCode, setHttpStatus, captureCheckIn, withMonitor, requestDataIntegration, functionToStringIntegration, inboundFiltersIntegration, eventFiltersIntegration, linkedErrorsIntegration, addEventProcessor, setContext, setExtra, setExtras, setTag, setTags, setUser, setConversationId, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, setCurrentClient, Scope, setMeasurement, getSpanDescendants, parameterize, getClient, getCurrentScope, getIsolationScope, getTraceData, getTraceMetaTags, httpHeadersToSpanAttributes, winterCGHeadersToDict, continueTrace, withScope, withIsolationScope, captureException, captureEvent, captureMessage, captureFeedback, captureConsoleIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, startSession, captureSession, endSession, addIntegration, startSpan, startSpanManual, startInactiveSpan, startNewTrace, suppressTracing, getActiveSpan, withActiveSpan, getRootSpan, spanToJSON, spanToTraceHeader, spanToBaggageHeader, trpcMiddleware, updateSpanName, supabaseIntegration, instrumentSupabaseClient, instrumentOpenAiClient, instrumentAnthropicAiClient, instrumentGoogleGenAIClient, zodErrorsIntegration, profiler, consoleLoggingIntegration, createConsolaReporter,
|
|
39
|
+
export { addBreadcrumb, isInitialized, isEnabled, getGlobalScope, lastEventId, close, createTransport, flush, SDK_VERSION, getSpanStatusFromHttpCode, setHttpStatus, captureCheckIn, withMonitor, requestDataIntegration, functionToStringIntegration, inboundFiltersIntegration, eventFiltersIntegration, linkedErrorsIntegration, addEventProcessor, setContext, setExtra, setExtras, setTag, setTags, setUser, setConversationId, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, setCurrentClient, Scope, setMeasurement, getSpanDescendants, parameterize, getClient, getCurrentScope, getIsolationScope, getTraceData, getTraceMetaTags, httpHeadersToSpanAttributes, winterCGHeadersToDict, continueTrace, withScope, withIsolationScope, captureException, captureEvent, captureMessage, captureFeedback, captureConsoleIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, startSession, captureSession, endSession, addIntegration, startSpan, startSpanManual, startInactiveSpan, startNewTrace, suppressTracing, getActiveSpan, withActiveSpan, getRootSpan, spanToJSON, spanToTraceHeader, spanToBaggageHeader, trpcMiddleware, updateSpanName, supabaseIntegration, instrumentSupabaseClient, instrumentOpenAiClient, instrumentAnthropicAiClient, instrumentGoogleGenAIClient, zodErrorsIntegration, profiler, consoleLoggingIntegration, createConsolaReporter, wrapMcpServerWithSentry, featureFlagsIntegration, spanStreamingIntegration, createLangChainCallbackHandler, instrumentLangChainEmbeddings, instrumentLangGraph, instrumentStateGraphCompile, } from '@sentry/core';
|
|
40
40
|
export type { Breadcrumb, BreadcrumbHint, PolymorphicRequest, RequestEventData, SdkInfo, Event, EventHint, ErrorEvent, Exception, Session, SeverityLevel, StackFrame, Stacktrace, Thread, User, Span, Metric, Log, LogSeverityLevel, FeatureFlagsIntegration, ExclusiveEventHintOrCaptureContext, CaptureContext, } from '@sentry/core';
|
|
41
|
-
export { logger, metrics, httpServerIntegration, httpServerSpansIntegration, nodeContextIntegration, contextLinesIntegration, localVariablesIntegration, modulesIntegration, onUncaughtExceptionIntegration, onUnhandledRejectionIntegration, anrIntegration, disableAnrDetectionForCallback, spotlightIntegration, childProcessIntegration, processSessionIntegration, nodeRuntimeMetricsIntegration, type NodeRuntimeMetricsOptions, pinoIntegration, createSentryWinstonTransport, SentryContextManager, systemErrorIntegration, generateInstrumentOnce, getSentryRelease, defaultStackParser, createGetModuleFromFilename, makeNodeTransport, NodeClient, cron, NODE_VERSION, validateOpenTelemetrySetup, withStreamedSpan, _INTERNAL_normalizeCollectionInterval, } from '@sentry/node-core';
|
|
41
|
+
export { logger, metrics, httpServerIntegration, httpServerSpansIntegration, nodeContextIntegration, contextLinesIntegration, localVariablesIntegration, modulesIntegration, onUncaughtExceptionIntegration, onUnhandledRejectionIntegration, anrIntegration, disableAnrDetectionForCallback, spotlightIntegration, childProcessIntegration, processSessionIntegration, nodeRuntimeMetricsIntegration, type NodeRuntimeMetricsOptions, consoleIntegration, pinoIntegration, createSentryWinstonTransport, SentryContextManager, systemErrorIntegration, generateInstrumentOnce, getSentryRelease, defaultStackParser, createGetModuleFromFilename, makeNodeTransport, NodeClient, cron, NODE_VERSION, validateOpenTelemetrySetup, withStreamedSpan, _INTERNAL_normalizeCollectionInterval, } from '@sentry/node-core';
|
|
42
42
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 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yB,EACzB,aAAa,EACb,cAAc,EACd,WAAW,EACX,sBAAsB,EACtB,2BAA2B,EAE3B,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,EACvB,iBAAiB,EACjB,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,OAAO,EACP,OAAO,EACP,iBAAiB,EACjB,4BAA4B,EAC5B,gCAAgC,EAChC,gCAAgC,EAChC,qCAAqC,EACrC,gBAAgB,EAChB,KAAK,EACL,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,2BAA2B,EAC3B,qBAAqB,EACrB,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,eAAe,EACf,yBAAyB,EACzB,iBAAiB,EACjB,yBAAyB,EACzB,wBAAwB,EACxB,YAAY,EACZ,cAAc,EACd,UAAU,EACV,cAAc,EACd,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,aAAa,EACb,cAAc,EACd,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC3B,oBAAoB,EACpB,QAAQ,EACR,yBAAyB,EACzB,qBAAqB,EACrB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AACnH,OAAO,EAAE,kBAAkB,EA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AAkB,EAClB,eAAe,EACf,4BAA4B,EAC5B,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,2BAA2B,EAC3B,iBAAiB,EACjB,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,0BAA0B,EAC1B,gBAAgB,EAChB,qCAAqC,GACtC,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UndiciInstrumentationConfig } from '
|
|
1
|
+
import type { UndiciInstrumentationConfig } from './vendored/types';
|
|
2
2
|
interface NodeFetchOptions extends Pick<UndiciInstrumentationConfig, 'requestHook' | 'responseHook' | 'headersToSpanAttributes'> {
|
|
3
3
|
/**
|
|
4
4
|
* Whether breadcrumbs should be recorded for requests.
|
|
@@ -33,4 +33,4 @@ export declare const nativeNodeFetchIntegration: (options?: NodeFetchOptions | u
|
|
|
33
33
|
/** Exported only for tests. */
|
|
34
34
|
export declare function _getConfigWithDefaults(options?: Partial<NodeFetchOptions>): UndiciInstrumentationConfig;
|
|
35
35
|
export {};
|
|
36
|
-
//# sourceMappingURL=
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/integrations/node-fetch/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAkBpE,UAAU,gBAAiB,SAAQ,IAAI,CACrC,2BAA2B,EAC3B,aAAa,GAAG,cAAc,GAAG,yBAAyB,CAC3D;IACC;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;;;;;;OAQG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;OAGG;IACH,sBAAsB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;CACnD;AAqCD,eAAO,MAAM,0BAA0B,gFAAiD,CAAC;AAyBzF,+BAA+B;AAC/B,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,OAAO,CAAC,gBAAgB,CAAM,GAAG,2BAA2B,CAkC3G"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { UndiciRequest, UndiciResponse } from './types';
|
|
2
|
+
export interface ListenerRecord {
|
|
3
|
+
name: string;
|
|
4
|
+
unsubscribe: () => void;
|
|
5
|
+
}
|
|
6
|
+
export interface RequestMessage {
|
|
7
|
+
request: UndiciRequest;
|
|
8
|
+
}
|
|
9
|
+
export interface RequestHeadersMessage {
|
|
10
|
+
request: UndiciRequest;
|
|
11
|
+
socket: any;
|
|
12
|
+
}
|
|
13
|
+
export interface ResponseHeadersMessage {
|
|
14
|
+
request: UndiciRequest;
|
|
15
|
+
response: UndiciResponse;
|
|
16
|
+
}
|
|
17
|
+
export interface RequestTrailersMessage {
|
|
18
|
+
request: UndiciRequest;
|
|
19
|
+
response: UndiciResponse;
|
|
20
|
+
}
|
|
21
|
+
export interface RequestErrorMessage {
|
|
22
|
+
request: UndiciRequest;
|
|
23
|
+
error: Error;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=internal-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal-types.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/node-fetch/vendored/internal-types.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE7D,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,aAAa,CAAC;CACxB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,aAAa,CAAC;IACvB,MAAM,EAAE,GAAG,CAAC;CACb;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,cAAc,CAAC;CAC1B;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,cAAc,CAAC;CAC1B;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,aAAa,CAAC;IACvB,KAAK,EAAE,KAAK,CAAC;CACd"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { InstrumentationConfig } from '@opentelemetry/instrumentation';
|
|
2
|
+
import type { Attributes, Span } from '@opentelemetry/api';
|
|
3
|
+
export interface UndiciRequest {
|
|
4
|
+
origin: string;
|
|
5
|
+
method: string;
|
|
6
|
+
path: string;
|
|
7
|
+
/**
|
|
8
|
+
* Serialized string of headers in the form `name: value\r\n` for v5
|
|
9
|
+
* Array of strings `[key1, value1, key2, value2]`, where values are
|
|
10
|
+
* `string | string[]` for v6
|
|
11
|
+
*/
|
|
12
|
+
headers: string | (string | string[])[];
|
|
13
|
+
/**
|
|
14
|
+
* Helper method to add headers (from v6)
|
|
15
|
+
*/
|
|
16
|
+
addHeader: (name: string, value: string) => void;
|
|
17
|
+
throwOnError: boolean;
|
|
18
|
+
completed: boolean;
|
|
19
|
+
aborted: boolean;
|
|
20
|
+
idempotent: boolean;
|
|
21
|
+
contentLength: number | null;
|
|
22
|
+
contentType: string | null;
|
|
23
|
+
body: any;
|
|
24
|
+
}
|
|
25
|
+
export interface UndiciResponse {
|
|
26
|
+
headers: Buffer[];
|
|
27
|
+
statusCode: number;
|
|
28
|
+
statusText: string;
|
|
29
|
+
}
|
|
30
|
+
export interface IgnoreRequestFunction<T = UndiciRequest> {
|
|
31
|
+
(request: T): boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface RequestHookFunction<T = UndiciRequest> {
|
|
34
|
+
(span: Span, request: T): void;
|
|
35
|
+
}
|
|
36
|
+
export interface ResponseHookFunction<RequestType = UndiciRequest, ResponseType = UndiciResponse> {
|
|
37
|
+
(span: Span, info: {
|
|
38
|
+
request: RequestType;
|
|
39
|
+
response: ResponseType;
|
|
40
|
+
}): void;
|
|
41
|
+
}
|
|
42
|
+
export interface StartSpanHookFunction<T = UndiciRequest> {
|
|
43
|
+
(request: T): Attributes;
|
|
44
|
+
}
|
|
45
|
+
export interface UndiciInstrumentationConfig<RequestType = UndiciRequest, ResponseType = UndiciResponse> extends InstrumentationConfig {
|
|
46
|
+
/** Not trace all outgoing requests that matched with custom function */
|
|
47
|
+
ignoreRequestHook?: IgnoreRequestFunction<RequestType>;
|
|
48
|
+
/** Function for adding custom attributes before request is handled */
|
|
49
|
+
requestHook?: RequestHookFunction<RequestType>;
|
|
50
|
+
/** Function called once response headers have been received */
|
|
51
|
+
responseHook?: ResponseHookFunction<RequestType, ResponseType>;
|
|
52
|
+
/** Function for adding custom attributes before a span is started */
|
|
53
|
+
startSpanHook?: StartSpanHookFunction<RequestType>;
|
|
54
|
+
/** Require parent to create span for outgoing requests */
|
|
55
|
+
requireParentforSpans?: boolean;
|
|
56
|
+
/** Map the following HTTP headers to span attributes. */
|
|
57
|
+
headersToSpanAttributes?: {
|
|
58
|
+
requestHeaders?: string[];
|
|
59
|
+
responseHeaders?: string[];
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/node-fetch/vendored/types.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE3D,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;I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qBAAqB,CAAC,WAAW,CAAC,CAAC;IACvD,sEAAsE;IACtE,WAAW,CAAC,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAC/C,+DAA+D;IAC/D,YAAY,CAAC,EAAE,oBAAoB,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IAC/D,qEAAqE;IACrE,aAAa,CAAC,EAAE,qBAAqB,CAAC,WAAW,CAAC,CAAC;IACnD,0DAA0D;IAC1D,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,yDAAyD;IACzD,uBAAuB,CAAC,EAAE;QACxB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;QAC1B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;KAC5B,CAAC;CACH"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { InstrumentationBase } from '@opentelemetry/instrumentation';
|
|
2
|
+
import type { UndiciInstrumentationConfig } from './types';
|
|
3
|
+
export declare class UndiciInstrumentation extends InstrumentationBase<UndiciInstrumentationConfig> {
|
|
4
|
+
private _channelSubs;
|
|
5
|
+
private _recordFromReq;
|
|
6
|
+
private _httpClientDurationHistogram;
|
|
7
|
+
constructor(config?: UndiciInstrumentationConfig);
|
|
8
|
+
protected init(): undefined;
|
|
9
|
+
disable(): void;
|
|
10
|
+
enable(): void;
|
|
11
|
+
protected _updateMetricInstruments(): void;
|
|
12
|
+
private subscribeToChannel;
|
|
13
|
+
private parseRequestHeaders;
|
|
14
|
+
private onRequestCreated;
|
|
15
|
+
private onRequestHeaders;
|
|
16
|
+
private onResponseHeaders;
|
|
17
|
+
private onDone;
|
|
18
|
+
private onError;
|
|
19
|
+
private recordRequestDuration;
|
|
20
|
+
private getRequestMethod;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=undici.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"undici.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/node-fetch/vendored/undici.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,mBAAmB,EAA0B,MAAM,gCAAgC,CAAC;AAoC7F,OAAO,KAAK,EAAE,2BAA2B,EAAiB,MAAM,SAAS,CAAC;AAc1E,qBAAa,qBAAsB,SAAQ,mBAAmB,CAAC,2BAA2B,CAAC;IAGzF,QAAgB,YAAY,CAAwB;IACpD,OAAO,CAAC,cAAc,CAAuD;IAE7E,QAAgB,4BAA4B,CAAY;gBAE5C,MAAM,GAAE,2BAAgC;cAKjC,IAAI;IAId,OAAO,IAAI,IAAI;IAMf,MAAM,IAAI,IAAI;cA4BJ,wBAAwB;IAW3C,OAAO,CAAC,kBAAkB;IAyB1B,OAAO,CAAC,mBAAmB;IA+C3B,OAAO,CAAC,gBAAgB;IAgIxB,OAAO,CAAC,gBAAgB;IAmCxB,OAAO,CAAC,iBAAiB;IAqDzB,OAAO,CAAC,MAAM;IAuBd,OAAO,CAAC,OAAO;IA4Bf,OAAO,CAAC,qBAAqB;IAuB7B,OAAO,CAAC,gBAAgB;CAqBzB"}
|
|
@@ -9,7 +9,7 @@ export declare class SentryLangGraphInstrumentation extends InstrumentationBase<
|
|
|
9
9
|
/**
|
|
10
10
|
* Initializes the instrumentation by defining the modules to be patched.
|
|
11
11
|
*/
|
|
12
|
-
init(): InstrumentationModuleDefinition;
|
|
12
|
+
init(): InstrumentationModuleDefinition[];
|
|
13
13
|
/**
|
|
14
14
|
* Core patch logic applying instrumentation to the LangGraph module.
|
|
15
15
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing/langgraph/instrumentation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,KAAK,qBAAqB,EAC1B,KAAK,+BAA+B,EAGrC,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing/langgraph/instrumentation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,KAAK,qBAAqB,EAC1B,KAAK,+BAA+B,EAGrC,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAiB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAKpE,KAAK,+BAA+B,GAAG,qBAAqB,GAAG,gBAAgB,CAAC;AAWhF;;GAEG;AACH,qBAAa,8BAA+B,SAAQ,mBAAmB,CAAC,+BAA+B,CAAC;gBACnF,MAAM,GAAE,+BAAoC;IAI/D;;OAEG;IACI,IAAI,IAAI,+BAA+B,EAAE;IAsDhD;;OAEG;IACH,OAAO,CAAC,MAAM;CA0Bf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prisma.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing/prisma.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAmDhE,UAAU,aAAa;IACrB;;OAEG;IACH,qBAAqB,CAAC,EAAE,eAAe,CAAC;IACxC;;OAEG;IACH,qBAAqB,CAAC,EAAE,qBAAqB,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC;CAChF;AA2GD,eAAO,MAAM,gBAAgB;;CAE3B,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"prisma.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing/prisma.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAmDhE,UAAU,aAAa;IACrB;;OAEG;IACH,qBAAqB,CAAC,EAAE,eAAe,CAAC;IACxC;;OAEG;IACH,qBAAqB,CAAC,EAAE,qBAAqB,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC;CAChF;AA2GD,eAAO,MAAM,gBAAgB;;CAE3B,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,iBAAiB,6EAoC5B,CAAC"}
|
|
@@ -36,7 +36,7 @@ export { initOpenTelemetry, preloadOpenTelemetry } from './sdk/initOtel';
|
|
|
36
36
|
export { getAutoPerformanceIntegrations } from './integrations/tracing';
|
|
37
37
|
export { NodeOptions } from './types';
|
|
38
38
|
export { setOpenTelemetryContextAsyncContextStrategy as setNodeAsyncContextStrategy, } from '@sentry/opentelemetry';
|
|
39
|
-
export { addBreadcrumb, isInitialized, isEnabled, getGlobalScope, lastEventId, close, createTransport, flush, SDK_VERSION, getSpanStatusFromHttpCode, setHttpStatus, captureCheckIn, withMonitor, requestDataIntegration, functionToStringIntegration, inboundFiltersIntegration, eventFiltersIntegration, linkedErrorsIntegration, addEventProcessor, setContext, setExtra, setExtras, setTag, setTags, setUser, setConversationId, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, setCurrentClient, Scope, setMeasurement, getSpanDescendants, parameterize, getClient, getCurrentScope, getIsolationScope, getTraceData, getTraceMetaTags, httpHeadersToSpanAttributes, winterCGHeadersToDict, continueTrace, withScope, withIsolationScope, captureException, captureEvent, captureMessage, captureFeedback, captureConsoleIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, startSession, captureSession, endSession, addIntegration, startSpan, startSpanManual, startInactiveSpan, startNewTrace, suppressTracing, getActiveSpan, withActiveSpan, getRootSpan, spanToJSON, spanToTraceHeader, spanToBaggageHeader, trpcMiddleware, updateSpanName, supabaseIntegration, instrumentSupabaseClient, instrumentOpenAiClient, instrumentAnthropicAiClient, instrumentGoogleGenAIClient, zodErrorsIntegration, profiler, consoleLoggingIntegration, createConsolaReporter,
|
|
39
|
+
export { addBreadcrumb, isInitialized, isEnabled, getGlobalScope, lastEventId, close, createTransport, flush, SDK_VERSION, getSpanStatusFromHttpCode, setHttpStatus, captureCheckIn, withMonitor, requestDataIntegration, functionToStringIntegration, inboundFiltersIntegration, eventFiltersIntegration, linkedErrorsIntegration, addEventProcessor, setContext, setExtra, setExtras, setTag, setTags, setUser, setConversationId, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE, setCurrentClient, Scope, setMeasurement, getSpanDescendants, parameterize, getClient, getCurrentScope, getIsolationScope, getTraceData, getTraceMetaTags, httpHeadersToSpanAttributes, winterCGHeadersToDict, continueTrace, withScope, withIsolationScope, captureException, captureEvent, captureMessage, captureFeedback, captureConsoleIntegration, dedupeIntegration, extraErrorDataIntegration, rewriteFramesIntegration, startSession, captureSession, endSession, addIntegration, startSpan, startSpanManual, startInactiveSpan, startNewTrace, suppressTracing, getActiveSpan, withActiveSpan, getRootSpan, spanToJSON, spanToTraceHeader, spanToBaggageHeader, trpcMiddleware, updateSpanName, supabaseIntegration, instrumentSupabaseClient, instrumentOpenAiClient, instrumentAnthropicAiClient, instrumentGoogleGenAIClient, zodErrorsIntegration, profiler, consoleLoggingIntegration, createConsolaReporter, wrapMcpServerWithSentry, featureFlagsIntegration, spanStreamingIntegration, createLangChainCallbackHandler, instrumentLangChainEmbeddings, instrumentLangGraph, instrumentStateGraphCompile, } from '@sentry/core';
|
|
40
40
|
export { Breadcrumb, BreadcrumbHint, PolymorphicRequest, RequestEventData, SdkInfo, Event, EventHint, ErrorEvent, Exception, Session, SeverityLevel, StackFrame, Stacktrace, Thread, User, Span, Metric, Log, LogSeverityLevel, FeatureFlagsIntegration, ExclusiveEventHintOrCaptureContext, CaptureContext, } from '@sentry/core';
|
|
41
|
-
export { logger, metrics, httpServerIntegration, httpServerSpansIntegration, nodeContextIntegration, contextLinesIntegration, localVariablesIntegration, modulesIntegration, onUncaughtExceptionIntegration, onUnhandledRejectionIntegration, anrIntegration, disableAnrDetectionForCallback, spotlightIntegration, childProcessIntegration, processSessionIntegration, nodeRuntimeMetricsIntegration, NodeRuntimeMetricsOptions, pinoIntegration, createSentryWinstonTransport, SentryContextManager, systemErrorIntegration, generateInstrumentOnce, getSentryRelease, defaultStackParser, createGetModuleFromFilename, makeNodeTransport, NodeClient, cron, NODE_VERSION, validateOpenTelemetrySetup, withStreamedSpan, _INTERNAL_normalizeCollectionInterval } from '@sentry/node-core';
|
|
41
|
+
export { logger, metrics, httpServerIntegration, httpServerSpansIntegration, nodeContextIntegration, contextLinesIntegration, localVariablesIntegration, modulesIntegration, onUncaughtExceptionIntegration, onUnhandledRejectionIntegration, anrIntegration, disableAnrDetectionForCallback, spotlightIntegration, childProcessIntegration, processSessionIntegration, nodeRuntimeMetricsIntegration, NodeRuntimeMetricsOptions, consoleIntegration, pinoIntegration, createSentryWinstonTransport, SentryContextManager, systemErrorIntegration, generateInstrumentOnce, getSentryRelease, defaultStackParser, createGetModuleFromFilename, makeNodeTransport, NodeClient, cron, NODE_VERSION, validateOpenTelemetrySetup, withStreamedSpan, _INTERNAL_normalizeCollectionInterval } from '@sentry/node-core';
|
|
42
42
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UndiciInstrumentationConfig } from '
|
|
1
|
+
import { UndiciInstrumentationConfig } from './vendored/types';
|
|
2
2
|
interface NodeFetchOptions extends Pick<UndiciInstrumentationConfig, 'requestHook' | 'responseHook' | 'headersToSpanAttributes'> {
|
|
3
3
|
/**
|
|
4
4
|
* Whether breadcrumbs should be recorded for requests.
|
|
@@ -33,4 +33,4 @@ export declare const nativeNodeFetchIntegration: (options?: NodeFetchOptions | u
|
|
|
33
33
|
/** Exported only for tests. */
|
|
34
34
|
export declare function _getConfigWithDefaults(options?: Partial<NodeFetchOptions>): UndiciInstrumentationConfig;
|
|
35
35
|
export {};
|
|
36
|
-
//# sourceMappingURL=
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { UndiciRequest, UndiciResponse } from './types';
|
|
2
|
+
export interface ListenerRecord {
|
|
3
|
+
name: string;
|
|
4
|
+
unsubscribe: () => void;
|
|
5
|
+
}
|
|
6
|
+
export interface RequestMessage {
|
|
7
|
+
request: UndiciRequest;
|
|
8
|
+
}
|
|
9
|
+
export interface RequestHeadersMessage {
|
|
10
|
+
request: UndiciRequest;
|
|
11
|
+
socket: any;
|
|
12
|
+
}
|
|
13
|
+
export interface ResponseHeadersMessage {
|
|
14
|
+
request: UndiciRequest;
|
|
15
|
+
response: UndiciResponse;
|
|
16
|
+
}
|
|
17
|
+
export interface RequestTrailersMessage {
|
|
18
|
+
request: UndiciRequest;
|
|
19
|
+
response: UndiciResponse;
|
|
20
|
+
}
|
|
21
|
+
export interface RequestErrorMessage {
|
|
22
|
+
request: UndiciRequest;
|
|
23
|
+
error: Error;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=internal-types.d.ts.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { InstrumentationConfig } from '@opentelemetry/instrumentation';
|
|
2
|
+
import { Attributes, Span } from '@opentelemetry/api';
|
|
3
|
+
export interface UndiciRequest {
|
|
4
|
+
origin: string;
|
|
5
|
+
method: string;
|
|
6
|
+
path: string;
|
|
7
|
+
/**
|
|
8
|
+
* Serialized string of headers in the form `name: value\r\n` for v5
|
|
9
|
+
* Array of strings `[key1, value1, key2, value2]`, where values are
|
|
10
|
+
* `string | string[]` for v6
|
|
11
|
+
*/
|
|
12
|
+
headers: string | (string | string[])[];
|
|
13
|
+
/**
|
|
14
|
+
* Helper method to add headers (from v6)
|
|
15
|
+
*/
|
|
16
|
+
addHeader: (name: string, value: string) => void;
|
|
17
|
+
throwOnError: boolean;
|
|
18
|
+
completed: boolean;
|
|
19
|
+
aborted: boolean;
|
|
20
|
+
idempotent: boolean;
|
|
21
|
+
contentLength: number | null;
|
|
22
|
+
contentType: string | null;
|
|
23
|
+
body: any;
|
|
24
|
+
}
|
|
25
|
+
export interface UndiciResponse {
|
|
26
|
+
headers: Buffer[];
|
|
27
|
+
statusCode: number;
|
|
28
|
+
statusText: string;
|
|
29
|
+
}
|
|
30
|
+
export interface IgnoreRequestFunction<T = UndiciRequest> {
|
|
31
|
+
(request: T): boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface RequestHookFunction<T = UndiciRequest> {
|
|
34
|
+
(span: Span, request: T): void;
|
|
35
|
+
}
|
|
36
|
+
export interface ResponseHookFunction<RequestType = UndiciRequest, ResponseType = UndiciResponse> {
|
|
37
|
+
(span: Span, info: {
|
|
38
|
+
request: RequestType;
|
|
39
|
+
response: ResponseType;
|
|
40
|
+
}): void;
|
|
41
|
+
}
|
|
42
|
+
export interface StartSpanHookFunction<T = UndiciRequest> {
|
|
43
|
+
(request: T): Attributes;
|
|
44
|
+
}
|
|
45
|
+
export interface UndiciInstrumentationConfig<RequestType = UndiciRequest, ResponseType = UndiciResponse> extends InstrumentationConfig {
|
|
46
|
+
/** Not trace all outgoing requests that matched with custom function */
|
|
47
|
+
ignoreRequestHook?: IgnoreRequestFunction<RequestType>;
|
|
48
|
+
/** Function for adding custom attributes before request is handled */
|
|
49
|
+
requestHook?: RequestHookFunction<RequestType>;
|
|
50
|
+
/** Function called once response headers have been received */
|
|
51
|
+
responseHook?: ResponseHookFunction<RequestType, ResponseType>;
|
|
52
|
+
/** Function for adding custom attributes before a span is started */
|
|
53
|
+
startSpanHook?: StartSpanHookFunction<RequestType>;
|
|
54
|
+
/** Require parent to create span for outgoing requests */
|
|
55
|
+
requireParentforSpans?: boolean;
|
|
56
|
+
/** Map the following HTTP headers to span attributes. */
|
|
57
|
+
headersToSpanAttributes?: {
|
|
58
|
+
requestHeaders?: string[];
|
|
59
|
+
responseHeaders?: string[];
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { InstrumentationBase } from '@opentelemetry/instrumentation';
|
|
2
|
+
import { UndiciInstrumentationConfig } from './types';
|
|
3
|
+
export declare class UndiciInstrumentation extends InstrumentationBase<UndiciInstrumentationConfig> {
|
|
4
|
+
private _channelSubs;
|
|
5
|
+
private _recordFromReq;
|
|
6
|
+
private _httpClientDurationHistogram;
|
|
7
|
+
constructor(config?: UndiciInstrumentationConfig);
|
|
8
|
+
protected init(): undefined;
|
|
9
|
+
disable(): void;
|
|
10
|
+
enable(): void;
|
|
11
|
+
protected _updateMetricInstruments(): void;
|
|
12
|
+
private subscribeToChannel;
|
|
13
|
+
private parseRequestHeaders;
|
|
14
|
+
private onRequestCreated;
|
|
15
|
+
private onRequestHeaders;
|
|
16
|
+
private onResponseHeaders;
|
|
17
|
+
private onDone;
|
|
18
|
+
private onError;
|
|
19
|
+
private recordRequestDuration;
|
|
20
|
+
private getRequestMethod;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=undici.d.ts.map
|
|
@@ -9,7 +9,7 @@ export declare class SentryLangGraphInstrumentation extends InstrumentationBase<
|
|
|
9
9
|
/**
|
|
10
10
|
* Initializes the instrumentation by defining the modules to be patched.
|
|
11
11
|
*/
|
|
12
|
-
init(): InstrumentationModuleDefinition;
|
|
12
|
+
init(): InstrumentationModuleDefinition[];
|
|
13
13
|
/**
|
|
14
14
|
* Core patch logic applying instrumentation to the LangGraph module.
|
|
15
15
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/node",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.51.0",
|
|
4
4
|
"description": "Sentry Node SDK using OpenTelemetry for performance instrumentation",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/node",
|
|
@@ -88,14 +88,13 @@
|
|
|
88
88
|
"@opentelemetry/instrumentation-pg": "0.66.0",
|
|
89
89
|
"@opentelemetry/instrumentation-redis": "0.62.0",
|
|
90
90
|
"@opentelemetry/instrumentation-tedious": "0.33.0",
|
|
91
|
-
"@opentelemetry/instrumentation-undici": "0.24.0",
|
|
92
91
|
"@opentelemetry/sdk-trace-base": "^2.6.1",
|
|
93
92
|
"@opentelemetry/semantic-conventions": "^1.40.0",
|
|
94
93
|
"@prisma/instrumentation": "7.6.0",
|
|
95
94
|
"@fastify/otel": "0.18.0",
|
|
96
|
-
"@sentry/core": "10.
|
|
97
|
-
"@sentry/node-core": "10.
|
|
98
|
-
"@sentry/opentelemetry": "10.
|
|
95
|
+
"@sentry/core": "10.51.0",
|
|
96
|
+
"@sentry/node-core": "10.51.0",
|
|
97
|
+
"@sentry/opentelemetry": "10.51.0",
|
|
99
98
|
"import-in-the-middle": "^3.0.0"
|
|
100
99
|
},
|
|
101
100
|
"devDependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"node-fetch.js","sources":["../../../src/integrations/node-fetch.ts"],"sourcesContent":["import type { UndiciInstrumentationConfig } from '@opentelemetry/instrumentation-undici';\nimport { UndiciInstrumentation } from '@opentelemetry/instrumentation-undici';\nimport type { IntegrationFn } from '@sentry/core';\nimport {\n defineIntegration,\n getClient,\n hasSpansEnabled,\n SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_URL_FULL,\n stripDataUrlContent,\n} from '@sentry/core';\nimport type { NodeClient } from '@sentry/node-core';\nimport { generateInstrumentOnce, SentryNodeFetchInstrumentation } from '@sentry/node-core';\nimport type { NodeClientOptions } from '../types';\n\nconst INTEGRATION_NAME = 'NodeFetch';\n\ninterface NodeFetchOptions extends Pick<\n UndiciInstrumentationConfig,\n 'requestHook' | 'responseHook' | 'headersToSpanAttributes'\n> {\n /**\n * Whether breadcrumbs should be recorded for requests.\n * Defaults to true\n */\n breadcrumbs?: boolean;\n\n /**\n * If set to false, do not emit any spans.\n * This will ensure that the default UndiciInstrumentation from OpenTelemetry is not setup,\n * only the Sentry-specific instrumentation for breadcrumbs & trace propagation is applied.\n *\n * If `skipOpenTelemetrySetup: true` is configured, this defaults to `false`, otherwise it defaults to `true`.\n */\n spans?: boolean;\n\n /**\n * Whether to inject trace propagation headers (sentry-trace, baggage, traceparent) into outgoing fetch requests.\n *\n * When set to `false`, Sentry will not inject any trace propagation headers, but will still create breadcrumbs\n * (if `breadcrumbs` is enabled). This is useful when `skipOpenTelemetrySetup: true` is configured and you want\n * to avoid duplicate trace headers being injected by both Sentry and OpenTelemetry's UndiciInstrumentation.\n *\n * @default `true`\n */\n tracePropagation?: boolean;\n\n /**\n * Do not capture spans or breadcrumbs for outgoing fetch requests to URLs where the given callback returns `true`.\n * This controls both span & breadcrumb creation - spans will be non recording if tracing is disabled.\n */\n ignoreOutgoingRequests?: (url: string) => boolean;\n}\n\nconst instrumentOtelNodeFetch = generateInstrumentOnce(\n INTEGRATION_NAME,\n UndiciInstrumentation,\n (options: NodeFetchOptions) => {\n return _getConfigWithDefaults(options);\n },\n);\n\nconst instrumentSentryNodeFetch = generateInstrumentOnce(\n `${INTEGRATION_NAME}.sentry`,\n SentryNodeFetchInstrumentation,\n (options: NodeFetchOptions) => {\n return options;\n },\n);\n\nconst _nativeNodeFetchIntegration = ((options: NodeFetchOptions = {}) => {\n return {\n name: 'NodeFetch',\n setupOnce() {\n const instrumentSpans = _shouldInstrumentSpans(options, getClient<NodeClient>()?.getOptions());\n\n // This is the \"regular\" OTEL instrumentation that emits spans\n if (instrumentSpans) {\n instrumentOtelNodeFetch(options);\n }\n\n // This is the Sentry-specific instrumentation that creates breadcrumbs & propagates traces\n // This must be registered after the OTEL one, to ensure that the core trace propagation logic takes presedence\n // Otherwise, the sentry-trace header may be set multiple times\n instrumentSentryNodeFetch(options);\n },\n };\n}) satisfies IntegrationFn;\n\nexport const nativeNodeFetchIntegration = defineIntegration(_nativeNodeFetchIntegration);\n\n// Matching the behavior of the base instrumentation\nfunction getAbsoluteUrl(origin: string, path: string = '/'): string {\n const url = `${origin}`;\n\n if (url.endsWith('/') && path.startsWith('/')) {\n return `${url}${path.slice(1)}`;\n }\n\n if (!url.endsWith('/') && !path.startsWith('/')) {\n return `${url}/${path}`;\n }\n\n return `${url}${path}`;\n}\n\nfunction _shouldInstrumentSpans(options: NodeFetchOptions, clientOptions: Partial<NodeClientOptions> = {}): boolean {\n // If `spans` is passed in, it takes precedence\n // Else, we by default emit spans, unless `skipOpenTelemetrySetup` is set to `true` or spans are not enabled\n return typeof options.spans === 'boolean'\n ? options.spans\n : !clientOptions.skipOpenTelemetrySetup && hasSpansEnabled(clientOptions);\n}\n\n/** Exported only for tests. */\nexport function _getConfigWithDefaults(options: Partial<NodeFetchOptions> = {}): UndiciInstrumentationConfig {\n const instrumentationConfig = {\n requireParentforSpans: false,\n ignoreRequestHook: request => {\n const url = getAbsoluteUrl(request.origin, request.path);\n const _ignoreOutgoingRequests = options.ignoreOutgoingRequests;\n const shouldIgnore = _ignoreOutgoingRequests && url && _ignoreOutgoingRequests(url);\n\n return !!shouldIgnore;\n },\n startSpanHook: request => {\n const url = getAbsoluteUrl(request.origin, request.path);\n\n // Sanitize data URLs to prevent long base64 strings in span attributes\n if (url.startsWith('data:')) {\n const sanitizedUrl = stripDataUrlContent(url);\n return {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.otel.node_fetch',\n 'http.url': sanitizedUrl,\n [SEMANTIC_ATTRIBUTE_URL_FULL]: sanitizedUrl,\n [SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME]: `${request.method || 'GET'} ${sanitizedUrl}`,\n };\n }\n\n return {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.otel.node_fetch',\n };\n },\n requestHook: options.requestHook,\n responseHook: options.responseHook,\n headersToSpanAttributes: options.headersToSpanAttributes,\n } satisfies UndiciInstrumentationConfig;\n\n return instrumentationConfig;\n}\n"],"names":["generateInstrumentOnce","UndiciInstrumentation","SentryNodeFetchInstrumentation","getClient","defineIntegration","hasSpansEnabled","stripDataUrlContent","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","SEMANTIC_ATTRIBUTE_URL_FULL","SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME"],"mappings":";;;;;;AAgBA,MAAM,gBAAA,GAAmB,WAAW;;AAuCpC,MAAM,uBAAA,GAA0BA,+BAAsB;AACtD,EAAE,gBAAgB;AAClB,EAAEC,2CAAqB;AACvB,EAAE,CAAC,OAAO,KAAuB;AACjC,IAAI,OAAO,sBAAsB,CAAC,OAAO,CAAC;AAC1C,EAAE,CAAC;AACH,CAAC;;AAED,MAAM,yBAAA,GAA4BD,+BAAsB;AACxD,EAAE,CAAC,EAAA,gBAAA,CAAA,OAAA,CAAA;AACA,EAAAE,uCAAA;AACA,EAAA,CAAA,OAAA,KAAA;AACA,IAAA,OAAA,OAAA;AACA,EAAA,CAAA;AACA,CAAA;;AAEA,MAAA,2BAAA,IAAA,CAAA,OAAA,GAAA,EAAA,KAAA;AACA,EAAA,OAAA;AACA,IAAA,IAAA,EAAA,WAAA;AACA,IAAA,SAAA,GAAA;AACA,MAAA,MAAA,eAAA,GAAA,sBAAA,CAAA,OAAA,EAAAC,cAAA,EAAA,EAAA,UAAA,EAAA,CAAA;;AAEA;AACA,MAAA,IAAA,eAAA,EAAA;AACA,QAAA,uBAAA,CAAA,OAAA,CAAA;AACA,MAAA;;AAEA;AACA;AACA;AACA,MAAA,yBAAA,CAAA,OAAA,CAAA;AACA,IAAA,CAAA;AACA,GAAA;AACA,CAAA,CAAA;;AAEA,MAAA,0BAAA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AAA,CAAA,CAAA,YAAA;AACA,IAAA,CAAA;AACA,IAAA,aAAA,EAAA,OAAA,IAAA;AACA,MAAA,MAAA,GAAA,GAAA,cAAA,CAAA,OAAA,CAAA,MAAA,EAAA,OAAA,CAAA,IAAA,CAAA;;AAEA;AACA,MAAA,IAAA,GAAA,CAAA,UAAA,CAAA,OAAA,CAAA,EAAA;AACA,QAAA,MAAA,YAAA,GAAAC,wBAAA,CAAA,GAAA,CAAA;AACA,QAAA,OAAA;AACA,UAAA,CAAAC,qCAAA,GAAA,2BAAA;AACA,UAAA,UAAA,EAAA,YAAA;AACA,UAAA,CAAAC,gCAAA,GAAA,YAAA;AACA,UAAA,CAAAC,+CAAA,GAAA,CAAA,EAAA,OAAA,CAAA,MAAA,IAAA,KAAA,CAAA,CAAA,EAAA,YAAA,CAAA,CAAA;AACA,SAAA;AACA,MAAA;;AAEA,MAAA,OAAA;AACA,QAAA,CAAAF,qCAAA,GAAA,2BAAA;AACA,OAAA;AACA,IAAA,CAAA;AACA,IAAA,WAAA,EAAA,OAAA,CAAA,WAAA;AACA,IAAA,YAAA,EAAA,OAAA,CAAA,YAAA;AACA,IAAA,uBAAA,EAAA,OAAA,CAAA,uBAAA;AACA,GAAA;;AAEA,EAAA,OAAA,qBAAA;AACA;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"node-fetch.js","sources":["../../../src/integrations/node-fetch.ts"],"sourcesContent":["import type { UndiciInstrumentationConfig } from '@opentelemetry/instrumentation-undici';\nimport { UndiciInstrumentation } from '@opentelemetry/instrumentation-undici';\nimport type { IntegrationFn } from '@sentry/core';\nimport {\n defineIntegration,\n getClient,\n hasSpansEnabled,\n SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_URL_FULL,\n stripDataUrlContent,\n} from '@sentry/core';\nimport type { NodeClient } from '@sentry/node-core';\nimport { generateInstrumentOnce, SentryNodeFetchInstrumentation } from '@sentry/node-core';\nimport type { NodeClientOptions } from '../types';\n\nconst INTEGRATION_NAME = 'NodeFetch';\n\ninterface NodeFetchOptions extends Pick<\n UndiciInstrumentationConfig,\n 'requestHook' | 'responseHook' | 'headersToSpanAttributes'\n> {\n /**\n * Whether breadcrumbs should be recorded for requests.\n * Defaults to true\n */\n breadcrumbs?: boolean;\n\n /**\n * If set to false, do not emit any spans.\n * This will ensure that the default UndiciInstrumentation from OpenTelemetry is not setup,\n * only the Sentry-specific instrumentation for breadcrumbs & trace propagation is applied.\n *\n * If `skipOpenTelemetrySetup: true` is configured, this defaults to `false`, otherwise it defaults to `true`.\n */\n spans?: boolean;\n\n /**\n * Whether to inject trace propagation headers (sentry-trace, baggage, traceparent) into outgoing fetch requests.\n *\n * When set to `false`, Sentry will not inject any trace propagation headers, but will still create breadcrumbs\n * (if `breadcrumbs` is enabled). This is useful when `skipOpenTelemetrySetup: true` is configured and you want\n * to avoid duplicate trace headers being injected by both Sentry and OpenTelemetry's UndiciInstrumentation.\n *\n * @default `true`\n */\n tracePropagation?: boolean;\n\n /**\n * Do not capture spans or breadcrumbs for outgoing fetch requests to URLs where the given callback returns `true`.\n * This controls both span & breadcrumb creation - spans will be non recording if tracing is disabled.\n */\n ignoreOutgoingRequests?: (url: string) => boolean;\n}\n\nconst instrumentOtelNodeFetch = generateInstrumentOnce(\n INTEGRATION_NAME,\n UndiciInstrumentation,\n (options: NodeFetchOptions) => {\n return _getConfigWithDefaults(options);\n },\n);\n\nconst instrumentSentryNodeFetch = generateInstrumentOnce(\n `${INTEGRATION_NAME}.sentry`,\n SentryNodeFetchInstrumentation,\n (options: NodeFetchOptions) => {\n return options;\n },\n);\n\nconst _nativeNodeFetchIntegration = ((options: NodeFetchOptions = {}) => {\n return {\n name: 'NodeFetch',\n setupOnce() {\n const instrumentSpans = _shouldInstrumentSpans(options, getClient<NodeClient>()?.getOptions());\n\n // This is the \"regular\" OTEL instrumentation that emits spans\n if (instrumentSpans) {\n instrumentOtelNodeFetch(options);\n }\n\n // This is the Sentry-specific instrumentation that creates breadcrumbs & propagates traces\n // This must be registered after the OTEL one, to ensure that the core trace propagation logic takes presedence\n // Otherwise, the sentry-trace header may be set multiple times\n instrumentSentryNodeFetch(options);\n },\n };\n}) satisfies IntegrationFn;\n\nexport const nativeNodeFetchIntegration = defineIntegration(_nativeNodeFetchIntegration);\n\n// Matching the behavior of the base instrumentation\nfunction getAbsoluteUrl(origin: string, path: string = '/'): string {\n const url = `${origin}`;\n\n if (url.endsWith('/') && path.startsWith('/')) {\n return `${url}${path.slice(1)}`;\n }\n\n if (!url.endsWith('/') && !path.startsWith('/')) {\n return `${url}/${path}`;\n }\n\n return `${url}${path}`;\n}\n\nfunction _shouldInstrumentSpans(options: NodeFetchOptions, clientOptions: Partial<NodeClientOptions> = {}): boolean {\n // If `spans` is passed in, it takes precedence\n // Else, we by default emit spans, unless `skipOpenTelemetrySetup` is set to `true` or spans are not enabled\n return typeof options.spans === 'boolean'\n ? options.spans\n : !clientOptions.skipOpenTelemetrySetup && hasSpansEnabled(clientOptions);\n}\n\n/** Exported only for tests. */\nexport function _getConfigWithDefaults(options: Partial<NodeFetchOptions> = {}): UndiciInstrumentationConfig {\n const instrumentationConfig = {\n requireParentforSpans: false,\n ignoreRequestHook: request => {\n const url = getAbsoluteUrl(request.origin, request.path);\n const _ignoreOutgoingRequests = options.ignoreOutgoingRequests;\n const shouldIgnore = _ignoreOutgoingRequests && url && _ignoreOutgoingRequests(url);\n\n return !!shouldIgnore;\n },\n startSpanHook: request => {\n const url = getAbsoluteUrl(request.origin, request.path);\n\n // Sanitize data URLs to prevent long base64 strings in span attributes\n if (url.startsWith('data:')) {\n const sanitizedUrl = stripDataUrlContent(url);\n return {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.otel.node_fetch',\n 'http.url': sanitizedUrl,\n [SEMANTIC_ATTRIBUTE_URL_FULL]: sanitizedUrl,\n [SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME]: `${request.method || 'GET'} ${sanitizedUrl}`,\n };\n }\n\n return {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.otel.node_fetch',\n };\n },\n requestHook: options.requestHook,\n responseHook: options.responseHook,\n headersToSpanAttributes: options.headersToSpanAttributes,\n } satisfies UndiciInstrumentationConfig;\n\n return instrumentationConfig;\n}\n"],"names":[],"mappings":";;;;AAgBA,MAAM,gBAAA,GAAmB,WAAW;;AAuCpC,MAAM,uBAAA,GAA0B,sBAAsB;AACtD,EAAE,gBAAgB;AAClB,EAAE,qBAAqB;AACvB,EAAE,CAAC,OAAO,KAAuB;AACjC,IAAI,OAAO,sBAAsB,CAAC,OAAO,CAAC;AAC1C,EAAE,CAAC;AACH,CAAC;;AAED,MAAM,yBAAA,GAA4B,sBAAsB;AACxD,EAAE,CAAC,EAAA,gBAAA,CAAA,OAAA,CAAA;AACA,EAAA,8BAAA;AACA,EAAA,CAAA,OAAA,KAAA;AACA,IAAA,OAAA,OAAA;AACA,EAAA,CAAA;AACA,CAAA;;AAEA,MAAA,2BAAA,IAAA,CAAA,OAAA,GAAA,EAAA,KAAA;AACA,EAAA,OAAA;AACA,IAAA,IAAA,EAAA,WAAA;AACA,IAAA,SAAA,GAAA;AACA,MAAA,MAAA,eAAA,GAAA,sBAAA,CAAA,OAAA,EAAA,SAAA,EAAA,EAAA,UAAA,EAAA,CAAA;;AAEA;AACA,MAAA,IAAA,eAAA,EAAA;AACA,QAAA,uBAAA,CAAA,OAAA,CAAA;AACA,MAAA;;AAEA;AACA;AACA;AACA,MAAA,yBAAA,CAAA,OAAA,CAAA;AACA,IAAA,CAAA;AACA,GAAA;AACA,CAAA,CAAA;;AAEA,MAAA,0BAAA,GAAA,iBAAA,CAAA,2BAAA;;AAEA;AACA,SAAA,cAAA,CAAA,MAAA,EAAA,IAAA,GAAA,GAAA,EAAA;AACA,EAAA,MAAA,GAAA,GAAA,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