@sentry/node 9.0.0-alpha.0 → 9.0.0-alpha.2

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.
Files changed (47) hide show
  1. package/LICENSE +1 -1
  2. package/build/cjs/integrations/anr/index.js +1 -1
  3. package/build/cjs/integrations/http/SentryHttpInstrumentation.js +109 -12
  4. package/build/cjs/integrations/http/SentryHttpInstrumentation.js.map +1 -1
  5. package/build/cjs/integrations/local-variables/local-variables-async.js +1 -1
  6. package/build/cjs/integrations/node-fetch.js +2 -2
  7. package/build/cjs/integrations/node-fetch.js.map +1 -1
  8. package/build/cjs/integrations/tracing/prisma.js +47 -6
  9. package/build/cjs/integrations/tracing/prisma.js.map +1 -1
  10. package/build/cjs/integrations/tracing/vercelai/index.js +4 -2
  11. package/build/cjs/integrations/tracing/vercelai/index.js.map +1 -1
  12. package/build/cjs/sdk/index.js +2 -2
  13. package/build/cjs/sdk/index.js.map +1 -1
  14. package/build/cjs/utils/ensureIsWrapped.js +3 -3
  15. package/build/cjs/utils/ensureIsWrapped.js.map +1 -1
  16. package/build/esm/integrations/anr/index.js +1 -1
  17. package/build/esm/integrations/anr/worker-script.js +2 -2
  18. package/build/esm/integrations/http/SentryHttpInstrumentation.js +110 -13
  19. package/build/esm/integrations/http/SentryHttpInstrumentation.js.map +1 -1
  20. package/build/esm/integrations/local-variables/local-variables-async.js +1 -1
  21. package/build/esm/integrations/local-variables/worker-script.js +2 -2
  22. package/build/esm/integrations/node-fetch.js +3 -3
  23. package/build/esm/integrations/node-fetch.js.map +1 -1
  24. package/build/esm/integrations/tracing/prisma.js +48 -7
  25. package/build/esm/integrations/tracing/prisma.js.map +1 -1
  26. package/build/esm/integrations/tracing/vercelai/index.js +4 -2
  27. package/build/esm/integrations/tracing/vercelai/index.js.map +1 -1
  28. package/build/esm/package.json +1 -1
  29. package/build/esm/sdk/index.js +3 -3
  30. package/build/esm/sdk/index.js.map +1 -1
  31. package/build/esm/utils/ensureIsWrapped.js +4 -4
  32. package/build/esm/utils/ensureIsWrapped.js.map +1 -1
  33. package/build/types/integrations/http/SentryHttpInstrumentation.d.ts +1 -0
  34. package/build/types/integrations/http/SentryHttpInstrumentation.d.ts.map +1 -1
  35. package/build/types/integrations/tracing/prisma/vendor/v5-tracing-helper.d.ts +38 -0
  36. package/build/types/integrations/tracing/prisma/vendor/v5-tracing-helper.d.ts.map +1 -0
  37. package/build/types/integrations/tracing/prisma/vendor/v6-tracing-helper.d.ts +31 -0
  38. package/build/types/integrations/tracing/prisma/vendor/v6-tracing-helper.d.ts.map +1 -0
  39. package/build/types/integrations/tracing/prisma.d.ts.map +1 -1
  40. package/build/types/integrations/tracing/vercelai/index.d.ts.map +1 -1
  41. package/build/types/types.d.ts +7 -0
  42. package/build/types/types.d.ts.map +1 -1
  43. package/build/types-ts3.8/integrations/http/SentryHttpInstrumentation.d.ts +1 -0
  44. package/build/types-ts3.8/integrations/tracing/prisma/vendor/v5-tracing-helper.d.ts +44 -0
  45. package/build/types-ts3.8/integrations/tracing/prisma/vendor/v6-tracing-helper.d.ts +34 -0
  46. package/build/types-ts3.8/types.d.ts +7 -0
  47. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"node-fetch.js","sources":["../../../src/integrations/node-fetch.ts"],"sourcesContent":["import { registerInstrumentations } from '@opentelemetry/instrumentation';\nimport type { UndiciRequest, UndiciResponse } from '@opentelemetry/instrumentation-undici';\nimport { UndiciInstrumentation } from '@opentelemetry/instrumentation-undici';\nimport type { IntegrationFn, SanitizedRequestData } from '@sentry/core';\nimport {\n LRUMap,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n addBreadcrumb,\n defineIntegration,\n getBreadcrumbLogLevelFromHttpStatusCode,\n getClient,\n getSanitizedUrlString,\n getTraceData,\n hasTracingEnabled,\n parseUrl,\n} from '@sentry/core';\nimport { shouldPropagateTraceForUrl } from '@sentry/opentelemetry';\n\ninterface NodeFetchOptions {\n /**\n * Whether breadcrumbs should be recorded for requests.\n * Defaults to true\n */\n breadcrumbs?: 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 _nativeNodeFetchIntegration = ((options: NodeFetchOptions = {}) => {\n const _breadcrumbs = typeof options.breadcrumbs === 'undefined' ? true : options.breadcrumbs;\n const _ignoreOutgoingRequests = options.ignoreOutgoingRequests;\n\n return {\n name: 'NodeFetch',\n setupOnce() {\n const propagationDecisionMap = new LRUMap<string, boolean>(100);\n\n const instrumentation = new UndiciInstrumentation({\n requireParentforSpans: false,\n ignoreRequestHook: request => {\n const url = getAbsoluteUrl(request.origin, request.path);\n const shouldIgnore = _ignoreOutgoingRequests && url && _ignoreOutgoingRequests(url);\n\n if (shouldIgnore) {\n return true;\n }\n\n // If tracing is disabled, we still want to propagate traces\n // So we do that manually here, matching what the instrumentation does otherwise\n if (!hasTracingEnabled()) {\n const tracePropagationTargets = getClient()?.getOptions().tracePropagationTargets;\n const addedHeaders = shouldPropagateTraceForUrl(url, tracePropagationTargets, propagationDecisionMap)\n ? getTraceData()\n : {};\n\n const requestHeaders = request.headers;\n if (Array.isArray(requestHeaders)) {\n Object.entries(addedHeaders).forEach(headers => requestHeaders.push(...headers));\n } else {\n request.headers += Object.entries(addedHeaders)\n .map(([k, v]) => `${k}: ${v}\\r\\n`)\n .join('');\n }\n\n // Prevent starting a span for this request\n return true;\n }\n\n return false;\n },\n startSpanHook: () => {\n return {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.otel.node_fetch',\n };\n },\n responseHook: (_, { request, response }) => {\n if (_breadcrumbs) {\n addRequestBreadcrumb(request, response);\n }\n },\n });\n\n registerInstrumentations({ instrumentations: [instrumentation] });\n },\n };\n}) satisfies IntegrationFn;\n\nexport const nativeNodeFetchIntegration = defineIntegration(_nativeNodeFetchIntegration);\n\n/** Add a breadcrumb for outgoing requests. */\nfunction addRequestBreadcrumb(request: UndiciRequest, response: UndiciResponse): void {\n const data = getBreadcrumbData(request);\n const statusCode = response.statusCode;\n const level = getBreadcrumbLogLevelFromHttpStatusCode(statusCode);\n\n addBreadcrumb(\n {\n category: 'http',\n data: {\n status_code: statusCode,\n ...data,\n },\n type: 'http',\n level,\n },\n {\n event: 'response',\n request,\n response,\n },\n );\n}\n\nfunction getBreadcrumbData(request: UndiciRequest): Partial<SanitizedRequestData> {\n try {\n const url = new URL(request.path, request.origin);\n const parsedUrl = parseUrl(url.toString());\n\n const data: Partial<SanitizedRequestData> = {\n url: getSanitizedUrlString(parsedUrl),\n 'http.method': request.method || 'GET',\n };\n\n if (parsedUrl.search) {\n data['http.query'] = parsedUrl.search;\n }\n if (parsedUrl.hash) {\n data['http.fragment'] = parsedUrl.hash;\n }\n\n return data;\n } catch {\n return {};\n }\n}\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.slice(1)}`;\n }\n\n return `${url}${path}`;\n}\n"],"names":[],"mappings":";;;;;AAgCA,MAAM,2BAAA,IAA+B,CAAC,OAAO,GAAqB,EAAE,KAAK;AACzE,EAAE,MAAM,YAAA,GAAe,OAAO,OAAO,CAAC,WAAA,KAAgB,WAAA,GAAc,IAAA,GAAO,OAAO,CAAC,WAAW;AAC9F,EAAE,MAAM,uBAAA,GAA0B,OAAO,CAAC,sBAAsB;;AAEhE,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,WAAW;AACrB,IAAI,SAAS,GAAG;AAChB,MAAM,MAAM,sBAAuB,GAAE,IAAI,MAAM,CAAkB,GAAG,CAAC;;AAErE,MAAM,MAAM,eAAA,GAAkB,IAAI,qBAAqB,CAAC;AACxD,QAAQ,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MAAA,EAAA;AACA,MAAA,IAAA,CAAA,YAAA,CAAA,GAAA,SAAA,CAAA,MAAA;AACA;AACA,IAAA,IAAA,SAAA,CAAA,IAAA,EAAA;AACA,MAAA,IAAA,CAAA,eAAA,CAAA,GAAA,SAAA,CAAA,IAAA;AACA;;AAEA,IAAA,OAAA,IAAA;AACA,GAAA,CAAA,MAAA;AACA,IAAA,OAAA,EAAA;AACA;AACA;;AAEA;AACA,SAAA,cAAA,CAAA,MAAA,EAAA,IAAA,GAAA,GAAA,EAAA;AACA,EAAA,MAAA,GAAA,GAAA,CAAA,EAAA,MAAA,CAAA,CAAA;;AAEA,EAAA,IAAA,GAAA,CAAA,QAAA,CAAA,GAAA,CAAA,IAAA,IAAA,CAAA,UAAA,CAAA,GAAA,CAAA,EAAA;AACA,IAAA,OAAA,CAAA,EAAA,GAAA,CAAA,EAAA,IAAA,CAAA,KAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACA;;AAEA,EAAA,IAAA,CAAA,GAAA,CAAA,QAAA,CAAA,GAAA,CAAA,IAAA,CAAA,IAAA,CAAA,UAAA,CAAA,GAAA,CAAA,EAAA;AACA,IAAA,OAAA,CAAA,EAAA,GAAA,CAAA,CAAA,EAAA,IAAA,CAAA,KAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACA;;AAEA,EAAA,OAAA,CAAA,EAAA,GAAA,CAAA,EAAA,IAAA,CAAA,CAAA;AACA;;;;"}
1
+ {"version":3,"file":"node-fetch.js","sources":["../../../src/integrations/node-fetch.ts"],"sourcesContent":["import { registerInstrumentations } from '@opentelemetry/instrumentation';\nimport type { UndiciRequest, UndiciResponse } from '@opentelemetry/instrumentation-undici';\nimport { UndiciInstrumentation } from '@opentelemetry/instrumentation-undici';\nimport type { IntegrationFn, SanitizedRequestData } from '@sentry/core';\nimport {\n LRUMap,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n addBreadcrumb,\n defineIntegration,\n getBreadcrumbLogLevelFromHttpStatusCode,\n getClient,\n getSanitizedUrlString,\n getTraceData,\n hasSpansEnabled,\n parseUrl,\n} from '@sentry/core';\nimport { shouldPropagateTraceForUrl } from '@sentry/opentelemetry';\n\ninterface NodeFetchOptions {\n /**\n * Whether breadcrumbs should be recorded for requests.\n * Defaults to true\n */\n breadcrumbs?: 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 _nativeNodeFetchIntegration = ((options: NodeFetchOptions = {}) => {\n const _breadcrumbs = typeof options.breadcrumbs === 'undefined' ? true : options.breadcrumbs;\n const _ignoreOutgoingRequests = options.ignoreOutgoingRequests;\n\n return {\n name: 'NodeFetch',\n setupOnce() {\n const propagationDecisionMap = new LRUMap<string, boolean>(100);\n\n const instrumentation = new UndiciInstrumentation({\n requireParentforSpans: false,\n ignoreRequestHook: request => {\n const url = getAbsoluteUrl(request.origin, request.path);\n const shouldIgnore = _ignoreOutgoingRequests && url && _ignoreOutgoingRequests(url);\n\n if (shouldIgnore) {\n return true;\n }\n\n // If span recording is disabled, we still want to propagate traces\n // So we do that manually here, matching what the instrumentation does otherwise\n if (!hasSpansEnabled()) {\n const tracePropagationTargets = getClient()?.getOptions().tracePropagationTargets;\n const addedHeaders = shouldPropagateTraceForUrl(url, tracePropagationTargets, propagationDecisionMap)\n ? getTraceData()\n : {};\n\n const requestHeaders = request.headers;\n if (Array.isArray(requestHeaders)) {\n Object.entries(addedHeaders).forEach(headers => requestHeaders.push(...headers));\n } else {\n request.headers += Object.entries(addedHeaders)\n .map(([k, v]) => `${k}: ${v}\\r\\n`)\n .join('');\n }\n\n // Prevent starting a span for this request\n return true;\n }\n\n return false;\n },\n startSpanHook: () => {\n return {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.otel.node_fetch',\n };\n },\n responseHook: (_, { request, response }) => {\n if (_breadcrumbs) {\n addRequestBreadcrumb(request, response);\n }\n },\n });\n\n registerInstrumentations({ instrumentations: [instrumentation] });\n },\n };\n}) satisfies IntegrationFn;\n\nexport const nativeNodeFetchIntegration = defineIntegration(_nativeNodeFetchIntegration);\n\n/** Add a breadcrumb for outgoing requests. */\nfunction addRequestBreadcrumb(request: UndiciRequest, response: UndiciResponse): void {\n const data = getBreadcrumbData(request);\n const statusCode = response.statusCode;\n const level = getBreadcrumbLogLevelFromHttpStatusCode(statusCode);\n\n addBreadcrumb(\n {\n category: 'http',\n data: {\n status_code: statusCode,\n ...data,\n },\n type: 'http',\n level,\n },\n {\n event: 'response',\n request,\n response,\n },\n );\n}\n\nfunction getBreadcrumbData(request: UndiciRequest): Partial<SanitizedRequestData> {\n try {\n const url = new URL(request.path, request.origin);\n const parsedUrl = parseUrl(url.toString());\n\n const data: Partial<SanitizedRequestData> = {\n url: getSanitizedUrlString(parsedUrl),\n 'http.method': request.method || 'GET',\n };\n\n if (parsedUrl.search) {\n data['http.query'] = parsedUrl.search;\n }\n if (parsedUrl.hash) {\n data['http.fragment'] = parsedUrl.hash;\n }\n\n return data;\n } catch {\n return {};\n }\n}\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.slice(1)}`;\n }\n\n return `${url}${path}`;\n}\n"],"names":[],"mappings":";;;;;AAgCA,MAAM,2BAAA,IAA+B,CAAC,OAAO,GAAqB,EAAE,KAAK;AACzE,EAAE,MAAM,YAAA,GAAe,OAAO,OAAO,CAAC,WAAA,KAAgB,WAAA,GAAc,IAAA,GAAO,OAAO,CAAC,WAAW;AAC9F,EAAE,MAAM,uBAAA,GAA0B,OAAO,CAAC,sBAAsB;;AAEhE,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,WAAW;AACrB,IAAI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A,MAAA,GAAA,EAAA,qBAAA,CAAA,SAAA,CAAA;AACA,MAAA,aAAA,EAAA,OAAA,CAAA,MAAA,IAAA,KAAA;AACA,KAAA;;AAEA,IAAA,IAAA,SAAA,CAAA,MAAA,EAAA;AACA,MAAA,IAAA,CAAA,YAAA,CAAA,GAAA,SAAA,CAAA,MAAA;AACA;AACA,IAAA,IAAA,SAAA,CAAA,IAAA,EAAA;AACA,MAAA,IAAA,CAAA,eAAA,CAAA,GAAA,SAAA,CAAA,IAAA;AACA;;AAEA,IAAA,OAAA,IAAA;AACA,GAAA,CAAA,MAAA;AACA,IAAA,OAAA,EAAA;AACA;AACA;;AAEA;AACA,SAAA,cAAA,CAAA,MAAA,EAAA,IAAA,GAAA,GAAA,EAAA;AACA,EAAA,MAAA,GAAA,GAAA,CAAA,EAAA,MAAA,CAAA,CAAA;;AAEA,EAAA,IAAA,GAAA,CAAA,QAAA,CAAA,GAAA,CAAA,IAAA,IAAA,CAAA,UAAA,CAAA,GAAA,CAAA,EAAA;AACA,IAAA,OAAA,CAAA,EAAA,GAAA,CAAA,EAAA,IAAA,CAAA,KAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACA;;AAEA,EAAA,IAAA,CAAA,GAAA,CAAA,QAAA,CAAA,GAAA,CAAA,IAAA,CAAA,IAAA,CAAA,UAAA,CAAA,GAAA,CAAA,EAAA;AACA,IAAA,OAAA,CAAA,EAAA,GAAA,CAAA,CAAA,EAAA,IAAA,CAAA,KAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACA;;AAEA,EAAA,OAAA,CAAA,EAAA,GAAA,CAAA,EAAA,IAAA,CAAA,CAAA;AACA;;;;"}
@@ -1,9 +1,55 @@
1
1
  import * as prismaInstrumentation from '@prisma/instrumentation';
2
- import { defineIntegration, spanToJSON, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
2
+ import { defineIntegration, spanToJSON, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, consoleSandbox } from '@sentry/core';
3
3
  import { generateInstrumentOnce } from '../../otel/instrument.js';
4
4
 
5
5
  const INTEGRATION_NAME = 'Prisma';
6
6
 
7
+ const EsmInteropPrismaInstrumentation =
8
+ // @ts-expect-error We need to do the following for interop reasons
9
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
10
+ prismaInstrumentation.default?.PrismaInstrumentation || prismaInstrumentation.PrismaInstrumentation;
11
+
12
+ function isPrismaV6TracingHelper(helper) {
13
+ return !!helper && typeof helper === 'object' && 'dispatchEngineSpans' in helper;
14
+ }
15
+
16
+ class SentryPrismaInteropInstrumentation extends EsmInteropPrismaInstrumentation {
17
+ constructor() {
18
+ super();
19
+ }
20
+
21
+ enable() {
22
+ super.enable();
23
+
24
+ // 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.
25
+ // 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.
26
+ // We still won't fully emit all the spans, but this could potentially be implemented in the future.
27
+ const prismaInstrumentationObject = (globalThis ).PRISMA_INSTRUMENTATION;
28
+ const prismaTracingHelper =
29
+ prismaInstrumentationObject &&
30
+ typeof prismaInstrumentationObject === 'object' &&
31
+ 'helper' in prismaInstrumentationObject
32
+ ? prismaInstrumentationObject.helper
33
+ : undefined;
34
+
35
+ let emittedWarning = false;
36
+
37
+ if (isPrismaV6TracingHelper(prismaTracingHelper)) {
38
+ (prismaTracingHelper ).createEngineSpan = () => {
39
+ consoleSandbox(() => {
40
+ if (!emittedWarning) {
41
+ emittedWarning = true;
42
+ // eslint-disable-next-line no-console
43
+ console.warn(
44
+ '[Sentry] The Sentry SDK supports tracing with Prisma version 5 only with limited capabilities. For full tracing capabilities pass `prismaInstrumentation` for version 5 to the Sentry `prismaIntegration`. Read more: https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/prisma/',
45
+ );
46
+ }
47
+ });
48
+ };
49
+ }
50
+ }
51
+ }
52
+
7
53
  const instrumentPrisma = generateInstrumentOnce(
8
54
  INTEGRATION_NAME,
9
55
  options => {
@@ -12,12 +58,7 @@ const instrumentPrisma = generateInstrumentOnce(
12
58
  return options.prismaInstrumentation;
13
59
  }
14
60
 
15
- const EsmInteropPrismaInstrumentation =
16
- // @ts-expect-error We need to do the following for interop reasons
17
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
18
- prismaInstrumentation.default?.PrismaInstrumentation || prismaInstrumentation.PrismaInstrumentation;
19
-
20
- return new EsmInteropPrismaInstrumentation({});
61
+ return new SentryPrismaInteropInstrumentation();
21
62
  },
22
63
  );
23
64
 
@@ -1 +1 @@
1
- {"version":3,"file":"prisma.js","sources":["../../../../src/integrations/tracing/prisma.ts"],"sourcesContent":["import type { Instrumentation } from '@opentelemetry/instrumentation';\n// When importing CJS modules into an ESM module, we cannot import the named exports directly.\nimport * as prismaInstrumentation from '@prisma/instrumentation';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, defineIntegration, spanToJSON } from '@sentry/core';\nimport { generateInstrumentOnce } from '../../otel/instrument';\n\nconst INTEGRATION_NAME = 'Prisma';\n\nexport const instrumentPrisma = generateInstrumentOnce<{ prismaInstrumentation?: Instrumentation }>(\n INTEGRATION_NAME,\n options => {\n // Use a passed instrumentation instance to support older Prisma versions\n if (options?.prismaInstrumentation) {\n return options.prismaInstrumentation;\n }\n\n const EsmInteropPrismaInstrumentation: typeof prismaInstrumentation.PrismaInstrumentation =\n // @ts-expect-error We need to do the following for interop reasons\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n prismaInstrumentation.default?.PrismaInstrumentation || prismaInstrumentation.PrismaInstrumentation;\n\n return new EsmInteropPrismaInstrumentation({});\n },\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(\n ({\n prismaInstrumentation,\n }: {\n /**\n * Overrides the instrumentation used by the Sentry SDK with the passed in instrumentation instance.\n *\n * NOTE: By default, the Sentry SDK uses the Prisma v6 instrumentation. Use this option if you need performance instrumentation different Prisma versions.\n *\n * For more information refer to the documentation of `prismaIntegration()` or see https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/prisma/\n */\n prismaInstrumentation?: Instrumentation;\n } = {}) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentPrisma({ prismaInstrumentation });\n },\n setup(client) {\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);\n"],"names":[],"mappings":";;;;AAMA,MAAM,gBAAA,GAAmB,QAAQ;;AAE1B,MAAM,gBAAiB,GAAE,sBAAsB;AACtD,EAAE,gBAAgB;AAClB,EAAE,WAAW;AACb;AACA,IAAI,IAAI,OAAO,EAAE,qBAAqB,EAAE;AACxC,MAAM,OAAO,OAAO,CAAC,qBAAqB;AAC1C;;AAEA,IAAI,MAAM,+BAA+B;AACzC;AACA;AACA,MAAM,qBAAqB,CAAC,OAAO,EAAE,yBAAyB,qBAAqB,CAAC,qBAAqB;;AAEzG,IAAI,OAAO,IAAI,+BAA+B,CAAC,EAAE,CAAC;AAClD,GAAG;AACH;;AAEA;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;AACO,MAAM,iBAAkB,GAAE,iBAAiB;AAClD,EAAE,CAAC;AACH,IAAI,qBAAqB;AACzB;;AASE,GAAI,EAAE,KAAK;AACb,IAAI,OAAO;AACX,MAAM,IAAI,EAAE,gBAAgB;AAC5B,MAAM,SAAS,GAAG;AAClB,QAAQ,gBAAgB,CAAC,EAAE,qBAAA,EAAuB,CAAC;AACnD,OAAO;AACP,MAAM,KAAK,CAAC,MAAM,EAAE;AACpB,QAAQ,MAAM,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ;AACvC,UAAU,MAAM,QAAS,GAAE,UAAU,CAAC,IAAI,CAAC;AAC3C,UAAU,IAAI,QAAQ,CAAC,WAAW,EAAE,UAAU,CAAC,SAAS,CAAC,EAAE;AAC3D,YAAY,IAAI,CAAC,YAAY,CAAC,gCAAgC,EAAE,qBAAqB,CAAC;AACtF;;AAEA;AACA,UAAU,IAAI,QAAQ,CAAC,gBAAgB,wBAAA,IAA4B,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE;AACnG,YAAY,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAA,EAAY;AACrE;;AAEA;AACA;AACA,UAAU,IAAI,QAAQ,CAAC,gBAAgB,wBAAA,IAA4B,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;AAChG,YAAY,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,QAAQ,CAAC;AACpD;AACA,SAAS,CAAC;AACV,OAAO;AACP,KAAK;AACL,GAAG;AACH;;;;"}
1
+ {"version":3,"file":"prisma.js","sources":["../../../../src/integrations/tracing/prisma.ts"],"sourcesContent":["import type { Instrumentation } from '@opentelemetry/instrumentation';\n// When importing CJS modules into an ESM module, we cannot import the named exports directly.\nimport * as prismaInstrumentation from '@prisma/instrumentation';\nimport { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, consoleSandbox, defineIntegration, spanToJSON } from '@sentry/core';\nimport { generateInstrumentOnce } from '../../otel/instrument';\nimport type { PrismaV5TracingHelper } from './prisma/vendor/v5-tracing-helper';\nimport type { PrismaV6TracingHelper } from './prisma/vendor/v6-tracing-helper';\n\nconst INTEGRATION_NAME = 'Prisma';\n\nconst EsmInteropPrismaInstrumentation: typeof prismaInstrumentation.PrismaInstrumentation =\n // @ts-expect-error We need to do the following for interop reasons\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n prismaInstrumentation.default?.PrismaInstrumentation || prismaInstrumentation.PrismaInstrumentation;\n\ntype CompatibilityLayerTraceHelper = PrismaV5TracingHelper & PrismaV6TracingHelper;\n\nfunction isPrismaV6TracingHelper(helper: unknown): helper is PrismaV6TracingHelper {\n return !!helper && typeof helper === 'object' && 'dispatchEngineSpans' in helper;\n}\n\nclass SentryPrismaInteropInstrumentation extends EsmInteropPrismaInstrumentation {\n public constructor() {\n super();\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 // We still won't fully emit all the spans, but this could potentially be implemented in the future.\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 let emittedWarning = false;\n\n if (isPrismaV6TracingHelper(prismaTracingHelper)) {\n (prismaTracingHelper as CompatibilityLayerTraceHelper).createEngineSpan = () => {\n consoleSandbox(() => {\n if (!emittedWarning) {\n emittedWarning = true;\n // eslint-disable-next-line no-console\n console.warn(\n '[Sentry] The Sentry SDK supports tracing with Prisma version 5 only with limited capabilities. For full tracing capabilities pass `prismaInstrumentation` for version 5 to the Sentry `prismaIntegration`. Read more: https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/prisma/',\n );\n }\n });\n };\n }\n }\n}\n\nexport const instrumentPrisma = generateInstrumentOnce<{ prismaInstrumentation?: Instrumentation }>(\n INTEGRATION_NAME,\n options => {\n // Use a passed instrumentation instance to support older Prisma versions\n if (options?.prismaInstrumentation) {\n return options.prismaInstrumentation;\n }\n\n return new SentryPrismaInteropInstrumentation();\n },\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(\n ({\n prismaInstrumentation,\n }: {\n /**\n * Overrides the instrumentation used by the Sentry SDK with the passed in instrumentation instance.\n *\n * NOTE: By default, the Sentry SDK uses the Prisma v6 instrumentation. Use this option if you need performance instrumentation different Prisma versions.\n *\n * For more information refer to the documentation of `prismaIntegration()` or see https://docs.sentry.io/platforms/javascript/guides/node/configuration/integrations/prisma/\n */\n prismaInstrumentation?: Instrumentation;\n } = {}) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentPrisma({ prismaInstrumentation });\n },\n setup(client) {\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);\n"],"names":[],"mappings":";;;;AAQA,MAAM,gBAAA,GAAmB,QAAQ;;AAEjC,MAAM,+BAA+B;AACrC;AACA;AACA,EAAE,qBAAqB,CAAC,OAAO,EAAE,yBAAyB,qBAAqB,CAAC,qBAAqB;;AAIrG,SAAS,uBAAuB,CAAC,MAAM,EAA4C;AACnF,EAAE,OAAO,CAAC,CAAC,MAAA,IAAU,OAAO,MAAO,KAAI,QAAS,IAAG,qBAAsB,IAAG,MAAM;AAClF;;AAEA,MAAM,kCAAA,SAA2C,+BAAgC,CAAA;AACjF,GAAS,WAAW,GAAG;AACvB,IAAI,KAAK,EAAE;AACX;;AAEA,GAAS,MAAM,GAAS;AACxB,IAAI,KAAK,CAAC,MAAM,EAAE;;AAElB;AACA;AACA;AACA,IAAI,MAAM,2BAA4B,GAAE,CAAC,UAAW,GAA4B,sBAAsB;AACtG,IAAI,MAAM,mBAAoB;AAC9B,MAAM,2BAA4B;AAClC,MAAM,OAAO,2BAA4B,KAAI,QAAS;AACtD,MAAM,YAAY;AAClB,UAAU,2BAA2B,CAAC;AACtC,UAAU,SAAS;;AAEnB,IAAI,IAAI,cAAe,GAAE,KAAK;;AAE9B,IAAI,IAAI,uBAAuB,CAAC,mBAAmB,CAAC,EAAE;AACtD,MAAM,CAAC,sBAAsD,mBAAmB,MAAM;AACtF,QAAQ,cAAc,CAAC,MAAM;AAC7B,UAAU,IAAI,CAAC,cAAc,EAAE;AAC/B,YAAY,cAAA,GAAiB,IAAI;AACjC;AACA,YAAY,OAAO,CAAC,IAAI;AACxB,cAAc,kT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,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;AAChG,YAAY,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,QAAQ,CAAC;AACpD;AACA,SAAS,CAAC;AACV,OAAO;AACP,KAAK;AACL,GAAG;AACH;;;;"}
@@ -5,11 +5,13 @@ import { SentryVercelAiInstrumentation, sentryVercelAiPatched } from './instrume
5
5
 
6
6
  /* eslint-disable complexity */
7
7
 
8
- const instrumentVercelAi = generateInstrumentOnce('vercelAI', () => new SentryVercelAiInstrumentation({}));
8
+ const INTEGRATION_NAME = 'VercelAI';
9
+
10
+ const instrumentVercelAi = generateInstrumentOnce(INTEGRATION_NAME, () => new SentryVercelAiInstrumentation({}));
9
11
 
10
12
  const _vercelAIIntegration = (() => {
11
13
  return {
12
- name: 'vercelAI',
14
+ name: INTEGRATION_NAME,
13
15
  setupOnce() {
14
16
  instrumentVercelAi();
15
17
  },
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/vercelai/index.ts"],"sourcesContent":["/* eslint-disable complexity */\nimport { SEMANTIC_ATTRIBUTE_SENTRY_OP, defineIntegration, spanToJSON } from '@sentry/core';\nimport type { IntegrationFn } from '@sentry/core';\nimport { generateInstrumentOnce } from '../../../otel/instrument';\nimport { addOriginToSpan } from '../../../utils/addOriginToSpan';\nimport { SentryVercelAiInstrumentation, sentryVercelAiPatched } from './instrumentation';\n\nexport const instrumentVercelAi = generateInstrumentOnce('vercelAI', () => new SentryVercelAiInstrumentation({}));\n\nconst _vercelAIIntegration = (() => {\n return {\n name: 'vercelAI',\n setupOnce() {\n instrumentVercelAi();\n },\n processEvent(event) {\n if (event.type === 'transaction' && event.spans?.length) {\n for (const span of event.spans) {\n const { data: attributes, description: name } = span;\n\n if (!name || span.origin !== 'auto.vercelai.otel') {\n continue;\n }\n\n if (attributes['ai.usage.completionTokens'] != undefined) {\n attributes['ai.completion_tokens.used'] = attributes['ai.usage.completionTokens'];\n }\n if (attributes['ai.usage.promptTokens'] != undefined) {\n attributes['ai.prompt_tokens.used'] = attributes['ai.usage.promptTokens'];\n }\n if (\n typeof attributes['ai.usage.completionTokens'] == 'number' &&\n typeof attributes['ai.usage.promptTokens'] == 'number'\n ) {\n attributes['ai.total_tokens.used'] =\n attributes['ai.usage.completionTokens'] + attributes['ai.usage.promptTokens'];\n }\n }\n }\n\n return event;\n },\n setup(client) {\n client.on('spanStart', span => {\n if (!sentryVercelAiPatched) {\n return;\n }\n\n const { data: attributes, description: name } = spanToJSON(span);\n\n if (!name) {\n return;\n }\n\n // The id of the model\n const aiModelId = attributes['ai.model.id'];\n\n // the provider of the model\n const aiModelProvider = attributes['ai.model.provider'];\n\n // both of these must be defined for the integration to work\n if (typeof aiModelId !== 'string' || typeof aiModelProvider !== 'string' || !aiModelId || !aiModelProvider) {\n return;\n }\n\n let isPipelineSpan = false;\n\n switch (name) {\n case 'ai.generateText': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.generateText');\n isPipelineSpan = true;\n break;\n }\n case 'ai.generateText.doGenerate': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doGenerate');\n break;\n }\n case 'ai.streamText': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.streamText');\n isPipelineSpan = true;\n break;\n }\n case 'ai.streamText.doStream': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doStream');\n break;\n }\n case 'ai.generateObject': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.generateObject');\n isPipelineSpan = true;\n break;\n }\n case 'ai.generateObject.doGenerate': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doGenerate');\n break;\n }\n case 'ai.streamObject': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.streamObject');\n isPipelineSpan = true;\n break;\n }\n case 'ai.streamObject.doStream': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doStream');\n break;\n }\n case 'ai.embed': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.embed');\n isPipelineSpan = true;\n break;\n }\n case 'ai.embed.doEmbed': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.embeddings');\n break;\n }\n case 'ai.embedMany': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.embedMany');\n isPipelineSpan = true;\n break;\n }\n case 'ai.embedMany.doEmbed': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.embeddings');\n break;\n }\n case 'ai.toolCall':\n case 'ai.stream.firstChunk':\n case 'ai.stream.finish':\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run');\n break;\n }\n\n addOriginToSpan(span, 'auto.vercelai.otel');\n\n const nameWthoutAi = name.replace('ai.', '');\n span.setAttribute('ai.pipeline.name', nameWthoutAi);\n span.updateName(nameWthoutAi);\n\n // If a Telemetry name is set and it is a pipeline span, use that as the operation name\n const functionId = attributes['ai.telemetry.functionId'];\n if (functionId && typeof functionId === 'string' && isPipelineSpan) {\n span.updateName(functionId);\n span.setAttribute('ai.pipeline.name', functionId);\n }\n\n if (attributes['ai.prompt']) {\n span.setAttribute('ai.input_messages', attributes['ai.prompt']);\n }\n if (attributes['ai.model.id']) {\n span.setAttribute('ai.model_id', attributes['ai.model.id']);\n }\n span.setAttribute('ai.streaming', name.includes('stream'));\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [ai](https://www.npmjs.com/package/ai) library.\n *\n * For more information, see the [`ai` documentation](https://sdk.vercel.ai/docs/ai-sdk-core/telemetry).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.vercelAIIntegration()],\n * });\n * ```\n *\n * By default this integration adds tracing support to all `ai` function calls. If you need to disable\n * collecting spans for a specific call, you can do so by setting `experimental_telemetry.isEnabled` to\n * `false` in the first argument of the function call.\n *\n * ```javascript\n * const result = await generateText({\n * model: openai('gpt-4-turbo'),\n * experimental_telemetry: { isEnabled: false },\n * });\n * ```\n *\n * If you want to collect inputs and outputs for a specific call, you must specifically opt-in to each\n * function call by setting `experimental_telemetry.recordInputs` and `experimental_telemetry.recordOutputs`\n * to `true`.\n *\n * ```javascript\n * const result = await generateText({\n * model: openai('gpt-4-turbo'),\n * experimental_telemetry: { isEnabled: true, recordInputs: true, recordOutputs: true },\n * });\n */\nexport const vercelAIIntegration = defineIntegration(_vercelAIIntegration);\n"],"names":[],"mappings":";;;;;AAAA;;MAOa,kBAAmB,GAAE,sBAAsB,CAAC,UAAU,EAAE,MAAM,IAAI,6BAA6B,CAAC,EAAE,CAAC;;AAEhH,MAAM,oBAAqB,IAAG,MAAM;AACpC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,UAAU;AACpB,IAAI,SAAS,GAAG;AAChB,MAAM,kBAAkB,EAAE;AAC1B,KAAK;AACL,IAAI,YAAY,CAAC,KAAK,EAAE;AACxB,MAAM,IAAI,KAAK,CAAC,IAAK,KAAI,aAAc,IAAG,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE;AAC/D,QAAQ,KAAK,MAAM,IAAA,IAAQ,KAAK,CAAC,KAAK,EAAE;AACxC,UAAU,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,IAAA,EAAO,GAAE,IAAI;;AAE9D,UAAU,IAAI,CAAC,IAAK,IAAG,IAAI,CAAC,MAAA,KAAW,oBAAoB,EAAE;AAC7D,YAAY;AACZ;;AAEA,UAAU,IAAI,UAAU,CAAC,2BAA2B,CAAE,IAAG,SAAS,EAAE;AACpE,YAAY,UAAU,CAAC,2BAA2B,CAAA,GAAI,UAAU,CAAC,2BAA2B,CAAC;AAC7F;AACA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ACA;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,mBAAoB,GAAE,iBAAiB,CAAC,oBAAoB;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing/vercelai/index.ts"],"sourcesContent":["/* eslint-disable complexity */\nimport { SEMANTIC_ATTRIBUTE_SENTRY_OP, defineIntegration, spanToJSON } from '@sentry/core';\nimport type { IntegrationFn } from '@sentry/core';\nimport { generateInstrumentOnce } from '../../../otel/instrument';\nimport { addOriginToSpan } from '../../../utils/addOriginToSpan';\nimport { SentryVercelAiInstrumentation, sentryVercelAiPatched } from './instrumentation';\n\nconst INTEGRATION_NAME = 'VercelAI';\n\nexport const instrumentVercelAi = generateInstrumentOnce(INTEGRATION_NAME, () => new SentryVercelAiInstrumentation({}));\n\nconst _vercelAIIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n instrumentVercelAi();\n },\n processEvent(event) {\n if (event.type === 'transaction' && event.spans?.length) {\n for (const span of event.spans) {\n const { data: attributes, description: name } = span;\n\n if (!name || span.origin !== 'auto.vercelai.otel') {\n continue;\n }\n\n if (attributes['ai.usage.completionTokens'] != undefined) {\n attributes['ai.completion_tokens.used'] = attributes['ai.usage.completionTokens'];\n }\n if (attributes['ai.usage.promptTokens'] != undefined) {\n attributes['ai.prompt_tokens.used'] = attributes['ai.usage.promptTokens'];\n }\n if (\n typeof attributes['ai.usage.completionTokens'] == 'number' &&\n typeof attributes['ai.usage.promptTokens'] == 'number'\n ) {\n attributes['ai.total_tokens.used'] =\n attributes['ai.usage.completionTokens'] + attributes['ai.usage.promptTokens'];\n }\n }\n }\n\n return event;\n },\n setup(client) {\n client.on('spanStart', span => {\n if (!sentryVercelAiPatched) {\n return;\n }\n\n const { data: attributes, description: name } = spanToJSON(span);\n\n if (!name) {\n return;\n }\n\n // The id of the model\n const aiModelId = attributes['ai.model.id'];\n\n // the provider of the model\n const aiModelProvider = attributes['ai.model.provider'];\n\n // both of these must be defined for the integration to work\n if (typeof aiModelId !== 'string' || typeof aiModelProvider !== 'string' || !aiModelId || !aiModelProvider) {\n return;\n }\n\n let isPipelineSpan = false;\n\n switch (name) {\n case 'ai.generateText': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.generateText');\n isPipelineSpan = true;\n break;\n }\n case 'ai.generateText.doGenerate': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doGenerate');\n break;\n }\n case 'ai.streamText': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.streamText');\n isPipelineSpan = true;\n break;\n }\n case 'ai.streamText.doStream': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doStream');\n break;\n }\n case 'ai.generateObject': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.generateObject');\n isPipelineSpan = true;\n break;\n }\n case 'ai.generateObject.doGenerate': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doGenerate');\n break;\n }\n case 'ai.streamObject': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.streamObject');\n isPipelineSpan = true;\n break;\n }\n case 'ai.streamObject.doStream': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run.doStream');\n break;\n }\n case 'ai.embed': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.embed');\n isPipelineSpan = true;\n break;\n }\n case 'ai.embed.doEmbed': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.embeddings');\n break;\n }\n case 'ai.embedMany': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.pipeline.embedMany');\n isPipelineSpan = true;\n break;\n }\n case 'ai.embedMany.doEmbed': {\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.embeddings');\n break;\n }\n case 'ai.toolCall':\n case 'ai.stream.firstChunk':\n case 'ai.stream.finish':\n span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_OP, 'ai.run');\n break;\n }\n\n addOriginToSpan(span, 'auto.vercelai.otel');\n\n const nameWthoutAi = name.replace('ai.', '');\n span.setAttribute('ai.pipeline.name', nameWthoutAi);\n span.updateName(nameWthoutAi);\n\n // If a Telemetry name is set and it is a pipeline span, use that as the operation name\n const functionId = attributes['ai.telemetry.functionId'];\n if (functionId && typeof functionId === 'string' && isPipelineSpan) {\n span.updateName(functionId);\n span.setAttribute('ai.pipeline.name', functionId);\n }\n\n if (attributes['ai.prompt']) {\n span.setAttribute('ai.input_messages', attributes['ai.prompt']);\n }\n if (attributes['ai.model.id']) {\n span.setAttribute('ai.model_id', attributes['ai.model.id']);\n }\n span.setAttribute('ai.streaming', name.includes('stream'));\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for the [ai](https://www.npmjs.com/package/ai) library.\n *\n * For more information, see the [`ai` documentation](https://sdk.vercel.ai/docs/ai-sdk-core/telemetry).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.vercelAIIntegration()],\n * });\n * ```\n *\n * By default this integration adds tracing support to all `ai` function calls. If you need to disable\n * collecting spans for a specific call, you can do so by setting `experimental_telemetry.isEnabled` to\n * `false` in the first argument of the function call.\n *\n * ```javascript\n * const result = await generateText({\n * model: openai('gpt-4-turbo'),\n * experimental_telemetry: { isEnabled: false },\n * });\n * ```\n *\n * If you want to collect inputs and outputs for a specific call, you must specifically opt-in to each\n * function call by setting `experimental_telemetry.recordInputs` and `experimental_telemetry.recordOutputs`\n * to `true`.\n *\n * ```javascript\n * const result = await generateText({\n * model: openai('gpt-4-turbo'),\n * experimental_telemetry: { isEnabled: true, recordInputs: true, recordOutputs: true },\n * });\n */\nexport const vercelAIIntegration = defineIntegration(_vercelAIIntegration);\n"],"names":[],"mappings":";;;;;AAAA;;AAOA,MAAM,gBAAA,GAAmB,UAAU;;MAEtB,kBAAmB,GAAE,sBAAsB,CAAC,gBAAgB,EAAE,MAAM,IAAI,6BAA6B,CAAC,EAAE,CAAC;;AAEtH,MAAM,oBAAqB,IAAG,MAAM;AACpC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB,MAAM,kBAAkB,EAAE;AAC1B,KAAK;AACL,IAAI,YAAY,CAAC,KAAK,EAAE;AACxB,MAAM,IAAI,KAAK,CAAC,IAAK,KAAI,aAAc,IAAG,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE;AAC/D,QAAQ,KAAK,MAAM,IAAA,IAAQ,KAAK,CAAC,KAAK,EAAE;AACxC,UAAU,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,IAAA,EAAO,GAAE,IAAI;;AAE9D,UAAU,IAAI,CAAC,IAAK,IAAG,IAAI,CAAC,MAAA,KAAW,oBAAoB,EAAE;AAC7D,YAAY;AACZ;;AAEA,UAAU,IAAI,UAAU,CAAC,2BAA2B,CAAE,IAAG,SAAS,EAAE;AACpE,YAAY,UAAU,CAAC,2BAA2B,CAAA,GAAI,UAAU,CAAC,2BAA2B,CAAC;AAC7F;AACA,UAAU,IAAI,UAAU,CAAC,uBAAuB,CAAE,IAAG,SAAS,EAAE;AAChE,YAAY,UAAU,CAAC,uBAAuB,CAAA,GAAI,UAAU,CAAC,uBAAuB,CAAC;AACrF;AACA,UAAU;AACV,YAAY,OAAO,UAAU,CAAC,2BAA2B,CAAA,IAAK,QAAS;AACvE,YAAY,OAAO,UAAU,CAAC,uBAAuB,KAAK;AAC1D,YAAY;AACZ,YAAY,UAAU,CAAC,sBAAsB,CAA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ideEffects":false}
@@ -1,4 +1,4 @@
1
- import { inboundFiltersIntegration, functionToStringIntegration, linkedErrorsIntegration, requestDataIntegration, hasTracingEnabled, logger, consoleSandbox, getCurrentScope, dropUndefinedKeys, stackParserFromStackParserOptions, getIntegrationsToSetup, propagationContextFromHeaders } from '@sentry/core';
1
+ import { inboundFiltersIntegration, functionToStringIntegration, linkedErrorsIntegration, requestDataIntegration, hasSpansEnabled, logger, consoleSandbox, getCurrentScope, dropUndefinedKeys, stackParserFromStackParserOptions, getIntegrationsToSetup, propagationContextFromHeaders } from '@sentry/core';
2
2
  import { setOpenTelemetryContextAsyncContextStrategy, enhanceDscWithOpenTelemetryRootSpanName, setupEventContextTrace, openTelemetrySetupCheck } from '@sentry/opentelemetry';
3
3
  import { DEBUG_BUILD } from '../debug-build.js';
4
4
  import { childProcessIntegration } from '../integrations/childProcess.js';
@@ -60,7 +60,7 @@ function getDefaultIntegrations(options) {
60
60
  // Note that this means that without tracing enabled, e.g. `expressIntegration()` will not be added
61
61
  // This means that generally request isolation will work (because that is done by httpIntegration)
62
62
  // But `transactionName` will not be set automatically
63
- ...(hasTracingEnabled(options) ? getAutoPerformanceIntegrations() : []),
63
+ ...(hasSpansEnabled(options) ? getAutoPerformanceIntegrations() : []),
64
64
  ];
65
65
  }
66
66
 
@@ -155,7 +155,7 @@ function validateOpenTelemetrySetup() {
155
155
 
156
156
  const required = ['SentryContextManager', 'SentryPropagator'];
157
157
 
158
- if (hasTracingEnabled()) {
158
+ if (hasSpansEnabled()) {
159
159
  required.push('SentrySpanProcessor');
160
160
  }
161
161
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/sdk/index.ts"],"sourcesContent":["import type { Integration, Options } from '@sentry/core';\nimport {\n consoleSandbox,\n dropUndefinedKeys,\n functionToStringIntegration,\n getCurrentScope,\n getIntegrationsToSetup,\n hasTracingEnabled,\n inboundFiltersIntegration,\n linkedErrorsIntegration,\n logger,\n propagationContextFromHeaders,\n requestDataIntegration,\n stackParserFromStackParserOptions,\n} from '@sentry/core';\nimport {\n enhanceDscWithOpenTelemetryRootSpanName,\n openTelemetrySetupCheck,\n setOpenTelemetryContextAsyncContextStrategy,\n setupEventContextTrace,\n} from '@sentry/opentelemetry';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { childProcessIntegration } from '../integrations/childProcess';\nimport { consoleIntegration } from '../integrations/console';\nimport { nodeContextIntegration } from '../integrations/context';\nimport { contextLinesIntegration } from '../integrations/contextlines';\nimport { httpIntegration } from '../integrations/http';\nimport { localVariablesIntegration } from '../integrations/local-variables';\nimport { modulesIntegration } from '../integrations/modules';\nimport { nativeNodeFetchIntegration } from '../integrations/node-fetch';\nimport { onUncaughtExceptionIntegration } from '../integrations/onuncaughtexception';\nimport { onUnhandledRejectionIntegration } from '../integrations/onunhandledrejection';\nimport { processSessionIntegration } from '../integrations/processSession';\nimport { INTEGRATION_NAME as SPOTLIGHT_INTEGRATION_NAME, spotlightIntegration } from '../integrations/spotlight';\nimport { getAutoPerformanceIntegrations } from '../integrations/tracing';\nimport { makeNodeTransport } from '../transports';\nimport type { NodeClientOptions, NodeOptions } from '../types';\nimport { isCjs } from '../utils/commonjs';\nimport { envToBool } from '../utils/envToBool';\nimport { defaultStackParser, getSentryRelease } from './api';\nimport { NodeClient } from './client';\nimport { initOpenTelemetry, maybeInitializeEsmLoader } from './initOtel';\n\nfunction getCjsOnlyIntegrations(): Integration[] {\n return isCjs() ? [modulesIntegration()] : [];\n}\n\n/**\n * Get default integrations, excluding performance.\n */\nexport function getDefaultIntegrationsWithoutPerformance(): Integration[] {\n return [\n // Common\n inboundFiltersIntegration(),\n functionToStringIntegration(),\n linkedErrorsIntegration(),\n requestDataIntegration(),\n // Native Wrappers\n consoleIntegration(),\n httpIntegration(),\n nativeNodeFetchIntegration(),\n // Global Handlers\n onUncaughtExceptionIntegration(),\n onUnhandledRejectionIntegration(),\n // Event Info\n contextLinesIntegration(),\n localVariablesIntegration(),\n nodeContextIntegration(),\n childProcessIntegration(),\n processSessionIntegration(),\n ...getCjsOnlyIntegrations(),\n ];\n}\n\n/** Get the default integrations for the Node SDK. */\nexport function getDefaultIntegrations(options: Options): Integration[] {\n return [\n ...getDefaultIntegrationsWithoutPerformance(),\n // We only add performance integrations if tracing is enabled\n // Note that this means that without tracing enabled, e.g. `expressIntegration()` will not be added\n // This means that generally request isolation will work (because that is done by httpIntegration)\n // But `transactionName` will not be set automatically\n ...(hasTracingEnabled(options) ? getAutoPerformanceIntegrations() : []),\n ];\n}\n\n/**\n * Initialize Sentry for Node.\n */\nexport function init(options: NodeOptions | undefined = {}): NodeClient | undefined {\n return _init(options, getDefaultIntegrations);\n}\n\n/**\n * Initialize Sentry for Node, without any integrations added by default.\n */\nexport function initWithoutDefaultIntegrations(options: NodeOptions | undefined = {}): NodeClient {\n return _init(options, () => []);\n}\n\n/**\n * Initialize Sentry for Node, without performance instrumentation.\n */\nfunction _init(\n _options: NodeOptions | undefined = {},\n getDefaultIntegrationsImpl: (options: Options) => Integration[],\n): NodeClient {\n const options = getClientOptions(_options, getDefaultIntegrationsImpl);\n\n if (options.debug === true) {\n if (DEBUG_BUILD) {\n logger.enable();\n } else {\n // use `console.warn` rather than `logger.warn` since by non-debug bundles have all `logger.x` statements stripped\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn('[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.');\n });\n }\n }\n\n if (!isCjs() && options.registerEsmLoaderHooks !== false) {\n maybeInitializeEsmLoader();\n }\n\n setOpenTelemetryContextAsyncContextStrategy();\n\n const scope = getCurrentScope();\n scope.update(options.initialScope);\n\n if (options.spotlight && !options.integrations.some(({ name }) => name === SPOTLIGHT_INTEGRATION_NAME)) {\n options.integrations.push(\n spotlightIntegration({\n sidecarUrl: typeof options.spotlight === 'string' ? options.spotlight : undefined,\n }),\n );\n }\n\n const client = new NodeClient(options);\n // The client is on the current scope, from where it generally is inherited\n getCurrentScope().setClient(client);\n\n client.init();\n\n logger.log(`Running in ${isCjs() ? 'CommonJS' : 'ESM'} mode.`);\n\n client.startClientReportTracking();\n\n updateScopeFromEnvVariables();\n\n // If users opt-out of this, they _have_ to set up OpenTelemetry themselves\n // There is no way to use this SDK without OpenTelemetry!\n if (!options.skipOpenTelemetrySetup) {\n initOpenTelemetry(client, {\n spanProcessors: options.openTelemetrySpanProcessors,\n });\n validateOpenTelemetrySetup();\n }\n\n enhanceDscWithOpenTelemetryRootSpanName(client);\n setupEventContextTrace(client);\n\n return client;\n}\n\n/**\n * Validate that your OpenTelemetry setup is correct.\n */\nexport function validateOpenTelemetrySetup(): void {\n if (!DEBUG_BUILD) {\n return;\n }\n\n const setup = openTelemetrySetupCheck();\n\n const required: ReturnType<typeof openTelemetrySetupCheck> = ['SentryContextManager', 'SentryPropagator'];\n\n if (hasTracingEnabled()) {\n required.push('SentrySpanProcessor');\n }\n\n for (const k of required) {\n if (!setup.includes(k)) {\n logger.error(\n `You have to set up the ${k}. Without this, the OpenTelemetry & Sentry integration will not work properly.`,\n );\n }\n }\n\n if (!setup.includes('SentrySampler')) {\n logger.warn(\n 'You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected. If you use a custom sampler, make sure to use `wrapSamplingDecision`.',\n );\n }\n}\n\nfunction getClientOptions(\n options: NodeOptions,\n getDefaultIntegrationsImpl: (options: Options) => Integration[],\n): NodeClientOptions {\n const release = getRelease(options.release);\n\n if (options.spotlight == null) {\n const spotlightEnv = envToBool(process.env.SENTRY_SPOTLIGHT, { strict: true });\n if (spotlightEnv == null) {\n options.spotlight = process.env.SENTRY_SPOTLIGHT;\n } else {\n options.spotlight = spotlightEnv;\n }\n }\n\n const tracesSampleRate = getTracesSampleRate(options.tracesSampleRate);\n\n const baseOptions = dropUndefinedKeys({\n transport: makeNodeTransport,\n dsn: process.env.SENTRY_DSN,\n environment: process.env.SENTRY_ENVIRONMENT,\n sendClientReports: true,\n });\n\n const overwriteOptions = dropUndefinedKeys({\n release,\n tracesSampleRate,\n });\n\n const mergedOptions = {\n ...baseOptions,\n ...options,\n ...overwriteOptions,\n };\n\n if (options.defaultIntegrations === undefined) {\n options.defaultIntegrations = getDefaultIntegrationsImpl(mergedOptions);\n }\n\n const clientOptions: NodeClientOptions = {\n ...mergedOptions,\n stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),\n integrations: getIntegrationsToSetup({\n defaultIntegrations: options.defaultIntegrations,\n integrations: options.integrations,\n }),\n };\n\n return clientOptions;\n}\n\nfunction getRelease(release: NodeOptions['release']): string | undefined {\n if (release !== undefined) {\n return release;\n }\n\n const detectedRelease = getSentryRelease();\n if (detectedRelease !== undefined) {\n return detectedRelease;\n }\n\n return undefined;\n}\n\nfunction getTracesSampleRate(tracesSampleRate: NodeOptions['tracesSampleRate']): number | undefined {\n if (tracesSampleRate !== undefined) {\n return tracesSampleRate;\n }\n\n const sampleRateFromEnv = process.env.SENTRY_TRACES_SAMPLE_RATE;\n if (!sampleRateFromEnv) {\n return undefined;\n }\n\n const parsed = parseFloat(sampleRateFromEnv);\n return isFinite(parsed) ? parsed : undefined;\n}\n\n/**\n * Update scope and propagation context based on environmental variables.\n *\n * See https://github.com/getsentry/rfcs/blob/main/text/0071-continue-trace-over-process-boundaries.md\n * for more details.\n */\nfunction updateScopeFromEnvVariables(): void {\n if (envToBool(process.env.SENTRY_USE_ENVIRONMENT) !== false) {\n const sentryTraceEnv = process.env.SENTRY_TRACE;\n const baggageEnv = process.env.SENTRY_BAGGAGE;\n const propagationContext = propagationContextFromHeaders(sentryTraceEnv, baggageEnv);\n getCurrentScope().setPropagationContext(propagationContext);\n }\n}\n"],"names":["SPOTLIGHT_INTEGRATION_NAME"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA2CA,SAAS,sBAAsB,GAAkB;AACjD,EAAE,OAAO,KAAK,EAAC,GAAI,CAAC,kBAAkB,EAAE,CAAA,GAAI,EAAE;AAC9C;;AAEA;AACA;AACA;AACO,SAAS,wCA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AAE;AAC5C,EAAE,IAAI,eAAgB,KAAI,SAAS,EAAE;AACrC,IAAI,OAAO,eAAe;AAC1B;;AAEA,EAAE,OAAO,SAAS;AAClB;;AAEA,SAAS,mBAAmB,CAAC,gBAAgB,EAAuD;AACpG,EAAE,IAAI,gBAAiB,KAAI,SAAS,EAAE;AACtC,IAAI,OAAO,gBAAgB;AAC3B;;AAEA,EAAE,MAAM,iBAAkB,GAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB;AACjE,EAAE,IAAI,CAAC,iBAAiB,EAAE;AAC1B,IAAI,OAAO,SAAS;AACpB;;AAEA,EAAE,MAAM,MAAO,GAAE,UAAU,CAAC,iBAAiB,CAAC;AAC9C,EAAE,OAAO,QAAQ,CAAC,MAAM,IAAI,MAAA,GAAS,SAAS;AAC9C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,2BAA2B,GAAS;AAC7C,EAAE,IAAI,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAA,KAAM,KAAK,EAAE;AAC/D,IAAI,MAAM,cAAe,GAAE,OAAO,CAAC,GAAG,CAAC,YAAY;AACnD,IAAI,MAAM,UAAW,GAAE,OAAO,CAAC,GAAG,CAAC,cAAc;AACjD,IAAI,MAAM,qBAAqB,6BAA6B,CAAC,cAAc,EAAE,UAAU,CAAC;AACxF,IAAI,eAAe,EAAE,CAAC,qBAAqB,CAAC,kBAAkB,CAAC;AAC/D;AACA;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/sdk/index.ts"],"sourcesContent":["import type { Integration, Options } from '@sentry/core';\nimport {\n consoleSandbox,\n dropUndefinedKeys,\n functionToStringIntegration,\n getCurrentScope,\n getIntegrationsToSetup,\n hasSpansEnabled,\n inboundFiltersIntegration,\n linkedErrorsIntegration,\n logger,\n propagationContextFromHeaders,\n requestDataIntegration,\n stackParserFromStackParserOptions,\n} from '@sentry/core';\nimport {\n enhanceDscWithOpenTelemetryRootSpanName,\n openTelemetrySetupCheck,\n setOpenTelemetryContextAsyncContextStrategy,\n setupEventContextTrace,\n} from '@sentry/opentelemetry';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { childProcessIntegration } from '../integrations/childProcess';\nimport { consoleIntegration } from '../integrations/console';\nimport { nodeContextIntegration } from '../integrations/context';\nimport { contextLinesIntegration } from '../integrations/contextlines';\nimport { httpIntegration } from '../integrations/http';\nimport { localVariablesIntegration } from '../integrations/local-variables';\nimport { modulesIntegration } from '../integrations/modules';\nimport { nativeNodeFetchIntegration } from '../integrations/node-fetch';\nimport { onUncaughtExceptionIntegration } from '../integrations/onuncaughtexception';\nimport { onUnhandledRejectionIntegration } from '../integrations/onunhandledrejection';\nimport { processSessionIntegration } from '../integrations/processSession';\nimport { INTEGRATION_NAME as SPOTLIGHT_INTEGRATION_NAME, spotlightIntegration } from '../integrations/spotlight';\nimport { getAutoPerformanceIntegrations } from '../integrations/tracing';\nimport { makeNodeTransport } from '../transports';\nimport type { NodeClientOptions, NodeOptions } from '../types';\nimport { isCjs } from '../utils/commonjs';\nimport { envToBool } from '../utils/envToBool';\nimport { defaultStackParser, getSentryRelease } from './api';\nimport { NodeClient } from './client';\nimport { initOpenTelemetry, maybeInitializeEsmLoader } from './initOtel';\n\nfunction getCjsOnlyIntegrations(): Integration[] {\n return isCjs() ? [modulesIntegration()] : [];\n}\n\n/**\n * Get default integrations, excluding performance.\n */\nexport function getDefaultIntegrationsWithoutPerformance(): Integration[] {\n return [\n // Common\n inboundFiltersIntegration(),\n functionToStringIntegration(),\n linkedErrorsIntegration(),\n requestDataIntegration(),\n // Native Wrappers\n consoleIntegration(),\n httpIntegration(),\n nativeNodeFetchIntegration(),\n // Global Handlers\n onUncaughtExceptionIntegration(),\n onUnhandledRejectionIntegration(),\n // Event Info\n contextLinesIntegration(),\n localVariablesIntegration(),\n nodeContextIntegration(),\n childProcessIntegration(),\n processSessionIntegration(),\n ...getCjsOnlyIntegrations(),\n ];\n}\n\n/** Get the default integrations for the Node SDK. */\nexport function getDefaultIntegrations(options: Options): Integration[] {\n return [\n ...getDefaultIntegrationsWithoutPerformance(),\n // We only add performance integrations if tracing is enabled\n // Note that this means that without tracing enabled, e.g. `expressIntegration()` will not be added\n // This means that generally request isolation will work (because that is done by httpIntegration)\n // But `transactionName` will not be set automatically\n ...(hasSpansEnabled(options) ? getAutoPerformanceIntegrations() : []),\n ];\n}\n\n/**\n * Initialize Sentry for Node.\n */\nexport function init(options: NodeOptions | undefined = {}): NodeClient | undefined {\n return _init(options, getDefaultIntegrations);\n}\n\n/**\n * Initialize Sentry for Node, without any integrations added by default.\n */\nexport function initWithoutDefaultIntegrations(options: NodeOptions | undefined = {}): NodeClient {\n return _init(options, () => []);\n}\n\n/**\n * Initialize Sentry for Node, without performance instrumentation.\n */\nfunction _init(\n _options: NodeOptions | undefined = {},\n getDefaultIntegrationsImpl: (options: Options) => Integration[],\n): NodeClient {\n const options = getClientOptions(_options, getDefaultIntegrationsImpl);\n\n if (options.debug === true) {\n if (DEBUG_BUILD) {\n logger.enable();\n } else {\n // use `console.warn` rather than `logger.warn` since by non-debug bundles have all `logger.x` statements stripped\n consoleSandbox(() => {\n // eslint-disable-next-line no-console\n console.warn('[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.');\n });\n }\n }\n\n if (!isCjs() && options.registerEsmLoaderHooks !== false) {\n maybeInitializeEsmLoader();\n }\n\n setOpenTelemetryContextAsyncContextStrategy();\n\n const scope = getCurrentScope();\n scope.update(options.initialScope);\n\n if (options.spotlight && !options.integrations.some(({ name }) => name === SPOTLIGHT_INTEGRATION_NAME)) {\n options.integrations.push(\n spotlightIntegration({\n sidecarUrl: typeof options.spotlight === 'string' ? options.spotlight : undefined,\n }),\n );\n }\n\n const client = new NodeClient(options);\n // The client is on the current scope, from where it generally is inherited\n getCurrentScope().setClient(client);\n\n client.init();\n\n logger.log(`Running in ${isCjs() ? 'CommonJS' : 'ESM'} mode.`);\n\n client.startClientReportTracking();\n\n updateScopeFromEnvVariables();\n\n // If users opt-out of this, they _have_ to set up OpenTelemetry themselves\n // There is no way to use this SDK without OpenTelemetry!\n if (!options.skipOpenTelemetrySetup) {\n initOpenTelemetry(client, {\n spanProcessors: options.openTelemetrySpanProcessors,\n });\n validateOpenTelemetrySetup();\n }\n\n enhanceDscWithOpenTelemetryRootSpanName(client);\n setupEventContextTrace(client);\n\n return client;\n}\n\n/**\n * Validate that your OpenTelemetry setup is correct.\n */\nexport function validateOpenTelemetrySetup(): void {\n if (!DEBUG_BUILD) {\n return;\n }\n\n const setup = openTelemetrySetupCheck();\n\n const required: ReturnType<typeof openTelemetrySetupCheck> = ['SentryContextManager', 'SentryPropagator'];\n\n if (hasSpansEnabled()) {\n required.push('SentrySpanProcessor');\n }\n\n for (const k of required) {\n if (!setup.includes(k)) {\n logger.error(\n `You have to set up the ${k}. Without this, the OpenTelemetry & Sentry integration will not work properly.`,\n );\n }\n }\n\n if (!setup.includes('SentrySampler')) {\n logger.warn(\n 'You have to set up the SentrySampler. Without this, the OpenTelemetry & Sentry integration may still work, but sample rates set for the Sentry SDK will not be respected. If you use a custom sampler, make sure to use `wrapSamplingDecision`.',\n );\n }\n}\n\nfunction getClientOptions(\n options: NodeOptions,\n getDefaultIntegrationsImpl: (options: Options) => Integration[],\n): NodeClientOptions {\n const release = getRelease(options.release);\n\n if (options.spotlight == null) {\n const spotlightEnv = envToBool(process.env.SENTRY_SPOTLIGHT, { strict: true });\n if (spotlightEnv == null) {\n options.spotlight = process.env.SENTRY_SPOTLIGHT;\n } else {\n options.spotlight = spotlightEnv;\n }\n }\n\n const tracesSampleRate = getTracesSampleRate(options.tracesSampleRate);\n\n const baseOptions = dropUndefinedKeys({\n transport: makeNodeTransport,\n dsn: process.env.SENTRY_DSN,\n environment: process.env.SENTRY_ENVIRONMENT,\n sendClientReports: true,\n });\n\n const overwriteOptions = dropUndefinedKeys({\n release,\n tracesSampleRate,\n });\n\n const mergedOptions = {\n ...baseOptions,\n ...options,\n ...overwriteOptions,\n };\n\n if (options.defaultIntegrations === undefined) {\n options.defaultIntegrations = getDefaultIntegrationsImpl(mergedOptions);\n }\n\n const clientOptions: NodeClientOptions = {\n ...mergedOptions,\n stackParser: stackParserFromStackParserOptions(options.stackParser || defaultStackParser),\n integrations: getIntegrationsToSetup({\n defaultIntegrations: options.defaultIntegrations,\n integrations: options.integrations,\n }),\n };\n\n return clientOptions;\n}\n\nfunction getRelease(release: NodeOptions['release']): string | undefined {\n if (release !== undefined) {\n return release;\n }\n\n const detectedRelease = getSentryRelease();\n if (detectedRelease !== undefined) {\n return detectedRelease;\n }\n\n return undefined;\n}\n\nfunction getTracesSampleRate(tracesSampleRate: NodeOptions['tracesSampleRate']): number | undefined {\n if (tracesSampleRate !== undefined) {\n return tracesSampleRate;\n }\n\n const sampleRateFromEnv = process.env.SENTRY_TRACES_SAMPLE_RATE;\n if (!sampleRateFromEnv) {\n return undefined;\n }\n\n const parsed = parseFloat(sampleRateFromEnv);\n return isFinite(parsed) ? parsed : undefined;\n}\n\n/**\n * Update scope and propagation context based on environmental variables.\n *\n * See https://github.com/getsentry/rfcs/blob/main/text/0071-continue-trace-over-process-boundaries.md\n * for more details.\n */\nfunction updateScopeFromEnvVariables(): void {\n if (envToBool(process.env.SENTRY_USE_ENVIRONMENT) !== false) {\n const sentryTraceEnv = process.env.SENTRY_TRACE;\n const baggageEnv = process.env.SENTRY_BAGGAGE;\n const propagationContext = propagationContextFromHeaders(sentryTraceEnv, baggageEnv);\n getCurrentScope().setPropagationContext(propagationContext);\n }\n}\n"],"names":["SPOTLIGHT_INTEGRATION_NAME"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA2CA,SAAS,sBAAsB,GAAkB;AACjD,EAAE,OAAO,KAAK,EAAC,GAAI,CAAC,kBAAkB,EAAE,CAAA,GAAI,EAAE;AAC9C;;AAEA;AACA;AACA;AACO,SAAS,wCAAwC,GAAkB;AAC1E,EAAE,OAAO;AACT;AACA,IAAI,yBAAyB,EAAE;AAC/B,IAAI,2BAA2B,EAAE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AAO,SAAS;AAClB;;AAEA,SAAS,mBAAmB,CAAC,gBAAgB,EAAuD;AACpG,EAAE,IAAI,gBAAiB,KAAI,SAAS,EAAE;AACtC,IAAI,OAAO,gBAAgB;AAC3B;;AAEA,EAAE,MAAM,iBAAkB,GAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB;AACjE,EAAE,IAAI,CAAC,iBAAiB,EAAE;AAC1B,IAAI,OAAO,SAAS;AACpB;;AAEA,EAAE,MAAM,MAAO,GAAE,UAAU,CAAC,iBAAiB,CAAC;AAC9C,EAAE,OAAO,QAAQ,CAAC,MAAM,IAAI,MAAA,GAAS,SAAS;AAC9C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,2BAA2B,GAAS;AAC7C,EAAE,IAAI,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAA,KAAM,KAAK,EAAE;AAC/D,IAAI,MAAM,cAAe,GAAE,OAAO,CAAC,GAAG,CAAC,YAAY;AACnD,IAAI,MAAM,UAAW,GAAE,OAAO,CAAC,GAAG,CAAC,cAAc;AACjD,IAAI,MAAM,qBAAqB,6BAA6B,CAAC,cAAc,EAAE,UAAU,CAAC;AACxF,IAAI,eAAe,EAAE,CAAC,qBAAqB,CAAC,kBAAkB,CAAC;AAC/D;AACA;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { isWrapped } from '@opentelemetry/core';
2
- import { getClient, isEnabled, hasTracingEnabled, consoleSandbox, getGlobalScope } from '@sentry/core';
2
+ import { getClient, isEnabled, hasSpansEnabled, consoleSandbox, getGlobalScope } from '@sentry/core';
3
3
  import { isCjs } from './commonjs.js';
4
4
  import { createMissingInstrumentationContext } from './createMissingInstrumentationContext.js';
5
5
 
@@ -10,12 +10,12 @@ function ensureIsWrapped(
10
10
  maybeWrappedFunction,
11
11
  name,
12
12
  ) {
13
- const client = getClient();
13
+ const clientOptions = getClient()?.getOptions();
14
14
  if (
15
- !client?.getOptions().disableInstrumentationWarnings &&
15
+ !clientOptions?.disableInstrumentationWarnings &&
16
16
  !isWrapped(maybeWrappedFunction) &&
17
17
  isEnabled() &&
18
- hasTracingEnabled()
18
+ hasSpansEnabled(clientOptions)
19
19
  ) {
20
20
  consoleSandbox(() => {
21
21
  if (isCjs()) {
@@ -1 +1 @@
1
- {"version":3,"file":"ensureIsWrapped.js","sources":["../../../src/utils/ensureIsWrapped.ts"],"sourcesContent":["import { isWrapped } from '@opentelemetry/core';\nimport { consoleSandbox, getClient, getGlobalScope, hasTracingEnabled, isEnabled } from '@sentry/core';\nimport type { NodeClient } from '../sdk/client';\nimport { isCjs } from './commonjs';\nimport { createMissingInstrumentationContext } from './createMissingInstrumentationContext';\n\n/**\n * Checks and warns if a framework isn't wrapped by opentelemetry.\n */\nexport function ensureIsWrapped(\n maybeWrappedFunction: unknown,\n name: 'express' | 'connect' | 'fastify' | 'hapi' | 'koa',\n): void {\n const client = getClient<NodeClient>();\n if (\n !client?.getOptions().disableInstrumentationWarnings &&\n !isWrapped(maybeWrappedFunction) &&\n isEnabled() &&\n hasTracingEnabled()\n ) {\n consoleSandbox(() => {\n if (isCjs()) {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] ${name} is not instrumented. This is likely because you required/imported ${name} before calling \\`Sentry.init()\\`.`,\n );\n } else {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] ${name} is not instrumented. Please make sure to initialize Sentry in a separate file that you \\`--import\\` when running node, see: https://docs.sentry.io/platforms/javascript/guides/${name}/install/esm/.`,\n );\n }\n });\n\n getGlobalScope().setContext('missing_instrumentation', createMissingInstrumentationContext(name));\n }\n}\n"],"names":[],"mappings":";;;;;AAMA;AACA;AACA;AACO,SAAS,eAAe;AAC/B,EAAE,oBAAoB;AACtB,EAAE,IAAI;AACN,EAAQ;AACR,EAAE,MAAM,MAAA,GAAS,SAAS,EAAc;AACxC,EAAE;AACF,IAAI,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,8BAA+B;AACzD,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAE;AACrC,IAAI,SAAS,EAAG;AAChB,IAAI,iBAAiB;AACrB,IAAI;AACJ,IAAI,cAAc,CAAC,MAAM;AACzB,MAAM,IAAI,KAAK,EAAE,EAAE;AACnB;AACA,QAAQ,OAAO,CAAC,IAAI;AACpB,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC,mEAAmE,EAAE,IAAI,CAAC,kCAAkC,CAAC;AACxI,SAAS;AACT,aAAa;AACb;AACA,QAAQ,OAAO,CAAC,IAAI;AACpB,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC,gLAAgL,EAAE,IAAI,CAAC,cAAc,CAAC;AACjO,SAAS;AACT;AACA,KAAK,CAAC;;AAEN,IAAI,cAAc,EAAE,CAAC,UAAU,CAAC,yBAAyB,EAAE,mCAAmC,CAAC,IAAI,CAAC,CAAC;AACrG;AACA;;;;"}
1
+ {"version":3,"file":"ensureIsWrapped.js","sources":["../../../src/utils/ensureIsWrapped.ts"],"sourcesContent":["import { isWrapped } from '@opentelemetry/core';\nimport { consoleSandbox, getClient, getGlobalScope, hasSpansEnabled, isEnabled } from '@sentry/core';\nimport type { NodeClient } from '../sdk/client';\nimport { isCjs } from './commonjs';\nimport { createMissingInstrumentationContext } from './createMissingInstrumentationContext';\n\n/**\n * Checks and warns if a framework isn't wrapped by opentelemetry.\n */\nexport function ensureIsWrapped(\n maybeWrappedFunction: unknown,\n name: 'express' | 'connect' | 'fastify' | 'hapi' | 'koa',\n): void {\n const clientOptions = getClient<NodeClient>()?.getOptions();\n if (\n !clientOptions?.disableInstrumentationWarnings &&\n !isWrapped(maybeWrappedFunction) &&\n isEnabled() &&\n hasSpansEnabled(clientOptions)\n ) {\n consoleSandbox(() => {\n if (isCjs()) {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] ${name} is not instrumented. This is likely because you required/imported ${name} before calling \\`Sentry.init()\\`.`,\n );\n } else {\n // eslint-disable-next-line no-console\n console.warn(\n `[Sentry] ${name} is not instrumented. Please make sure to initialize Sentry in a separate file that you \\`--import\\` when running node, see: https://docs.sentry.io/platforms/javascript/guides/${name}/install/esm/.`,\n );\n }\n });\n\n getGlobalScope().setContext('missing_instrumentation', createMissingInstrumentationContext(name));\n }\n}\n"],"names":[],"mappings":";;;;;AAMA;AACA;AACA;AACO,SAAS,eAAe;AAC/B,EAAE,oBAAoB;AACtB,EAAE,IAAI;AACN,EAAQ;AACR,EAAE,MAAM,gBAAgB,SAAS,EAAc,EAAE,UAAU,EAAE;AAC7D,EAAE;AACF,IAAI,CAAC,aAAa,EAAE,8BAA+B;AACnD,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAE;AACrC,IAAI,SAAS,EAAG;AAChB,IAAI,eAAe,CAAC,aAAa;AACjC,IAAI;AACJ,IAAI,cAAc,CAAC,MAAM;AACzB,MAAM,IAAI,KAAK,EAAE,EAAE;AACnB;AACA,QAAQ,OAAO,CAAC,IAAI;AACpB,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC,mEAAmE,EAAE,IAAI,CAAC,kCAAkC,CAAC;AACxI,SAAS;AACT,aAAa;AACb;AACA,QAAQ,OAAO,CAAC,IAAI;AACpB,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC,gLAAgL,EAAE,IAAI,CAAC,cAAc,CAAC;AACjO,SAAS;AACT;AACA,KAAK,CAAC;;AAEN,IAAI,cAAc,EAAE,CAAC,UAAU,CAAC,yBAAyB,EAAE,mCAAmC,CAAC,IAAI,CAAC,CAAC;AACrG;AACA;;;;"}
@@ -50,6 +50,7 @@ type SentryHttpInstrumentationOptions = InstrumentationConfig & {
50
50
  * https://github.com/open-telemetry/opentelemetry-js/blob/f8ab5592ddea5cba0a3b33bf8d74f27872c0367f/experimental/packages/opentelemetry-instrumentation-http/src/http.ts
51
51
  */
52
52
  export declare class SentryHttpInstrumentation extends InstrumentationBase<SentryHttpInstrumentationOptions> {
53
+ private _propagationDecisionMap;
53
54
  constructor(config?: SentryHttpInstrumentationOptions);
54
55
  /** @inheritdoc */
55
56
  init(): [InstrumentationNodeModuleDefinition, InstrumentationNodeModuleDefinition];
@@ -1 +1 @@
1
- {"version":3,"file":"SentryHttpInstrumentation.d.ts","sourceRoot":"","sources":["../../../../src/integrations/http/SentryHttpInstrumentation.ts"],"names":[],"mappings":";;AAEA,OAAO,KAAK,EAAmB,cAAc,EAAE,MAAM,WAAW,CAAC;AAEjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,mCAAmC,EAAE,MAAM,gCAAgC,CAAC;AAC1G,OAAO,KAAK,EAAqE,KAAK,EAAE,MAAM,cAAc,CAAC;AAsB7G,KAAK,gCAAgC,GAAG,qBAAqB,GAAG;IAC9D;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;;;;;OAQG;IACH,sBAAsB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC;IAE3E;;;;;OAKG;IACH,+BAA+B,CAAC,EAAE,OAAO,CAAC;IAE1C;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC,CAAC;AAKF;;;;;;;;;;;;GAYG;AACH,qBAAa,yBAA0B,SAAQ,mBAAmB,CAAC,gCAAgC,CAAC;gBAC/E,MAAM,GAAE,gCAAqC;IAIhE,kBAAkB;IACX,IAAI,IAAI,CAAC,mCAAmC,EAAE,mCAAmC,CAAC;IAIzF,mDAAmD;IACnD,OAAO,CAAC,uBAAuB;IAoB/B,oDAAoD;IACpD,OAAO,CAAC,wBAAwB;IAoBhC;;OAEG;IACH,OAAO,CAAC,gCAAgC;IA4DxC;;OAEG;IACH,OAAO,CAAC,gCAAgC;IAgDxC,sDAAsD;IAEtD,OAAO,CAAC,4BAA4B;CAmBrC;AA+LD;;;;;;;;GAQG;AAEH,wBA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BhC;;OAEG;IACH,OAAO,CAAC,gCAAgC;IA4DxC;;OAEG;IACH,OAAO,CAAC,gCAAgC;IA0DxC,sDAAsD;IAEtD,OAAO,CAAC,4BAA4B;CAmBrC;AAqOD;;;;;;;;GAQG;AAEH,wBAAgB,oBAAoB,CAAC,EACnC,qBAAqB,EACrB,QAAQ,EACR,sBAAsB,GACvB,EAAE;IAAE,qBAAqB,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,YAAY,CAAC;IAAC,sBAAsB,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAsDlG"}
@@ -0,0 +1,38 @@
1
+ import type { Context, Span, SpanOptions } from '@opentelemetry/api';
2
+ type V5SpanCallback<R> = (span?: Span, context?: Context) => R;
3
+ type V5ExtendedSpanOptions = SpanOptions & {
4
+ name: string;
5
+ internal?: boolean;
6
+ middleware?: boolean;
7
+ active?: boolean;
8
+ context?: Context;
9
+ };
10
+ type EngineSpanEvent = {
11
+ span: boolean;
12
+ spans: V5EngineSpan[];
13
+ };
14
+ type V5EngineSpanKind = 'client' | 'internal';
15
+ type V5EngineSpan = {
16
+ span: boolean;
17
+ name: string;
18
+ trace_id: string;
19
+ span_id: string;
20
+ parent_span_id: string;
21
+ start_time: [number, number];
22
+ end_time: [number, number];
23
+ attributes?: Record<string, string>;
24
+ links?: {
25
+ trace_id: string;
26
+ span_id: string;
27
+ }[];
28
+ kind: V5EngineSpanKind;
29
+ };
30
+ export interface PrismaV5TracingHelper {
31
+ isEnabled(): boolean;
32
+ getTraceParent(context?: Context): string;
33
+ createEngineSpan(engineSpanEvent: EngineSpanEvent): void;
34
+ getActiveContext(): Context | undefined;
35
+ runInChildSpan<R>(nameOrOptions: string | V5ExtendedSpanOptions, callback: V5SpanCallback<R>): R;
36
+ }
37
+ export {};
38
+ //# sourceMappingURL=v5-tracing-helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v5-tracing-helper.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations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AAC;IAC1C,gBAAgB,CAAC,eAAe,EAAE,eAAe,GAAG,IAAI,CAAC;IACzD,gBAAgB,IAAI,OAAO,GAAG,SAAS,CAAC;IACxC,cAAc,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,GAAG,qBAAqB,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CAClG"}
@@ -0,0 +1,31 @@
1
+ import type { Context, Span, SpanOptions } from '@opentelemetry/api';
2
+ type V6SpanCallback<R> = (span?: Span, context?: Context) => R;
3
+ type V6ExtendedSpanOptions = SpanOptions & {
4
+ name: string;
5
+ internal?: boolean;
6
+ middleware?: boolean;
7
+ active?: boolean;
8
+ context?: Context;
9
+ };
10
+ type V6EngineSpanId = string;
11
+ type V6HrTime = [number, number];
12
+ type EngineSpanKind = 'client' | 'internal';
13
+ type PrismaV6EngineSpan = {
14
+ id: V6EngineSpanId;
15
+ parentId: string | null;
16
+ name: string;
17
+ startTime: V6HrTime;
18
+ endTime: V6HrTime;
19
+ kind: EngineSpanKind;
20
+ attributes?: Record<string, unknown>;
21
+ links?: V6EngineSpanId[];
22
+ };
23
+ export interface PrismaV6TracingHelper {
24
+ isEnabled(): boolean;
25
+ getTraceParent(context?: Context): string;
26
+ dispatchEngineSpans(spans: PrismaV6EngineSpan[]): void;
27
+ getActiveContext(): Context | undefined;
28
+ runInChildSpan<R>(nameOrOptions: string | V6ExtendedSpanOptions, callback: V6SpanCallback<R>): R;
29
+ }
30
+ export {};
31
+ //# sourceMappingURL=v6-tracing-helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v6-tracing-helper.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/tracing/prisma/vendor/v6-tracing-helper.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAErE,KAAK,cAAc,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EA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"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAQtE,eAAO,MAAM,gBAAgB;;;;CAe5B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,iBAAiB;IAI1B;;;;;;OAMG;;oDA6BN,CAAC"}
1
+ {"version":3,"file":"prisma.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tracing/prisma.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AA0DtE,eAAO,MAAM,gBAAgB;;;;CAU5B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,iBAAiB;IAI1B;;;;;;OAMG;;oDA6BN,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing/vercelai/index.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,kBAAkB;;CAAkF,CAAC;AAmJlH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,mBAAmB,0CAA0C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/tracing/vercelai/index.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,kBAAkB;;CAAwF,CAAC;AAmJxH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,mBAAmB,0CAA0C,CAAC"}
@@ -105,6 +105,13 @@ export interface BaseNodeOptions {
105
105
  * If you want to disable these warnings, set this to `true`.
106
106
  */
107
107
  disableInstrumentationWarnings?: boolean;
108
+ /**
109
+ * Controls how many milliseconds to wait before shutting down. The default is 2 seconds. Setting this too low can cause
110
+ * problems for sending events from command line applications. Setting it too
111
+ * high can cause the application to block for users with network connectivity
112
+ * problems.
113
+ */
114
+ shutdownTimeout?: number;
108
115
  /** Callback that is executed when a fatal global error occurs. */
109
116
  onFatalError?(this: void, error: Error): void;
110
117
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,IAAI,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAElH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;;;;;;OAeG;IACH,uBAAuB,CAAC,EAAE,uBAAuB,CAAC;IAElD;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;;;;;;;;;OAUG;IACH,eAAe,CAAC,EAAE,CAAC,eAAe,EAAE,eAAe,KAAK,MAAM,GAAG,OAAO,CAAC;IAEzE,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAE7B;;;;;;;;;OASG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC;;;;OAIG;IACH,6BAA6B,CAAC,EAAE,eAAe,EAAE,CAAC;IAElD;;OAEG;IACH,2BAA2B,CAAC,EAAE,aAAa,EAAE,CAAC;IAE9C;;;;;;;;OAQG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;;;;;OAOG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC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AAO,CAAC;IAEzE,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAE7B;;;;;;;;;OASG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC;;;;OAIG;IACH,6BAA6B,CAAC,EAAE,eAAe,EAAE,CAAC;IAElD;;OAEG;IACH,2BAA2B,CAAC,EAAE,aAAa,EAAE,CAAC;IAE9C;;;;;;;;OAQG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;;;;;OAOG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC;;OAEG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;IAEnC;;;OAGG;IACH,8BAA8B,CAAC,EAAE,OAAO,CAAC;IAEzC;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,kEAAkE;IAClE,YAAY,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CAC/C;AAED;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,OAAO,CAAC,oBAAoB,CAAC,EAAE,eAAe;CAAG;AAEtF;;;GAGG;AACH,MAAM,WAAW,iBAAkB,SAAQ,aAAa,CAAC,oBAAoB,CAAC,EAAE,eAAe;CAAG;AAElG,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,KAAK,CAAC;IACb,cAAc,EAAE,KAAK,CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,YAAY,GAAG,IAAI,CAAC"}
@@ -49,6 +49,7 @@ type SentryHttpInstrumentationOptions = InstrumentationConfig & {
49
49
  * https://github.com/open-telemetry/opentelemetry-js/blob/f8ab5592ddea5cba0a3b33bf8d74f27872c0367f/experimental/packages/opentelemetry-instrumentation-http/src/http.ts
50
50
  */
51
51
  export declare class SentryHttpInstrumentation extends InstrumentationBase<SentryHttpInstrumentationOptions> {
52
+ private _propagationDecisionMap;
52
53
  constructor(config?: SentryHttpInstrumentationOptions);
53
54
  /** @inheritdoc */
54
55
  init(): [
@@ -0,0 +1,44 @@
1
+ import { Context, Span, SpanOptions } from '@opentelemetry/api';
2
+ type V5SpanCallback<R> = (span?: Span, context?: Context) => R;
3
+ type V5ExtendedSpanOptions = SpanOptions & {
4
+ name: string;
5
+ internal?: boolean;
6
+ middleware?: boolean;
7
+ active?: boolean;
8
+ context?: Context;
9
+ };
10
+ type EngineSpanEvent = {
11
+ span: boolean;
12
+ spans: V5EngineSpan[];
13
+ };
14
+ type V5EngineSpanKind = 'client' | 'internal';
15
+ type V5EngineSpan = {
16
+ span: boolean;
17
+ name: string;
18
+ trace_id: string;
19
+ span_id: string;
20
+ parent_span_id: string;
21
+ start_time: [
22
+ number,
23
+ number
24
+ ];
25
+ end_time: [
26
+ number,
27
+ number
28
+ ];
29
+ attributes?: Record<string, string>;
30
+ links?: {
31
+ trace_id: string;
32
+ span_id: string;
33
+ }[];
34
+ kind: V5EngineSpanKind;
35
+ };
36
+ export interface PrismaV5TracingHelper {
37
+ isEnabled(): boolean;
38
+ getTraceParent(context?: Context): string;
39
+ createEngineSpan(engineSpanEvent: EngineSpanEvent): void;
40
+ getActiveContext(): Context | undefined;
41
+ runInChildSpan<R>(nameOrOptions: string | V5ExtendedSpanOptions, callback: V5SpanCallback<R>): R;
42
+ }
43
+ export {};
44
+ //# sourceMappingURL=v5-tracing-helper.d.ts.map
@@ -0,0 +1,34 @@
1
+ import { Context, Span, SpanOptions } from '@opentelemetry/api';
2
+ type V6SpanCallback<R> = (span?: Span, context?: Context) => R;
3
+ type V6ExtendedSpanOptions = SpanOptions & {
4
+ name: string;
5
+ internal?: boolean;
6
+ middleware?: boolean;
7
+ active?: boolean;
8
+ context?: Context;
9
+ };
10
+ type V6EngineSpanId = string;
11
+ type V6HrTime = [
12
+ number,
13
+ number
14
+ ];
15
+ type EngineSpanKind = 'client' | 'internal';
16
+ type PrismaV6EngineSpan = {
17
+ id: V6EngineSpanId;
18
+ parentId: string | null;
19
+ name: string;
20
+ startTime: V6HrTime;
21
+ endTime: V6HrTime;
22
+ kind: EngineSpanKind;
23
+ attributes?: Record<string, unknown>;
24
+ links?: V6EngineSpanId[];
25
+ };
26
+ export interface PrismaV6TracingHelper {
27
+ isEnabled(): boolean;
28
+ getTraceParent(context?: Context): string;
29
+ dispatchEngineSpans(spans: PrismaV6EngineSpan[]): void;
30
+ getActiveContext(): Context | undefined;
31
+ runInChildSpan<R>(nameOrOptions: string | V6ExtendedSpanOptions, callback: V6SpanCallback<R>): R;
32
+ }
33
+ export {};
34
+ //# sourceMappingURL=v6-tracing-helper.d.ts.map