@sentry/server-utils 11.15.0 → 11.17.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/chunks/config.js +60 -0
- package/build/cjs/chunks/config.js.map +1 -1
- package/build/cjs/chunks/exports.js +194 -58
- package/build/cjs/chunks/exports.js.map +1 -1
- package/build/cjs/chunks/moduleInjectedTransform.js +8 -0
- package/build/cjs/chunks/moduleInjectedTransform.js.map +1 -1
- package/build/cjs/index.js +299 -168
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.request-handler.js +1 -0
- package/build/cjs/index.request-handler.js.map +1 -1
- package/build/esm/ai/flue/utils.js +1 -0
- package/build/esm/ai/flue/utils.js.map +1 -1
- package/build/esm/ai/google-genai/decisions.js +29 -1
- package/build/esm/ai/google-genai/decisions.js.map +1 -1
- package/build/esm/ai/langchain/embeddings.js +23 -8
- package/build/esm/ai/langchain/embeddings.js.map +1 -1
- package/build/esm/ai/langchain/index.js +41 -30
- package/build/esm/ai/langchain/index.js.map +1 -1
- package/build/esm/ai/langgraph/agent-span.js +6 -2
- package/build/esm/ai/langgraph/agent-span.js.map +1 -1
- package/build/esm/ai/langgraph/index.js +5 -1
- package/build/esm/ai/langgraph/index.js.map +1 -1
- package/build/esm/ai/langgraph/stream.js +4 -1
- package/build/esm/ai/langgraph/stream.js.map +1 -1
- package/build/esm/ai/openai/mapping.js +48 -1
- package/build/esm/ai/openai/mapping.js.map +1 -1
- package/build/esm/ai/pi-durable/index.js +10 -13
- package/build/esm/ai/pi-durable/index.js.map +1 -1
- package/build/esm/ai/pi-durable/runs.js +6 -5
- package/build/esm/ai/pi-durable/runs.js.map +1 -1
- package/build/esm/ai/pi-durable/tools.js +21 -17
- package/build/esm/ai/pi-durable/tools.js.map +1 -1
- package/build/esm/index.js +3 -2
- package/build/esm/index.js.map +1 -1
- package/build/esm/integrations/clickhouse-sql.js +31 -0
- package/build/esm/integrations/clickhouse-sql.js.map +1 -0
- package/build/esm/integrations/clickhouse.js +88 -0
- package/build/esm/integrations/clickhouse.js.map +1 -0
- package/build/esm/integrations/express/instrumentation.js +1 -0
- package/build/esm/integrations/express/instrumentation.js.map +1 -1
- package/build/esm/integrations/fastify/instrumentation.js +3 -1
- package/build/esm/integrations/fastify/instrumentation.js.map +1 -1
- package/build/esm/integrations/hapi/index.js +15 -1
- package/build/esm/integrations/hapi/index.js.map +1 -1
- package/build/esm/integrations/index.js +2 -0
- package/build/esm/integrations/index.js.map +1 -1
- package/build/esm/integrations/langchain.js +10 -3
- package/build/esm/integrations/langchain.js.map +1 -1
- package/build/esm/orchestrion/channels.js +2 -0
- package/build/esm/orchestrion/channels.js.map +1 -1
- package/build/esm/orchestrion/config/channel-integration-definitions.js +8 -0
- package/build/esm/orchestrion/config/channel-integration-definitions.js.map +1 -1
- package/build/esm/orchestrion/config/clickhouse.js +51 -0
- package/build/esm/orchestrion/config/clickhouse.js.map +1 -0
- package/build/esm/orchestrion/config/index.js +2 -0
- package/build/esm/orchestrion/config/index.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/utils/sql.js +37 -16
- package/build/esm/utils/sql.js.map +1 -1
- package/build/esm/utils/wrapServerRequestHandler.js +2 -1
- package/build/esm/utils/wrapServerRequestHandler.js.map +1 -1
- package/build/types/ai/flue/utils.d.ts.map +1 -1
- package/build/types/ai/google-genai/decisions.d.ts.map +1 -1
- package/build/types/ai/langchain/embeddings.d.ts +2 -2
- package/build/types/ai/langchain/embeddings.d.ts.map +1 -1
- package/build/types/ai/langchain/index.d.ts.map +1 -1
- package/build/types/ai/langchain/types.d.ts +8 -4
- package/build/types/ai/langchain/types.d.ts.map +1 -1
- package/build/types/ai/langgraph/agent-span.d.ts +5 -2
- package/build/types/ai/langgraph/agent-span.d.ts.map +1 -1
- package/build/types/ai/langgraph/index.d.ts.map +1 -1
- package/build/types/ai/langgraph/stream.d.ts.map +1 -1
- package/build/types/ai/langgraph/types.d.ts +10 -2
- package/build/types/ai/langgraph/types.d.ts.map +1 -1
- package/build/types/ai/openai/mapping.d.ts.map +1 -1
- package/build/types/ai/pi-durable/index.d.ts.map +1 -1
- package/build/types/ai/pi-durable/runs.d.ts +4 -2
- package/build/types/ai/pi-durable/runs.d.ts.map +1 -1
- package/build/types/ai/pi-durable/tools.d.ts +4 -6
- package/build/types/ai/pi-durable/tools.d.ts.map +1 -1
- package/build/types/ai/pi-durable/types.d.ts +10 -1
- package/build/types/ai/pi-durable/types.d.ts.map +1 -1
- package/build/types/ai/types.d.ts +1 -1
- package/build/types/ai/types.d.ts.map +1 -1
- package/build/types/index.d.ts +2 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/integrations/clickhouse-sql.d.ts +8 -0
- package/build/types/integrations/clickhouse-sql.d.ts.map +1 -0
- package/build/types/integrations/clickhouse.d.ts +11 -0
- package/build/types/integrations/clickhouse.d.ts.map +1 -0
- package/build/types/integrations/express/types.d.ts +1 -0
- package/build/types/integrations/express/types.d.ts.map +1 -1
- package/build/types/integrations/fastify/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/hapi/index.d.ts +12 -0
- package/build/types/integrations/hapi/index.d.ts.map +1 -1
- package/build/types/integrations/index.d.ts.map +1 -1
- package/build/types/integrations/langchain.d.ts.map +1 -1
- package/build/types/orchestrion/channels.d.ts +12 -0
- package/build/types/orchestrion/channels.d.ts.map +1 -1
- package/build/types/orchestrion/config/channel-integration-definitions.d.ts +3 -0
- package/build/types/orchestrion/config/channel-integration-definitions.d.ts.map +1 -1
- package/build/types/orchestrion/config/clickhouse.d.ts +18 -0
- package/build/types/orchestrion/config/clickhouse.d.ts.map +1 -0
- package/build/types/orchestrion/config/index.d.ts.map +1 -1
- package/build/types/utils/sql.d.ts +28 -3
- package/build/types/utils/sql.d.ts.map +1 -1
- package/build/types/utils/wrapServerRequestHandler.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","names":["diagnosticsChannel.subscribe"],"sources":["../../../../src/integrations/fastify/instrumentation.ts"],"sourcesContent":["/*\n * Copyright (c) 2024-present The Fastify team <https://github.com/fastify/fastify#team>\n * SPDX-License-Identifier: MIT\n *\n * NOTICE from the Sentry authors:\n * - Based on: https://github.com/fastify/otel/tree/bae80d6caef4287e7f01ff3c8dc753243706ea86 (@fastify/otel@0.18.1)\n * - Streamlined to the Sentry SDK's needs: dropped the `InstrumentationBase` wrapper, the unused\n * request/lifecycle hooks, `ignorePaths`/`minimatch` support and the OpenTelemetry tracer/context\n * APIs in favor of the Sentry span API.\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-this-alias */\n/* eslint-disable max-lines */\n\nimport * as diagnosticsChannel from '../../utils/diagnosticsChannel';\nimport {\n HTTP_REQUEST_METHOD,\n HTTP_RESPONSE_STATUS_CODE,\n HTTP_ROUTE,\n SENTRY_OP,\n URL_PATH,\n SENTRY_ORIGIN,\n} from '@sentry/conventions/attributes';\nimport { HANDLER, MIDDLEWARE } from '@sentry/conventions/op';\nimport type { Span } from '@sentry/core';\nimport {\n isObjectLike,\n getClient,\n getIsolationScope,\n hasSpanStreamingEnabled,\n REQUEST_HANDLER_SPAN_NAME_FALLBACK,\n SPAN_STATUS_ERROR,\n startInactiveSpan,\n startSpan,\n withActiveSpan,\n} from '@sentry/core';\nimport type { FastifyInstance } from './types';\nimport { setHttpServerSpanRouteAttribute } from '../../utils/setHttpServerSpanRouteAttribute';\nimport { handleFastifyError } from './errors';\n\nconst ORIGIN = 'auto.http.fastify';\n\nconst FASTIFY_HOOKS = [\n 'onRequest',\n 'preParsing',\n 'preValidation',\n 'preHandler',\n 'preSerialization',\n 'onSend',\n 'onResponse',\n 'onError',\n];\nconst ATTRIBUTE_HOOK_NAME = 'hook.name' as const;\nconst ATTRIBUTE_FASTIFY_TYPE = 'fastify.type' as const;\nconst ATTRIBUTE_HOOK_CALLBACK_NAME = 'hook.callback.name' as const;\n\nconst HOOK_TYPE_ROUTE = 'route-hook' as const;\nconst HOOK_TYPE_INSTANCE = 'hook' as const;\nconst HOOK_TYPE_HANDLER = 'request-handler' as const;\nconst ANONYMOUS_FUNCTION_NAME = 'anonymous';\n\nconst kRequestSpan = Symbol('sentry fastify request span');\nconst kAddHookOriginal = Symbol('sentry fastify addHook original');\nconst kSetNotFoundOriginal = Symbol('sentry fastify setNotFoundHandler original');\n\ntype AnyFn = (...args: any[]) => any;\n\n/**\n * Read the matched route URL off a request. Fastify >=4 exposes it on `request.routeOptions.url`,\n * while v3 only has the (since-removed-in-v5) `request.routerPath`.\n */\nfunction getRequestRouteUrl(request: any): string | undefined {\n return request.routeOptions?.url ?? request.routerPath;\n}\n\n/**\n * Detect whether one of a wrapped handler's arguments is the Fastify request. We can't rely on a\n * single property since the route metadata moved from `routerPath` (v3) to `routeOptions` (>=4),\n * so we accept either shape.\n */\nfunction isFastifyRequest(arg: any): boolean {\n return isObjectLike(arg) && !!arg.method && !!arg.url && (!!arg.routeOptions || 'routerPath' in arg);\n}\n\n/**\n * Wire up the request/hook/handler spans and error handling on a Fastify instance.\n *\n * This runs synchronously from the `fastify.initialization` diagnostics channel, which fires while\n * `Fastify()` is still constructing the instance, before any user code runs. Doing it synchronously\n * (rather than via `instance.register()`, which defers the work until the boot phase) is what lets us\n * patch `addHook`/`setNotFoundHandler` in time: `addHook` runs immediately, so hooks a user adds\n * synchronously before `listen()`/`ready()` would otherwise slip through un-instrumented.\n */\nfunction instrumentFastifyInstance(instance: FastifyInstance): void {\n // oxlint-disable-next-line typescript/unbound-method\n instance.decorate(kAddHookOriginal, instance.addHook);\n instance.decorate(kSetNotFoundOriginal, instance.setNotFoundHandler);\n instance.decorateRequest('opentelemetry', function opentelemetry(this: any) {\n return { span: this[kRequestSpan] as Span | null };\n });\n instance.decorateRequest(kRequestSpan, null);\n\n instance.addHook('onRoute', onRoute);\n instance.addHook('onRequest', onRequest);\n instance.addHook('onResponse', onResponse);\n // Must be an async hook: a sync (callback-style) `onError` hook would have to invoke Fastify's\n // `done` callback\n instance.addHook('onError', async (request, reply, error) => {\n handleFastifyError(request, reply, error);\n });\n\n // Patch last, so the hooks we add above go through the original (un-wrapped) `addHook`.\n instance.addHook = addHookPatched;\n instance.setNotFoundHandler = setNotFoundHandlerPatched;\n}\n\nfunction onRoute(this: any, routeOptions: any): void {\n for (const hook of FASTIFY_HOOKS) {\n const handlerLike = routeOptions[hook];\n\n if (typeof handlerLike === 'function') {\n routeOptions[hook] = handlerWrapper(\n handlerLike,\n hook,\n routeHookAttributes(this.pluginName, hook, handlerLike, routeOptions.url),\n );\n } else if (Array.isArray(handlerLike)) {\n routeOptions[hook] = handlerLike.map((handler: AnyFn) =>\n handlerWrapper(handler, hook, routeHookAttributes(this.pluginName, hook, handler, routeOptions.url)),\n );\n }\n }\n\n routeOptions.onSend = appendRouteHook(routeOptions.onSend, finalizeResponseSpanHook);\n routeOptions.onError = appendRouteHook(routeOptions.onError, recordErrorInSpanHook);\n\n routeOptions.handler = handlerWrapper(routeOptions.handler, 'handler', {\n [ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - route-handler`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_HANDLER,\n [HTTP_ROUTE]: routeOptions.url,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]:\n routeOptions.handler.name.length > 0 ? routeOptions.handler.name : ANONYMOUS_FUNCTION_NAME,\n });\n}\n\nfunction routeHookAttributes(pluginName: string, hook: string, handler: AnyFn, url: string): Record<string, string> {\n return {\n [ATTRIBUTE_HOOK_NAME]: `${pluginName} - route -> ${hook}`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_ROUTE,\n [HTTP_ROUTE]: url,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]: handler.name?.length > 0 ? handler.name : ANONYMOUS_FUNCTION_NAME,\n };\n}\n\nfunction appendRouteHook(existing: AnyFn | AnyFn[] | undefined, hook: AnyFn): AnyFn | AnyFn[] {\n if (existing == null) {\n return hook;\n }\n return Array.isArray(existing) ? [...existing, hook] : [existing, hook];\n}\n\nfunction onRequest(this: any, request: any, _reply: any, hookDone: () => void): void {\n const routeName = getRequestRouteUrl(request);\n const method = request.method || 'GET';\n\n getIsolationScope().setTransactionName(`${method} ${routeName}`);\n\n const attributes: Record<string, string> = {\n [SENTRY_ORIGIN]: ORIGIN,\n [SENTRY_OP]: HANDLER,\n [HTTP_REQUEST_METHOD]: request.method,\n [URL_PATH]: request.url,\n };\n\n const route = getRequestRouteUrl(request);\n if (route != null) {\n attributes[HTTP_ROUTE] = route;\n\n setHttpServerSpanRouteAttribute(route);\n }\n\n const client = getClient();\n // With span streaming, span names have to be low cardinality, so request handler\n // spans are named after their route alone, without the method prefix.\n const isStreamedSpan = !!client && hasSpanStreamingEnabled(client);\n\n const requestSpan = startInactiveSpan({\n name: isStreamedSpan\n ? route || REQUEST_HANDLER_SPAN_NAME_FALLBACK\n : route != null\n ? `${request.method} ${route}`\n : 'request',\n attributes,\n });\n request[kRequestSpan] = requestSpan;\n\n // Set the request span as the active span for the remainder of the request lifecycle, so that\n // downstream hooks/handlers as well as errors captured via the error diagnostics channel are\n // parented to it (otherwise they would attach to the root `http.server` span instead).\n withActiveSpan(requestSpan, () => {\n hookDone();\n });\n}\n\nfunction onResponse(request: any, reply: any, hookDone: () => void): void {\n const span = request[kRequestSpan] as Span | null;\n\n if (span != null) {\n span.setAttributes({ [HTTP_RESPONSE_STATUS_CODE]: reply.statusCode });\n span.end();\n }\n\n request[kRequestSpan] = null;\n\n hookDone();\n}\n\nfunction finalizeResponseSpanHook(\n request: any,\n reply: any,\n payload: any,\n hookDone: (err: null, payload: any) => void,\n): void {\n const span = request[kRequestSpan] as Span | null;\n\n if (span != null) {\n if (reply.statusCode >= 500) {\n span.setStatus({ code: SPAN_STATUS_ERROR });\n }\n span.setAttributes({ [HTTP_RESPONSE_STATUS_CODE]: reply.statusCode });\n span.end();\n }\n\n request[kRequestSpan] = null;\n\n hookDone(null, payload);\n}\n\nfunction recordErrorInSpanHook(request: any, _reply: any, error: any, hookDone: () => void): void {\n const span = request[kRequestSpan] as Span | null;\n\n if (span != null) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: error.message });\n }\n\n hookDone();\n}\n\nfunction addHookPatched(this: any, name: string, hook: AnyFn): FastifyInstance {\n const addHookOriginal = this[kAddHookOriginal];\n\n if (FASTIFY_HOOKS.includes(name)) {\n return addHookOriginal.call(\n this,\n name,\n handlerWrapper(hook, name, {\n [ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - ${name}`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_INSTANCE,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]: hook.name?.length > 0 ? hook.name : ANONYMOUS_FUNCTION_NAME,\n }),\n );\n }\n\n return addHookOriginal.call(this, name, hook);\n}\n\nfunction setNotFoundHandlerPatched(this: any, hooks: any, handler?: any): void {\n const setNotFoundHandlerOriginal = this[kSetNotFoundOriginal];\n\n if (typeof hooks === 'function') {\n setNotFoundHandlerOriginal.call(\n this,\n handlerWrapper(hooks, 'notFoundHandler', {\n [ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - not-found-handler`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_INSTANCE,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]: hooks.name?.length > 0 ? hooks.name : ANONYMOUS_FUNCTION_NAME,\n }),\n );\n return;\n }\n\n if (hooks.preValidation != null) {\n hooks.preValidation = handlerWrapper(hooks.preValidation, 'notFoundHandler - preValidation', {\n [ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - not-found-handler - preValidation`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_INSTANCE,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]:\n hooks.preValidation.name?.length > 0 ? hooks.preValidation.name : ANONYMOUS_FUNCTION_NAME,\n });\n }\n\n if (hooks.preHandler != null) {\n hooks.preHandler = handlerWrapper(hooks.preHandler, 'notFoundHandler - preHandler', {\n [ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - not-found-handler - preHandler`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_INSTANCE,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]:\n hooks.preHandler.name?.length > 0 ? hooks.preHandler.name : ANONYMOUS_FUNCTION_NAME,\n });\n }\n\n // Fastify allows `setNotFoundHandler(opts)` without a handler, falling back to its built-in 404\n // handler. Forward the (already-wrapped) hooks unchanged so that fallback still applies.\n if (handler == null) {\n setNotFoundHandlerOriginal.call(this, hooks);\n return;\n }\n\n setNotFoundHandlerOriginal.call(\n this,\n hooks,\n handlerWrapper(handler, 'notFoundHandler', {\n [ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - not-found-handler`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_INSTANCE,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]: handler.name?.length > 0 ? handler.name : ANONYMOUS_FUNCTION_NAME,\n }),\n );\n}\n\nfunction getRequestFromArgs(args: any[]): any | null {\n for (const arg of args) {\n if (isFastifyRequest(arg)) {\n return arg;\n }\n }\n return null;\n}\n\nfunction handlerWrapper(handler: AnyFn, hookName: string, spanAttributes: Record<string, string> = {}): AnyFn {\n return function handlerWrapped(this: any, ...args: any[]) {\n const request = getRequestFromArgs(args);\n\n if (!request) {\n return handler.call(this, ...args);\n }\n\n const parentSpan = (request[kRequestSpan] as Span | null) ?? undefined;\n const handlerName = handler.name?.length > 0 ? handler.name : (this.pluginName ?? ANONYMOUS_FUNCTION_NAME);\n\n const hookType = spanAttributes[ATTRIBUTE_FASTIFY_TYPE];\n const op = hookType === HOOK_TYPE_INSTANCE ? MIDDLEWARE : hookType === HOOK_TYPE_HANDLER ? HANDLER : undefined;\n\n const client = getClient();\n // With span streaming, span names have to be low cardinality, so request handler\n // spans are named after their route.\n const isStreamedRequestHandlerSpan = hookType === HOOK_TYPE_HANDLER && !!client && hasSpanStreamingEnabled(client);\n\n const attributeHookName = spanAttributes[ATTRIBUTE_HOOK_NAME];\n\n const name = isStreamedRequestHandlerSpan\n ? spanAttributes[HTTP_ROUTE] || REQUEST_HANDLER_SPAN_NAME_FALLBACK\n : op && typeof attributeHookName === 'string'\n ? attributeHookName\n : `${hookName} - ${handlerName}`;\n\n return startSpan(\n {\n name,\n attributes: {\n ...spanAttributes,\n [SENTRY_OP]: op,\n [SENTRY_ORIGIN]: ORIGIN,\n },\n parentSpan,\n },\n () => handler.call(this, ...args),\n );\n };\n}\n\nlet _isInstrumented = false;\n\n/**\n * Set up the Fastify (>= 3.21.0 < 7) instrumentation by subscribing to the `fastify.initialization`\n * diagnostics channel and synchronously instrumenting every Fastify instance as it is created.\n */\nexport function instrumentFastify(): void {\n if (_isInstrumented) {\n return;\n }\n _isInstrumented = true;\n\n diagnosticsChannel.subscribe('fastify.initialization', message => {\n const fastifyInstance = (message as { fastify?: FastifyInstance }).fastify;\n\n if (fastifyInstance) {\n instrumentFastifyInstance(fastifyInstance);\n }\n });\n}\n"],"mappings":";;;;;;;AA0CA,MAAM,SAAS;AAEf,MAAM,gBAAgB;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,MAAM,sBAAsB;AAC5B,MAAM,yBAAyB;AAC/B,MAAM,+BAA+B;AAErC,MAAM,kBAAkB;AACxB,MAAM,qBAAqB;AAC3B,MAAM,oBAAoB;AAC1B,MAAM,0BAA0B;AAEhC,MAAM,eAAe,OAAO,6BAA6B;AACzD,MAAM,mBAAmB,OAAO,iCAAiC;AACjE,MAAM,uBAAuB,OAAO,4CAA4C;;;;;AAQhF,SAAS,mBAAmB,SAAkC;CAC5D,OAAO,QAAQ,cAAc,OAAO,QAAQ;AAC9C;;;;;;AAOA,SAAS,iBAAiB,KAAmB;CAC3C,OAAO,aAAa,GAAG,KAAK,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,IAAI,QAAQ,CAA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,MAAM,kBAAmB,QAA0C;EAEnE,IAAI,iBACF,0BAA0B,eAAe;CAE7C,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"instrumentation.js","names":["diagnosticsChannel.subscribe"],"sources":["../../../../src/integrations/fastify/instrumentation.ts"],"sourcesContent":["/*\n * Copyright (c) 2024-present The Fastify team <https://github.com/fastify/fastify#team>\n * SPDX-License-Identifier: MIT\n *\n * NOTICE from the Sentry authors:\n * - Based on: https://github.com/fastify/otel/tree/bae80d6caef4287e7f01ff3c8dc753243706ea86 (@fastify/otel@0.18.1)\n * - Streamlined to the Sentry SDK's needs: dropped the `InstrumentationBase` wrapper, the unused\n * request/lifecycle hooks, `ignorePaths`/`minimatch` support and the OpenTelemetry tracer/context\n * APIs in favor of the Sentry span API.\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-this-alias */\n/* eslint-disable max-lines */\n\nimport * as diagnosticsChannel from '../../utils/diagnosticsChannel';\nimport {\n HTTP_REQUEST_METHOD,\n HTTP_RESPONSE_STATUS_CODE,\n HTTP_ROUTE,\n SENTRY_OP,\n URL_PATH,\n SENTRY_ORIGIN,\n} from '@sentry/conventions/attributes';\nimport { HANDLER, MIDDLEWARE } from '@sentry/conventions/op';\nimport type { Span } from '@sentry/core';\nimport {\n isObjectLike,\n getActiveSpan,\n getClient,\n getIsolationScope,\n hasSpanStreamingEnabled,\n REQUEST_HANDLER_SPAN_NAME_FALLBACK,\n SPAN_STATUS_ERROR,\n spanIsSampled,\n startInactiveSpan,\n startSpan,\n withActiveSpan,\n} from '@sentry/core';\nimport type { FastifyInstance } from './types';\nimport { setHttpServerSpanRouteAttribute } from '../../utils/setHttpServerSpanRouteAttribute';\nimport { handleFastifyError } from './errors';\n\nconst ORIGIN = 'auto.http.fastify';\n\nconst FASTIFY_HOOKS = [\n 'onRequest',\n 'preParsing',\n 'preValidation',\n 'preHandler',\n 'preSerialization',\n 'onSend',\n 'onResponse',\n 'onError',\n];\nconst ATTRIBUTE_HOOK_NAME = 'hook.name' as const;\nconst ATTRIBUTE_FASTIFY_TYPE = 'fastify.type' as const;\nconst ATTRIBUTE_HOOK_CALLBACK_NAME = 'hook.callback.name' as const;\n\nconst HOOK_TYPE_ROUTE = 'route-hook' as const;\nconst HOOK_TYPE_INSTANCE = 'hook' as const;\nconst HOOK_TYPE_HANDLER = 'request-handler' as const;\nconst ANONYMOUS_FUNCTION_NAME = 'anonymous';\n\nconst kRequestSpan = Symbol('sentry fastify request span');\nconst kAddHookOriginal = Symbol('sentry fastify addHook original');\nconst kSetNotFoundOriginal = Symbol('sentry fastify setNotFoundHandler original');\n\ntype AnyFn = (...args: any[]) => any;\n\n/**\n * Read the matched route URL off a request. Fastify >=4 exposes it on `request.routeOptions.url`,\n * while v3 only has the (since-removed-in-v5) `request.routerPath`.\n */\nfunction getRequestRouteUrl(request: any): string | undefined {\n return request.routeOptions?.url ?? request.routerPath;\n}\n\n/**\n * Detect whether one of a wrapped handler's arguments is the Fastify request. We can't rely on a\n * single property since the route metadata moved from `routerPath` (v3) to `routeOptions` (>=4),\n * so we accept either shape.\n */\nfunction isFastifyRequest(arg: any): boolean {\n return isObjectLike(arg) && !!arg.method && !!arg.url && (!!arg.routeOptions || 'routerPath' in arg);\n}\n\n/**\n * Wire up the request/hook/handler spans and error handling on a Fastify instance.\n *\n * This runs synchronously from the `fastify.initialization` diagnostics channel, which fires while\n * `Fastify()` is still constructing the instance, before any user code runs. Doing it synchronously\n * (rather than via `instance.register()`, which defers the work until the boot phase) is what lets us\n * patch `addHook`/`setNotFoundHandler` in time: `addHook` runs immediately, so hooks a user adds\n * synchronously before `listen()`/`ready()` would otherwise slip through un-instrumented.\n */\nfunction instrumentFastifyInstance(instance: FastifyInstance): void {\n // oxlint-disable-next-line typescript/unbound-method\n instance.decorate(kAddHookOriginal, instance.addHook);\n instance.decorate(kSetNotFoundOriginal, instance.setNotFoundHandler);\n instance.decorateRequest('opentelemetry', function opentelemetry(this: any) {\n return { span: this[kRequestSpan] as Span | null };\n });\n instance.decorateRequest(kRequestSpan, null);\n\n instance.addHook('onRoute', onRoute);\n instance.addHook('onRequest', onRequest);\n instance.addHook('onResponse', onResponse);\n // Must be an async hook: a sync (callback-style) `onError` hook would have to invoke Fastify's\n // `done` callback\n instance.addHook('onError', async (request, reply, error) => {\n handleFastifyError(request, reply, error);\n });\n\n // Patch last, so the hooks we add above go through the original (un-wrapped) `addHook`.\n instance.addHook = addHookPatched;\n instance.setNotFoundHandler = setNotFoundHandlerPatched;\n}\n\nfunction onRoute(this: any, routeOptions: any): void {\n for (const hook of FASTIFY_HOOKS) {\n const handlerLike = routeOptions[hook];\n\n if (typeof handlerLike === 'function') {\n routeOptions[hook] = handlerWrapper(\n handlerLike,\n hook,\n routeHookAttributes(this.pluginName, hook, handlerLike, routeOptions.url),\n );\n } else if (Array.isArray(handlerLike)) {\n routeOptions[hook] = handlerLike.map((handler: AnyFn) =>\n handlerWrapper(handler, hook, routeHookAttributes(this.pluginName, hook, handler, routeOptions.url)),\n );\n }\n }\n\n routeOptions.onSend = appendRouteHook(routeOptions.onSend, finalizeResponseSpanHook);\n routeOptions.onError = appendRouteHook(routeOptions.onError, recordErrorInSpanHook);\n\n routeOptions.handler = handlerWrapper(routeOptions.handler, 'handler', {\n [ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - route-handler`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_HANDLER,\n [HTTP_ROUTE]: routeOptions.url,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]:\n routeOptions.handler.name.length > 0 ? routeOptions.handler.name : ANONYMOUS_FUNCTION_NAME,\n });\n}\n\nfunction routeHookAttributes(pluginName: string, hook: string, handler: AnyFn, url: string): Record<string, string> {\n return {\n [ATTRIBUTE_HOOK_NAME]: `${pluginName} - route -> ${hook}`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_ROUTE,\n [HTTP_ROUTE]: url,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]: handler.name?.length > 0 ? handler.name : ANONYMOUS_FUNCTION_NAME,\n };\n}\n\nfunction appendRouteHook(existing: AnyFn | AnyFn[] | undefined, hook: AnyFn): AnyFn | AnyFn[] {\n if (existing == null) {\n return hook;\n }\n return Array.isArray(existing) ? [...existing, hook] : [existing, hook];\n}\n\nfunction onRequest(this: any, request: any, _reply: any, hookDone: () => void): void {\n const routeName = getRequestRouteUrl(request);\n const method = request.method || 'GET';\n\n getIsolationScope().setTransactionName(`${method} ${routeName}`);\n\n const attributes: Record<string, string> = {\n [SENTRY_ORIGIN]: ORIGIN,\n [SENTRY_OP]: HANDLER,\n [HTTP_REQUEST_METHOD]: request.method,\n [URL_PATH]: request.url,\n };\n\n const route = getRequestRouteUrl(request);\n if (route != null) {\n attributes[HTTP_ROUTE] = route;\n\n setHttpServerSpanRouteAttribute(route);\n }\n\n const client = getClient();\n // With span streaming, span names have to be low cardinality, so request handler\n // spans are named after their route alone, without the method prefix.\n const isStreamedSpan = !!client && hasSpanStreamingEnabled(client);\n\n const requestSpan = startInactiveSpan({\n name: isStreamedSpan\n ? route || REQUEST_HANDLER_SPAN_NAME_FALLBACK\n : route != null\n ? `${request.method} ${route}`\n : 'request',\n attributes,\n });\n request[kRequestSpan] = requestSpan;\n\n // Set the request span as the active span for the remainder of the request lifecycle, so that\n // downstream hooks/handlers as well as errors captured via the error diagnostics channel are\n // parented to it (otherwise they would attach to the root `http.server` span instead).\n withActiveSpan(requestSpan, () => {\n hookDone();\n });\n}\n\nfunction onResponse(request: any, reply: any, hookDone: () => void): void {\n const span = request[kRequestSpan] as Span | null;\n\n if (span != null) {\n span.setAttributes({ [HTTP_RESPONSE_STATUS_CODE]: reply.statusCode });\n span.end();\n }\n\n request[kRequestSpan] = null;\n\n hookDone();\n}\n\nfunction finalizeResponseSpanHook(\n request: any,\n reply: any,\n payload: any,\n hookDone: (err: null, payload: any) => void,\n): void {\n const span = request[kRequestSpan] as Span | null;\n\n if (span != null) {\n if (reply.statusCode >= 500) {\n span.setStatus({ code: SPAN_STATUS_ERROR });\n }\n span.setAttributes({ [HTTP_RESPONSE_STATUS_CODE]: reply.statusCode });\n span.end();\n }\n\n request[kRequestSpan] = null;\n\n hookDone(null, payload);\n}\n\nfunction recordErrorInSpanHook(request: any, _reply: any, error: any, hookDone: () => void): void {\n const span = request[kRequestSpan] as Span | null;\n\n if (span != null) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: error.message });\n }\n\n hookDone();\n}\n\nfunction addHookPatched(this: any, name: string, hook: AnyFn): FastifyInstance {\n const addHookOriginal = this[kAddHookOriginal];\n\n if (FASTIFY_HOOKS.includes(name)) {\n return addHookOriginal.call(\n this,\n name,\n handlerWrapper(hook, name, {\n [ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - ${name}`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_INSTANCE,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]: hook.name?.length > 0 ? hook.name : ANONYMOUS_FUNCTION_NAME,\n }),\n );\n }\n\n return addHookOriginal.call(this, name, hook);\n}\n\nfunction setNotFoundHandlerPatched(this: any, hooks: any, handler?: any): void {\n const setNotFoundHandlerOriginal = this[kSetNotFoundOriginal];\n\n if (typeof hooks === 'function') {\n setNotFoundHandlerOriginal.call(\n this,\n handlerWrapper(hooks, 'notFoundHandler', {\n [ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - not-found-handler`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_INSTANCE,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]: hooks.name?.length > 0 ? hooks.name : ANONYMOUS_FUNCTION_NAME,\n }),\n );\n return;\n }\n\n if (hooks.preValidation != null) {\n hooks.preValidation = handlerWrapper(hooks.preValidation, 'notFoundHandler - preValidation', {\n [ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - not-found-handler - preValidation`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_INSTANCE,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]:\n hooks.preValidation.name?.length > 0 ? hooks.preValidation.name : ANONYMOUS_FUNCTION_NAME,\n });\n }\n\n if (hooks.preHandler != null) {\n hooks.preHandler = handlerWrapper(hooks.preHandler, 'notFoundHandler - preHandler', {\n [ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - not-found-handler - preHandler`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_INSTANCE,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]:\n hooks.preHandler.name?.length > 0 ? hooks.preHandler.name : ANONYMOUS_FUNCTION_NAME,\n });\n }\n\n // Fastify allows `setNotFoundHandler(opts)` without a handler, falling back to its built-in 404\n // handler. Forward the (already-wrapped) hooks unchanged so that fallback still applies.\n if (handler == null) {\n setNotFoundHandlerOriginal.call(this, hooks);\n return;\n }\n\n setNotFoundHandlerOriginal.call(\n this,\n hooks,\n handlerWrapper(handler, 'notFoundHandler', {\n [ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - not-found-handler`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_INSTANCE,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]: handler.name?.length > 0 ? handler.name : ANONYMOUS_FUNCTION_NAME,\n }),\n );\n}\n\nfunction getRequestFromArgs(args: any[]): any | null {\n for (const arg of args) {\n if (isFastifyRequest(arg)) {\n return arg;\n }\n }\n return null;\n}\n\nfunction handlerWrapper(handler: AnyFn, hookName: string, spanAttributes: Record<string, string> = {}): AnyFn {\n return function handlerWrapped(this: any, ...args: any[]) {\n const request = getRequestFromArgs(args);\n\n if (!request) {\n return handler.call(this, ...args);\n }\n\n const parentSpan = (request[kRequestSpan] as Span | null) ?? undefined;\n\n // A child of an unsampled span is never sampled either, so skip creating it. Hooks that run after\n // the request span ended (e.g. `onResponse`) fall back to the active span, like `startSpan` would.\n const effectiveParentSpan = parentSpan ?? getActiveSpan();\n if (effectiveParentSpan && !spanIsSampled(effectiveParentSpan)) {\n return handler.call(this, ...args);\n }\n\n const handlerName = handler.name?.length > 0 ? handler.name : (this.pluginName ?? ANONYMOUS_FUNCTION_NAME);\n\n const hookType = spanAttributes[ATTRIBUTE_FASTIFY_TYPE];\n const op = hookType === HOOK_TYPE_INSTANCE ? MIDDLEWARE : hookType === HOOK_TYPE_HANDLER ? HANDLER : undefined;\n\n const client = getClient();\n // With span streaming, span names have to be low cardinality, so request handler\n // spans are named after their route.\n const isStreamedRequestHandlerSpan = hookType === HOOK_TYPE_HANDLER && !!client && hasSpanStreamingEnabled(client);\n\n const attributeHookName = spanAttributes[ATTRIBUTE_HOOK_NAME];\n\n const name = isStreamedRequestHandlerSpan\n ? spanAttributes[HTTP_ROUTE] || REQUEST_HANDLER_SPAN_NAME_FALLBACK\n : op && typeof attributeHookName === 'string'\n ? attributeHookName\n : `${hookName} - ${handlerName}`;\n\n return startSpan(\n {\n name,\n attributes: {\n ...spanAttributes,\n [SENTRY_OP]: op,\n [SENTRY_ORIGIN]: ORIGIN,\n },\n parentSpan,\n },\n () => handler.call(this, ...args),\n );\n };\n}\n\nlet _isInstrumented = false;\n\n/**\n * Set up the Fastify (>= 3.21.0 < 7) instrumentation by subscribing to the `fastify.initialization`\n * diagnostics channel and synchronously instrumenting every Fastify instance as it is created.\n */\nexport function instrumentFastify(): void {\n if (_isInstrumented) {\n return;\n }\n _isInstrumented = true;\n\n diagnosticsChannel.subscribe('fastify.initialization', message => {\n const fastifyInstance = (message as { fastify?: FastifyInstance }).fastify;\n\n if (fastifyInstance) {\n instrumentFastifyInstance(fastifyInstance);\n }\n });\n}\n"],"mappings":";;;;;;;AA4CA,MAAM,SAAS;AAEf,MAAM,gBAAgB;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,MAAM,sBAAsB;AAC5B,MAAM,yBAAyB;AAC/B,MAAM,+BAA+B;AAErC,MAAM,kBAAkB;AACxB,MAAM,qBAAqB;AAC3B,M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SAAS,UAAU;EAGzB,MAAM,+BAA+B,aAAa,qBAAqB,CAAC,CAAC,UAAU,wBAAwB,MAAM;EAEjH,MAAM,oBAAoB,eAAe;EAEzC,MAAM,OAAO,+BACT,eAAe,eAAe,qCAC9B,MAAM,OAAO,sBAAsB,WACjC,oBACA,GAAG,SAAS,KAAK;EAEvB,OAAO,UACL;GACE;GACA,YAAY;IACV,GAAG;KACF,YAAY;KACZ,gBAAgB;GACnB;GACA;EACF,SACM,QAAQ,KAAK,MAAM,GAAG,IAAI,CAClC;CACF;AACF;AAEA,IAAI,kBAAkB;;;;;AAMtB,SAAgB,oBAA0B;CACxC,IAAI,iBACF;CAEF,kBAAkB;CAElBA,UAA6B,2BAA0B,YAAW;EAChE,MAAM,kBAAmB,QAA0C;EAEnE,IAAI,iBACF,0BAA0B,eAAe;CAE7C,CAAC;AACH"}
|
|
@@ -55,6 +55,20 @@ function instrumentHapi(shouldHandleError) {
|
|
|
55
55
|
* `lib/server.js`. Requires the Sentry runtime hook or bundler plugin.
|
|
56
56
|
*/
|
|
57
57
|
const hapiIntegration = defineIntegration(_hapiIntegration);
|
|
58
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Add a Hapi plugin to capture errors to Sentry.
|
|
60
|
+
*
|
|
61
|
+
* @deprecated The error handler is now registered automatically when the Hapi
|
|
62
|
+
* server starts (via the orchestrion `@hapi/hapi` instrumentation), so calling
|
|
63
|
+
* this is no longer necessary. It remains a safe, idempotent operation when the
|
|
64
|
+
* handler is already attached, and is kept for setups where auto-registration is
|
|
65
|
+
* unavailable. This will be removed in a future major version.
|
|
66
|
+
*
|
|
67
|
+
* @param server The Hapi server to attach the error handler to
|
|
68
|
+
*/
|
|
69
|
+
async function setupHapiErrorHandler(server) {
|
|
70
|
+
attachHapiErrorHandler(server);
|
|
71
|
+
}
|
|
72
|
+
export { hapiIntegration, setupHapiErrorHandler };
|
|
59
73
|
|
|
60
74
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["diagnosticsChannel.tracingChannel"],"sources":["../../../../src/integrations/hapi/index.ts"],"sourcesContent":["import * as diagnosticsChannel from '../../utils/diagnosticsChannel';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport type { OrchestrionChannelContext } from '../../orchestrion/types';\nimport { CHANNELS } from '../../orchestrion/channels';\nimport { hapiModuleNames } from '../../orchestrion/config/hapi';\nimport { invokeOrchestrionInstrumentation } from '../../orchestrion/instrumentation';\nimport { attachHapiErrorHandler } from './hapi-error-handler';\nimport type { HapiServer, HapiShouldHandleError } from './hapi-types';\nimport { wrapExtArguments, wrapRouteArguments } from './hapi-utils';\n\n// NOTE: same name as the OTel integration by design — when enabled, the OTel\n// 'Hapi' integration is omitted from the default set.\nconst INTEGRATION_NAME = 'Hapi' as const;\n\ninterface HapiIntegrationOptions {\n /**\n * Callback deciding whether an error should be captured and sent to Sentry.\n *\n * By default, 5xx errors (and errors without a resolvable status) are sent,\n * while 3xx and 4xx errors are not. The hapi request's `response` carries the\n * resolved HTTP status.\n *\n * @example\n *\n * ```javascript\n * Sentry.init({\n * integrations: [\n * Sentry.hapiIntegration({\n * shouldHandleError(_error, request) {\n * return (request.response?.output?.statusCode ?? request.response?.statusCode ?? 500) >= 500;\n * },\n * }),\n * ],\n * });\n * ```\n */\n shouldHandleError: HapiShouldHandleError;\n}\n\n/**\n * The shape orchestrion's transform attaches to the `@hapi/hapi` route/ext\n * tracing-channel `context` objects.\n *\n * `arguments` is the *live* args array passed to `server.route` / `server.ext`;\n * we mutate it in place to swap handlers for span-creating proxies. `self` is\n * the hapi server instance: the root server has `self.realm.plugin === undefined`,\n * while a plugin's clone server exposes the registering plugin's name there.\n */\ninterface HapiChannelContext extends OrchestrionChannelContext {\n self?: { realm?: { plugin?: string } };\n}\n\n/**\n * The `start`/`initialize` channel `context` shape: `self` is the live server\n * we attach the auto-registered error listener to.\n */\ninterface HapiServerContext extends OrchestrionChannelContext {\n self?: HapiServer;\n}\n\nconst _hapiIntegration = (({ shouldHandleError }: Partial<HapiIntegrationOptions> = {}) => {\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n invokeOrchestrionInstrumentation(client, hapiModuleNames, instrumentHapi, [shouldHandleError], {\n requiresTracingChannelBinding: false,\n });\n },\n };\n}) satisfies IntegrationFn;\n\nfunction instrumentHapi(shouldHandleError?: HapiShouldHandleError): void {\n // `subscribe` requires all five lifecycle hooks. We only act on `start`,\n // which orchestrion fires synchronously with the live args array — that's\n // the moment we mutate the handlers in place.\n diagnosticsChannel.tracingChannel(CHANNELS.HAPI_ROUTE).subscribe({\n start(rawCtx) {\n const ctx = rawCtx as HapiChannelContext;\n wrapRouteArguments(ctx.arguments, ctx.self?.realm?.plugin);\n },\n end() {},\n asyncStart() {},\n asyncEnd() {},\n error() {},\n });\n\n diagnosticsChannel.tracingChannel(CHANNELS.HAPI_EXT).subscribe({\n start(rawCtx) {\n const ctx = rawCtx as HapiChannelContext;\n wrapExtArguments(ctx.arguments, ctx.self?.realm?.plugin);\n },\n end() {},\n asyncStart() {},\n asyncEnd() {},\n error() {},\n });\n\n // Auto-register the error handler when the server boots\n // `attachHapiErrorHandler` is idempotent, so hooking both `start` and `initialize` is safe.\n const attachOnStart = {\n start(rawCtx: unknown) {\n const server = (rawCtx as HapiServerContext).self;\n if (server) {\n attachHapiErrorHandler(server, shouldHandleError);\n }\n },\n end() {},\n asyncStart() {},\n asyncEnd() {},\n error() {},\n };\n\n diagnosticsChannel.tracingChannel(CHANNELS.HAPI_START).subscribe(attachOnStart);\n diagnosticsChannel.tracingChannel(CHANNELS.HAPI_INITIALIZE).subscribe(attachOnStart);\n}\n\n/**\n * Diagnostics-channel-based hapi integration. Subscribes to the\n * `orchestrion:@hapi/hapi:route` / `:ext` channels injected into `@hapi/hapi`'s\n * `lib/server.js`. Requires the Sentry runtime hook or bundler plugin.\n */\nexport const hapiIntegration = defineIntegration(_hapiIntegration);\n"],"mappings":";;;;;;;;AAaA,MAAM,mBAAmB;AAgDzB,MAAM,qBAAqB,EAAE,sBAAuD,CAAC,MAAM;CACzF,OAAO;EACL,MAAM;EACN,MAAM,QAAQ;GACZ,iCAAiC,QAAQ,iBAAiB,gBAAgB,CAAC,iBAAiB,GAAG,EAC7F,+BAA+B,MACjC,CAAC;EACH;CACF;AACF;AAEA,SAAS,eAAe,mBAAiD;CAIvEA,eAAkC,SAAS,UAAU,CAAC,CAAC,UAAU;EAC/D,MAAM,QAAQ;GACZ,MAAM,MAAM;GACZ,mBAAmB,IAAI,WAAW,IAAI,MAAM,OAAO,MAAM;EAC3D;EACA,MAAM,CAAC;EACP,aAAa,CAAC;EACd,WAAW,CAAC;EACZ,QAAQ,CAAC;CACX,CAAC;CAEDA,eAAkC,SAAS,QAAQ,CAAC,CAAC,UAAU;EAC7D,MAAM,QAAQ;GACZ,MAAM,MAAM;GACZ,iBAAiB,IAAI,WAAW,IAAI,MAAM,OAAO,MAAM;EACzD;EACA,MAAM,CAAC;EACP,aAAa,CAAC;EACd,WAAW,CAAC;EACZ,QAAQ,CAAC;CACX,CAAC;CAID,MAAM,gBAAgB;EACpB,MAAM,QAAiB;GACrB,MAAM,SAAU,OAA6B;GAC7C,IAAI,QACF,uBAAuB,QAAQ,iBAAiB;EAEpD;EACA,MAAM,CAAC;EACP,aAAa,CAAC;EACd,WAAW,CAAC;EACZ,QAAQ,CAAC;CACX;CAEAA,eAAkC,SAAS,UAAU,CAAC,CAAC,UAAU,aAAa;CAC9EA,eAAkC,SAAS,eAAe,CAAC,CAAC,UAAU,aAAa;AACrF;;;;;;AAOA,MAAa,kBAAkB,kBAAkB,gBAAgB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["diagnosticsChannel.tracingChannel"],"sources":["../../../../src/integrations/hapi/index.ts"],"sourcesContent":["import * as diagnosticsChannel from '../../utils/diagnosticsChannel';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport type { OrchestrionChannelContext } from '../../orchestrion/types';\nimport { CHANNELS } from '../../orchestrion/channels';\nimport { hapiModuleNames } from '../../orchestrion/config/hapi';\nimport { invokeOrchestrionInstrumentation } from '../../orchestrion/instrumentation';\nimport { attachHapiErrorHandler } from './hapi-error-handler';\nimport type { HapiServer, HapiShouldHandleError } from './hapi-types';\nimport { wrapExtArguments, wrapRouteArguments } from './hapi-utils';\n\n// NOTE: same name as the OTel integration by design — when enabled, the OTel\n// 'Hapi' integration is omitted from the default set.\nconst INTEGRATION_NAME = 'Hapi' as const;\n\ninterface HapiIntegrationOptions {\n /**\n * Callback deciding whether an error should be captured and sent to Sentry.\n *\n * By default, 5xx errors (and errors without a resolvable status) are sent,\n * while 3xx and 4xx errors are not. The hapi request's `response` carries the\n * resolved HTTP status.\n *\n * @example\n *\n * ```javascript\n * Sentry.init({\n * integrations: [\n * Sentry.hapiIntegration({\n * shouldHandleError(_error, request) {\n * return (request.response?.output?.statusCode ?? request.response?.statusCode ?? 500) >= 500;\n * },\n * }),\n * ],\n * });\n * ```\n */\n shouldHandleError: HapiShouldHandleError;\n}\n\n/**\n * The shape orchestrion's transform attaches to the `@hapi/hapi` route/ext\n * tracing-channel `context` objects.\n *\n * `arguments` is the *live* args array passed to `server.route` / `server.ext`;\n * we mutate it in place to swap handlers for span-creating proxies. `self` is\n * the hapi server instance: the root server has `self.realm.plugin === undefined`,\n * while a plugin's clone server exposes the registering plugin's name there.\n */\ninterface HapiChannelContext extends OrchestrionChannelContext {\n self?: { realm?: { plugin?: string } };\n}\n\n/**\n * The `start`/`initialize` channel `context` shape: `self` is the live server\n * we attach the auto-registered error listener to.\n */\ninterface HapiServerContext extends OrchestrionChannelContext {\n self?: HapiServer;\n}\n\nconst _hapiIntegration = (({ shouldHandleError }: Partial<HapiIntegrationOptions> = {}) => {\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n invokeOrchestrionInstrumentation(client, hapiModuleNames, instrumentHapi, [shouldHandleError], {\n requiresTracingChannelBinding: false,\n });\n },\n };\n}) satisfies IntegrationFn;\n\nfunction instrumentHapi(shouldHandleError?: HapiShouldHandleError): void {\n // `subscribe` requires all five lifecycle hooks. We only act on `start`,\n // which orchestrion fires synchronously with the live args array — that's\n // the moment we mutate the handlers in place.\n diagnosticsChannel.tracingChannel(CHANNELS.HAPI_ROUTE).subscribe({\n start(rawCtx) {\n const ctx = rawCtx as HapiChannelContext;\n wrapRouteArguments(ctx.arguments, ctx.self?.realm?.plugin);\n },\n end() {},\n asyncStart() {},\n asyncEnd() {},\n error() {},\n });\n\n diagnosticsChannel.tracingChannel(CHANNELS.HAPI_EXT).subscribe({\n start(rawCtx) {\n const ctx = rawCtx as HapiChannelContext;\n wrapExtArguments(ctx.arguments, ctx.self?.realm?.plugin);\n },\n end() {},\n asyncStart() {},\n asyncEnd() {},\n error() {},\n });\n\n // Auto-register the error handler when the server boots\n // `attachHapiErrorHandler` is idempotent, so hooking both `start` and `initialize` is safe.\n const attachOnStart = {\n start(rawCtx: unknown) {\n const server = (rawCtx as HapiServerContext).self;\n if (server) {\n attachHapiErrorHandler(server, shouldHandleError);\n }\n },\n end() {},\n asyncStart() {},\n asyncEnd() {},\n error() {},\n };\n\n diagnosticsChannel.tracingChannel(CHANNELS.HAPI_START).subscribe(attachOnStart);\n diagnosticsChannel.tracingChannel(CHANNELS.HAPI_INITIALIZE).subscribe(attachOnStart);\n}\n\n/**\n * Diagnostics-channel-based hapi integration. Subscribes to the\n * `orchestrion:@hapi/hapi:route` / `:ext` channels injected into `@hapi/hapi`'s\n * `lib/server.js`. Requires the Sentry runtime hook or bundler plugin.\n */\nexport const hapiIntegration = defineIntegration(_hapiIntegration);\n\n/**\n * Add a Hapi plugin to capture errors to Sentry.\n *\n * @deprecated The error handler is now registered automatically when the Hapi\n * server starts (via the orchestrion `@hapi/hapi` instrumentation), so calling\n * this is no longer necessary. It remains a safe, idempotent operation when the\n * handler is already attached, and is kept for setups where auto-registration is\n * unavailable. This will be removed in a future major version.\n *\n * @param server The Hapi server to attach the error handler to\n */\nexport async function setupHapiErrorHandler(server: unknown): Promise<void> {\n attachHapiErrorHandler(server as HapiServer);\n}\n"],"mappings":";;;;;;;;AAaA,MAAM,mBAAmB;AAgDzB,MAAM,qBAAqB,EAAE,sBAAuD,CAAC,MAAM;CACzF,OAAO;EACL,MAAM;EACN,MAAM,QAAQ;GACZ,iCAAiC,QAAQ,iBAAiB,gBAAgB,CAAC,iBAAiB,GAAG,EAC7F,+BAA+B,MACjC,CAAC;EACH;CACF;AACF;AAEA,SAAS,eAAe,mBAAiD;CAIvEA,eAAkC,SAAS,UAAU,CAAC,CAAC,UAAU;EAC/D,MAAM,QAAQ;GACZ,MAAM,MAAM;GACZ,mBAAmB,IAAI,WAAW,IAAI,MAAM,OAAO,MAAM;EAC3D;EACA,MAAM,CAAC;EACP,aAAa,CAAC;EACd,WAAW,CAAC;EACZ,QAAQ,CAAC;CACX,CAAC;CAEDA,eAAkC,SAAS,QAAQ,CAAC,CAAC,UAAU;EAC7D,MAAM,QAAQ;GACZ,MAAM,MAAM;GACZ,iBAAiB,IAAI,WAAW,IAAI,MAAM,OAAO,MAAM;EACzD;EACA,MAAM,CAAC;EACP,aAAa,CAAC;EACd,WAAW,CAAC;EACZ,QAAQ,CAAC;CACX,CAAC;CAID,MAAM,gBAAgB;EACpB,MAAM,QAAiB;GACrB,MAAM,SAAU,OAA6B;GAC7C,IAAI,QACF,uBAAuB,QAAQ,iBAAiB;EAEpD;EACA,MAAM,CAAC;EACP,aAAa,CAAC;EACd,WAAW,CAAC;EACZ,QAAQ,CAAC;CACX;CAEAA,eAAkC,SAAS,UAAU,CAAC,CAAC,UAAU,aAAa;CAC9EA,eAAkC,SAAS,eAAe,CAAC,CAAC,UAAU,aAAa;AACrF;;;;;;AAOA,MAAa,kBAAkB,kBAAkB,gBAAgB;;;;;;;;;;;;AAajE,eAAsB,sBAAsB,QAAgC;CAC1E,uBAAuB,MAAoB;AAC7C"}
|
|
@@ -30,6 +30,7 @@ import { togetherAIIntegration } from "./together-ai.js";
|
|
|
30
30
|
import { typesafeIntegration } from "./typesafe.js";
|
|
31
31
|
import { postgresJsIntegration } from "./postgresjs/index.js";
|
|
32
32
|
import { neonIntegration } from "./neon.js";
|
|
33
|
+
import { clickhouseIntegration } from "./clickhouse.js";
|
|
33
34
|
import { firebaseIntegration } from "./firebase/index.js";
|
|
34
35
|
import { expressIntegration } from "./express/index.js";
|
|
35
36
|
import { fastifyIntegration } from "./fastify/index.js";
|
|
@@ -73,6 +74,7 @@ function getTracingIntegrations() {
|
|
|
73
74
|
typesafeIntegration(),
|
|
74
75
|
postgresJsIntegration(),
|
|
75
76
|
neonIntegration(),
|
|
77
|
+
clickhouseIntegration(),
|
|
76
78
|
firebaseIntegration(),
|
|
77
79
|
mcpServerIntegration()
|
|
78
80
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/integrations/index.ts"],"sourcesContent":["import { amqplibIntegration } from './amqplib';\nimport { dataloaderIntegration } from './dataloader';\nimport { knexIntegration } from './knex';\nimport { mongoIntegration } from './mongodb';\nimport { graphqlIntegration } from './graphql';\nimport { redisIntegration } from './redis';\nimport { mysqlIntegration } from './mysql';\nimport { mysql2Integration } from './mysql2';\nimport { postgresIntegration } from './pg';\nimport { prismaIntegration } from './prisma';\nimport { tediousIntegration } from './tedious';\nimport { genericPoolIntegration } from './generic-pool';\nimport { kafkaIntegration } from './kafkajs';\nimport { mongooseIntegration } from './mongoose';\nimport { lruMemoizerIntegration } from './lru-memoizer';\nimport { langChainIntegration } from './langchain';\nimport { langGraphIntegration } from './langgraph';\nimport { piAiIntegration } from './pi-ai';\nimport { piDurableIntegration } from './pi-durable';\nimport { mastraIntegration } from './mastra';\nimport { mcpServerIntegration } from './mcp-server';\nimport { vercelAIIntegration } from './vercel-ai';\nimport { openAIIntegration } from './openai';\nimport { anthropicAIIntegration } from './anthropic';\nimport { googleGenAIIntegration } from './google-genai';\nimport { mistralAIIntegration } from './mistral';\nimport { groqIntegration } from './groq';\nimport { togetherAIIntegration } from './together-ai';\nimport { typesafeIntegration } from './typesafe';\nimport { postgresJsIntegration } from './postgresjs';\nimport { neonIntegration } from './neon';\nimport { firebaseIntegration } from './firebase';\nimport { expressIntegration } from './express';\nimport { fastifyIntegration } from './fastify';\nimport { nitroIntegration } from './nitro';\nimport { hapiIntegration } from './hapi';\nimport { honoIntegration } from './hono';\nimport { koaIntegration } from './koa';\nimport type { Integration } from '@sentry/core';\nimport { awsIntegration } from './aws-sdk';\n\n/** These are integrations that are tracing-only integrations. */\nexport function getTracingIntegrations(): Integration[] {\n return [\n graphqlIntegration(),\n mongoIntegration(),\n mongooseIntegration(),\n mysqlIntegration(),\n mysql2Integration(),\n redisIntegration(),\n postgresIntegration(),\n prismaIntegration(),\n tediousIntegration(),\n knexIntegration(),\n genericPoolIntegration(),\n kafkaIntegration(),\n amqplibIntegration(),\n lruMemoizerIntegration(),\n dataloaderIntegration(),\n awsIntegration(),\n // AI providers\n // LangChain must come first to disable AI provider integrations before they instrument\n langChainIntegration(),\n langGraphIntegration(),\n mastraIntegration(),\n piAiIntegration(),\n piDurableIntegration(),\n vercelAIIntegration(),\n openAIIntegration(),\n anthropicAIIntegration(),\n googleGenAIIntegration(),\n mistralAIIntegration(),\n groqIntegration(),\n togetherAIIntegration(),\n typesafeIntegration(),\n postgresJsIntegration(),\n neonIntegration(),\n firebaseIntegration(),\n mcpServerIntegration(),\n ];\n}\n\n/**\n * These are default integrations that are registered regardless of whether tracing is enabled -\n * either because they cover error capture in addition to tracing, or because they handle trace\n * propagation (which must work in tracing-without-performance mode too).\n */\nexport function getErrorIntegrations(): Integration[] {\n return [\n expressIntegration(),\n fastifyIntegration(),\n hapiIntegration(),\n honoIntegration(),\n koaIntegration(),\n nitroIntegration(),\n ];\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/integrations/index.ts"],"sourcesContent":["import { amqplibIntegration } from './amqplib';\nimport { dataloaderIntegration } from './dataloader';\nimport { knexIntegration } from './knex';\nimport { mongoIntegration } from './mongodb';\nimport { graphqlIntegration } from './graphql';\nimport { redisIntegration } from './redis';\nimport { mysqlIntegration } from './mysql';\nimport { mysql2Integration } from './mysql2';\nimport { postgresIntegration } from './pg';\nimport { prismaIntegration } from './prisma';\nimport { tediousIntegration } from './tedious';\nimport { genericPoolIntegration } from './generic-pool';\nimport { kafkaIntegration } from './kafkajs';\nimport { mongooseIntegration } from './mongoose';\nimport { lruMemoizerIntegration } from './lru-memoizer';\nimport { langChainIntegration } from './langchain';\nimport { langGraphIntegration } from './langgraph';\nimport { piAiIntegration } from './pi-ai';\nimport { piDurableIntegration } from './pi-durable';\nimport { mastraIntegration } from './mastra';\nimport { mcpServerIntegration } from './mcp-server';\nimport { vercelAIIntegration } from './vercel-ai';\nimport { openAIIntegration } from './openai';\nimport { anthropicAIIntegration } from './anthropic';\nimport { googleGenAIIntegration } from './google-genai';\nimport { mistralAIIntegration } from './mistral';\nimport { groqIntegration } from './groq';\nimport { togetherAIIntegration } from './together-ai';\nimport { typesafeIntegration } from './typesafe';\nimport { postgresJsIntegration } from './postgresjs';\nimport { neonIntegration } from './neon';\nimport { clickhouseIntegration } from './clickhouse';\nimport { firebaseIntegration } from './firebase';\nimport { expressIntegration } from './express';\nimport { fastifyIntegration } from './fastify';\nimport { nitroIntegration } from './nitro';\nimport { hapiIntegration } from './hapi';\nimport { honoIntegration } from './hono';\nimport { koaIntegration } from './koa';\nimport type { Integration } from '@sentry/core';\nimport { awsIntegration } from './aws-sdk';\n\n/** These are integrations that are tracing-only integrations. */\nexport function getTracingIntegrations(): Integration[] {\n return [\n graphqlIntegration(),\n mongoIntegration(),\n mongooseIntegration(),\n mysqlIntegration(),\n mysql2Integration(),\n redisIntegration(),\n postgresIntegration(),\n prismaIntegration(),\n tediousIntegration(),\n knexIntegration(),\n genericPoolIntegration(),\n kafkaIntegration(),\n amqplibIntegration(),\n lruMemoizerIntegration(),\n dataloaderIntegration(),\n awsIntegration(),\n // AI providers\n // LangChain must come first to disable AI provider integrations before they instrument\n langChainIntegration(),\n langGraphIntegration(),\n mastraIntegration(),\n piAiIntegration(),\n piDurableIntegration(),\n vercelAIIntegration(),\n openAIIntegration(),\n anthropicAIIntegration(),\n googleGenAIIntegration(),\n mistralAIIntegration(),\n groqIntegration(),\n togetherAIIntegration(),\n typesafeIntegration(),\n postgresJsIntegration(),\n neonIntegration(),\n clickhouseIntegration(),\n firebaseIntegration(),\n mcpServerIntegration(),\n ];\n}\n\n/**\n * These are default integrations that are registered regardless of whether tracing is enabled -\n * either because they cover error capture in addition to tracing, or because they handle trace\n * propagation (which must work in tracing-without-performance mode too).\n */\nexport function getErrorIntegrations(): Integration[] {\n return [\n expressIntegration(),\n fastifyIntegration(),\n hapiIntegration(),\n honoIntegration(),\n koaIntegration(),\n nitroIntegration(),\n ];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,SAAgB,yBAAwC;CACtD,OAAO;EACL,mBAAmB;EACnB,iBAAiB;EACjB,oBAAoB;EACpB,iBAAiB;EACjB,kBAAkB;EAClB,iBAAiB;EACjB,oBAAoB;EACpB,kBAAkB;EAClB,mBAAmB;EACnB,gBAAgB;EAChB,uBAAuB;EACvB,iBAAiB;EACjB,mBAAmB;EACnB,uBAAuB;EACvB,sBAAsB;EACtB,eAAe;EAGf,qBAAqB;EACrB,qBAAqB;EACrB,kBAAkB;EAClB,gBAAgB;EAChB,qBAAqB;EACrB,oBAAoB;EACpB,kBAAkB;EAClB,uBAAuB;EACvB,uBAAuB;EACvB,qBAAqB;EACrB,gBAAgB;EAChB,sBAAsB;EACtB,oBAAoB;EACpB,sBAAsB;EACtB,gBAAgB;EAChB,sBAAsB;EACtB,oBAAoB;EACpB,qBAAqB;CACvB;AACF;;;;;;AAOA,SAAgB,uBAAsC;CACpD,OAAO;EACL,mBAAmB;EACnB,mBAAmB;EACnB,gBAAgB;EAChB,gBAAgB;EAChB,eAAe;EACf,iBAAiB;CACnB;AACF"}
|
|
@@ -4,6 +4,7 @@ import { GOOGLE_GENAI_INTEGRATION_NAME } from "../ai/google-genai/constants.js";
|
|
|
4
4
|
import { createLangChainCallbackHandler } from "../ai/langchain/index.js";
|
|
5
5
|
import { LANGCHAIN_INTEGRATION_NAME } from "../ai/langchain/constants.js";
|
|
6
6
|
import { _INTERNAL_getLangChainEmbeddingsSpanOptions } from "../ai/langchain/embeddings.js";
|
|
7
|
+
import { runGenAiSpanEnd, runGenAiSpanStart } from "../ai/core/span-hooks.js";
|
|
7
8
|
import { recordTypeSafeClassifierState } from "../ai/langchain/typesafe-classifier.js";
|
|
8
9
|
import { _INTERNAL_mergeLangChainCallbackHandler, getConversationIdMetadataFromConfig, getInheritedLangChainCallbacks } from "../ai/langchain/utils.js";
|
|
9
10
|
import { MISTRAL_INTEGRATION_NAME } from "../ai/mistral/constants.js";
|
|
@@ -63,12 +64,18 @@ function instrumentChatModels(options) {
|
|
|
63
64
|
});
|
|
64
65
|
}
|
|
65
66
|
function instrumentEmbeddings(options) {
|
|
66
|
-
for (const channelName of langchainEmbeddingsChannels) bindTracingChannelToSpan(tracingChannel(channelName), (data) => createEmbeddingsSpan(data, options));
|
|
67
|
+
for (const channelName of langchainEmbeddingsChannels) bindTracingChannelToSpan(tracingChannel(channelName), (data) => createEmbeddingsSpan(data, options), { beforeSpanEnd: (_span, data) => data._sentryOnSpanEnd?.("error" in data ? { error: data.error } : { response: data.result }) });
|
|
67
68
|
}
|
|
68
69
|
function createEmbeddingsSpan(data, options) {
|
|
69
70
|
markProvidersSkipped();
|
|
70
|
-
const
|
|
71
|
-
|
|
71
|
+
const call = {
|
|
72
|
+
operation: "embeddings",
|
|
73
|
+
input: (data.arguments ?? [])[0]
|
|
74
|
+
};
|
|
75
|
+
const span = startInactiveSpan(_INTERNAL_getLangChainEmbeddingsSpanOptions(data.self, call, options));
|
|
76
|
+
runGenAiSpanStart(options, span, call);
|
|
77
|
+
data._sentryOnSpanEnd = (result) => runGenAiSpanEnd(options, span, call, result);
|
|
78
|
+
return span;
|
|
72
79
|
}
|
|
73
80
|
/**
|
|
74
81
|
* Diagnostics-channel-based LangChain integration. Subscribes to the diagnostics_channels
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"langchain.js","names":["diagnosticsChannel.tracingChannel","diagnosticsChannel\n .tracingChannel"],"sources":["../../../src/integrations/langchain.ts"],"sourcesContent":["import * as diagnosticsChannel from '../utils/diagnosticsChannel';\nimport type { IntegrationFn, Span } from '@sentry/core';\nimport { _INTERNAL_skipAiProviderWrapping, defineIntegration, startInactiveSpan } from '@sentry/core';\nimport { ANTHROPIC_AI_INTEGRATION_NAME } from '../ai/anthropic-ai/constants';\nimport { GOOGLE_GENAI_INTEGRATION_NAME } from '../ai/google-genai/constants';\nimport { createLangChainCallbackHandler } from '../ai/langchain';\nimport { LANGCHAIN_INTEGRATION_NAME } from '../ai/langchain/constants';\nimport { _INTERNAL_getLangChainEmbeddingsSpanOptions } from '../ai/langchain/embeddings';\nimport { recordTypeSafeClassifierState } from '../ai/langchain/typesafe-classifier';\nimport type { LangChainOptions } from '../ai/langchain/types';\nimport {\n getConversationIdMetadataFromConfig,\n getInheritedLangChainCallbacks,\n _INTERNAL_mergeLangChainCallbackHandler,\n} from '../ai/langchain/utils';\nimport { MISTRAL_INTEGRATION_NAME } from '../ai/mistral/constants';\nimport { OPENAI_INTEGRATION_NAME } from '../ai/openai/constants';\nimport { GROQ_INTEGRATION_NAME } from './groq';\nimport type { OrchestrionChannelContext } from '../orchestrion/types';\nimport { CHANNELS } from '../orchestrion/channels';\nimport { langchainEmbeddingsChannels } from '../orchestrion/config/langchain';\nimport { bindTracingChannelToSpan } from '../tracing-channel';\nimport { langchainModuleNames } from '../orchestrion/config/langchain';\nimport { invokeOrchestrionInstrumentation } from '../orchestrion/instrumentation';\n\n// Same name as the OTel integration by design, so the OTel 'LangChain' integration is\n// deduplicated out of the default set.\nconst INTEGRATION_NAME = LANGCHAIN_INTEGRATION_NAME;\n\n// LangChain drives the underlying AI provider SDKs itself, so while it's active those providers must\n// not also instrument, or every call would produce two spans (mirrors the OTel path's skip list).\nconst SKIPPED_PROVIDERS = [\n OPENAI_INTEGRATION_NAME,\n ANTHROPIC_AI_INTEGRATION_NAME,\n GOOGLE_GENAI_INTEGRATION_NAME,\n MISTRAL_INTEGRATION_NAME,\n // `@langchain/groq` drives `groq-sdk`, so ChatGroq calls must not also open the Groq integration's span.\n GROQ_INTEGRATION_NAME,\n];\n\n// The chat-model channels carry the live args array of `invoke(input, options)` / `_streamIterator(input, options)`.\n// The embeddings channels carry the instance (`self`) and the `embedQuery(text)` / `embedDocuments(texts)` args.\n// Registered lazily on the first LangChain call (not at `setupOnce`) so a direct provider call made\n// before any LangChain call still gets its own span — matches the OTel patch-on-import timing. It\n// also stops the underlying SDK from double-instrumenting embeddings, whose `embedQuery`/\n// `embedDocuments` call the provider SDK (e.g. `openai`) internally.\nfunction markProvidersSkipped(): void {\n _INTERNAL_skipAiProviderWrapping(SKIPPED_PROVIDERS);\n}\n\nconst _langChainIntegration = ((options: LangChainOptions = {}) => {\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n // Chat models only mutate the call args, so they subscribe without the\n // async-context binding. Kept separate so a missing binding never defers\n // them: on the bundler path the wait would push subscription past\n // `Sentry.init()` and early calls would run with no subscriber.\n invokeOrchestrionInstrumentation(client, langchainModuleNames, instrumentChatModels, [options], {\n requiresTracingChannelBinding: false,\n });\n // Embeddings open their own spans via `bindTracingChannelToSpan`, which\n // needs the binding.\n invokeOrchestrionInstrumentation(client, langchainModuleNames, instrumentEmbeddings, [options]);\n },\n };\n}) satisfies IntegrationFn;\n\nfunction instrumentChatModels(options: LangChainOptions): void {\n // One stateful handler tracks spans across the whole run tree, just like the OTel path.\n const sentryHandler = createLangChainCallbackHandler(options);\n\n // Chat models: inject the Sentry callback handler into the call options (arg 1). LangChain's own\n // callback dispatch then creates the spans, exactly as in the OTel path, so no span is opened\n // here — a `start` subscriber (which also makes orchestrion wrap the function) is enough.\n const injectHandler = (message: unknown): void => {\n const args = (message as OrchestrionChannelContext).arguments;\n if (!Array.isArray(args)) {\n return;\n }\n\n let callOptions = args[1] as Record<string, unknown> | undefined;\n if (!callOptions || typeof callOptions !== 'object' || Array.isArray(callOptions)) {\n callOptions = {};\n args[1] = callOptions;\n }\n\n // Without callbacks of its own, the call would otherwise lose the parent run and its tracers (e.g. LangSmith).\n callOptions.callbacks = _INTERNAL_mergeLangChainCallbackHandler(\n callOptions.callbacks ?? getInheritedLangChainCallbacks(),\n sentryHandler,\n );\n\n const conversationIdMetadata = getConversationIdMetadataFromConfig(callOptions);\n if (Object.keys(conversationIdMetadata).length) {\n callOptions.metadata = { ...conversationIdMetadata, ...(callOptions.metadata as Record<string, unknown>) };\n }\n };\n\n for (const channelName of [CHANNELS.LANGCHAIN_CHAT_MODEL_INVOKE, CHANNELS.LANGCHAIN_CHAT_MODEL_STREAM]) {\n diagnosticsChannel.tracingChannel<OrchestrionChannelContext>(channelName).start.subscribe(message => {\n markProvidersSkipped();\n injectHandler(message);\n });\n }\n\n // `TypeSafeClassifier` calls Jev with `fetch`, not through a provider SDK, so nothing needs skipping.\n diagnosticsChannel\n .tracingChannel<OrchestrionChannelContext>(CHANNELS.LANGCHAIN_TYPESAFE_CLASSIFIER_INVOKE)\n .start.subscribe(message => {\n injectHandler(message);\n const { self, arguments: args } = message as OrchestrionChannelContext;\n recordTypeSafeClassifierState(self, args?.[0]);\n });\n}\n\n// Embeddings don't use the callback system. Wrap the method in its own span.\n// Embedding errors reject to the caller, so we only open the span (which bindTracingChannelToSpan\n// still marks failed on error) and do not capture them.\nfunction instrumentEmbeddings(options: LangChainOptions): void {\n for (const channelName of langchainEmbeddingsChannels) {\n bindTracingChannelToSpan(diagnosticsChannel.tracingChannel<
|
|
1
|
+
{"version":3,"file":"langchain.js","names":["diagnosticsChannel.tracingChannel","diagnosticsChannel\n .tracingChannel"],"sources":["../../../src/integrations/langchain.ts"],"sourcesContent":["import * as diagnosticsChannel from '../utils/diagnosticsChannel';\nimport type { IntegrationFn, Span } from '@sentry/core';\nimport { _INTERNAL_skipAiProviderWrapping, defineIntegration, startInactiveSpan } from '@sentry/core';\nimport { ANTHROPIC_AI_INTEGRATION_NAME } from '../ai/anthropic-ai/constants';\nimport { GOOGLE_GENAI_INTEGRATION_NAME } from '../ai/google-genai/constants';\nimport { createLangChainCallbackHandler } from '../ai/langchain';\nimport { LANGCHAIN_INTEGRATION_NAME } from '../ai/langchain/constants';\nimport { _INTERNAL_getLangChainEmbeddingsSpanOptions } from '../ai/langchain/embeddings';\nimport { type GenAiSpanResult, runGenAiSpanEnd, runGenAiSpanStart } from '../ai/core/span-hooks';\nimport { recordTypeSafeClassifierState } from '../ai/langchain/typesafe-classifier';\nimport type { LangChainEmbeddingsCallInfo, LangChainOptions } from '../ai/langchain/types';\nimport {\n getConversationIdMetadataFromConfig,\n getInheritedLangChainCallbacks,\n _INTERNAL_mergeLangChainCallbackHandler,\n} from '../ai/langchain/utils';\nimport { MISTRAL_INTEGRATION_NAME } from '../ai/mistral/constants';\nimport { OPENAI_INTEGRATION_NAME } from '../ai/openai/constants';\nimport { GROQ_INTEGRATION_NAME } from './groq';\nimport type { OrchestrionChannelContext } from '../orchestrion/types';\nimport { CHANNELS } from '../orchestrion/channels';\nimport { langchainEmbeddingsChannels } from '../orchestrion/config/langchain';\nimport { bindTracingChannelToSpan } from '../tracing-channel';\nimport { langchainModuleNames } from '../orchestrion/config/langchain';\nimport { invokeOrchestrionInstrumentation } from '../orchestrion/instrumentation';\n\n// Same name as the OTel integration by design, so the OTel 'LangChain' integration is\n// deduplicated out of the default set.\nconst INTEGRATION_NAME = LANGCHAIN_INTEGRATION_NAME;\n\ntype EmbeddingsChannelContext = OrchestrionChannelContext & {\n _sentryOnSpanEnd?: (result: GenAiSpanResult<unknown>) => void;\n};\n\n// LangChain drives the underlying AI provider SDKs itself, so while it's active those providers must\n// not also instrument, or every call would produce two spans (mirrors the OTel path's skip list).\nconst SKIPPED_PROVIDERS = [\n OPENAI_INTEGRATION_NAME,\n ANTHROPIC_AI_INTEGRATION_NAME,\n GOOGLE_GENAI_INTEGRATION_NAME,\n MISTRAL_INTEGRATION_NAME,\n // `@langchain/groq` drives `groq-sdk`, so ChatGroq calls must not also open the Groq integration's span.\n GROQ_INTEGRATION_NAME,\n];\n\n// The chat-model channels carry the live args array of `invoke(input, options)` / `_streamIterator(input, options)`.\n// The embeddings channels carry the instance (`self`) and the `embedQuery(text)` / `embedDocuments(texts)` args.\n// Registered lazily on the first LangChain call (not at `setupOnce`) so a direct provider call made\n// before any LangChain call still gets its own span — matches the OTel patch-on-import timing. It\n// also stops the underlying SDK from double-instrumenting embeddings, whose `embedQuery`/\n// `embedDocuments` call the provider SDK (e.g. `openai`) internally.\nfunction markProvidersSkipped(): void {\n _INTERNAL_skipAiProviderWrapping(SKIPPED_PROVIDERS);\n}\n\nconst _langChainIntegration = ((options: LangChainOptions = {}) => {\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n // Chat models only mutate the call args, so they subscribe without the\n // async-context binding. Kept separate so a missing binding never defers\n // them: on the bundler path the wait would push subscription past\n // `Sentry.init()` and early calls would run with no subscriber.\n invokeOrchestrionInstrumentation(client, langchainModuleNames, instrumentChatModels, [options], {\n requiresTracingChannelBinding: false,\n });\n // Embeddings open their own spans via `bindTracingChannelToSpan`, which\n // needs the binding.\n invokeOrchestrionInstrumentation(client, langchainModuleNames, instrumentEmbeddings, [options]);\n },\n };\n}) satisfies IntegrationFn;\n\nfunction instrumentChatModels(options: LangChainOptions): void {\n // One stateful handler tracks spans across the whole run tree, just like the OTel path.\n const sentryHandler = createLangChainCallbackHandler(options);\n\n // Chat models: inject the Sentry callback handler into the call options (arg 1). LangChain's own\n // callback dispatch then creates the spans, exactly as in the OTel path, so no span is opened\n // here — a `start` subscriber (which also makes orchestrion wrap the function) is enough.\n const injectHandler = (message: unknown): void => {\n const args = (message as OrchestrionChannelContext).arguments;\n if (!Array.isArray(args)) {\n return;\n }\n\n let callOptions = args[1] as Record<string, unknown> | undefined;\n if (!callOptions || typeof callOptions !== 'object' || Array.isArray(callOptions)) {\n callOptions = {};\n args[1] = callOptions;\n }\n\n // Without callbacks of its own, the call would otherwise lose the parent run and its tracers (e.g. LangSmith).\n callOptions.callbacks = _INTERNAL_mergeLangChainCallbackHandler(\n callOptions.callbacks ?? getInheritedLangChainCallbacks(),\n sentryHandler,\n );\n\n const conversationIdMetadata = getConversationIdMetadataFromConfig(callOptions);\n if (Object.keys(conversationIdMetadata).length) {\n callOptions.metadata = { ...conversationIdMetadata, ...(callOptions.metadata as Record<string, unknown>) };\n }\n };\n\n for (const channelName of [CHANNELS.LANGCHAIN_CHAT_MODEL_INVOKE, CHANNELS.LANGCHAIN_CHAT_MODEL_STREAM]) {\n diagnosticsChannel.tracingChannel<OrchestrionChannelContext>(channelName).start.subscribe(message => {\n markProvidersSkipped();\n injectHandler(message);\n });\n }\n\n // `TypeSafeClassifier` calls Jev with `fetch`, not through a provider SDK, so nothing needs skipping.\n diagnosticsChannel\n .tracingChannel<OrchestrionChannelContext>(CHANNELS.LANGCHAIN_TYPESAFE_CLASSIFIER_INVOKE)\n .start.subscribe(message => {\n injectHandler(message);\n const { self, arguments: args } = message as OrchestrionChannelContext;\n recordTypeSafeClassifierState(self, args?.[0]);\n });\n}\n\n// Embeddings don't use the callback system. Wrap the method in its own span.\n// Embedding errors reject to the caller, so we only open the span (which bindTracingChannelToSpan\n// still marks failed on error) and do not capture them.\nfunction instrumentEmbeddings(options: LangChainOptions): void {\n for (const channelName of langchainEmbeddingsChannels) {\n bindTracingChannelToSpan(\n diagnosticsChannel.tracingChannel<EmbeddingsChannelContext>(channelName),\n data => createEmbeddingsSpan(data, options),\n {\n beforeSpanEnd: (_span, data) =>\n data._sentryOnSpanEnd?.('error' in data ? { error: data.error } : { response: data.result }),\n },\n );\n }\n}\n\nfunction createEmbeddingsSpan(data: EmbeddingsChannelContext, options: LangChainOptions): Span {\n // `embedQuery`/`embedDocuments` call the provider SDK internally, so skip that SDK's own\n // instrumentation before its channel fires (the producer runs at the embeddings channel's `start`).\n markProvidersSkipped();\n\n const call: LangChainEmbeddingsCallInfo = { operation: 'embeddings', input: (data.arguments ?? [])[0] };\n const span = startInactiveSpan(_INTERNAL_getLangChainEmbeddingsSpanOptions(data.self, call, options));\n runGenAiSpanStart(options, span, call);\n data._sentryOnSpanEnd = result => runGenAiSpanEnd(options, span, call, result);\n\n return span;\n}\n\n/**\n * Diagnostics-channel-based LangChain integration. Subscribes to the diagnostics_channels\n * injected into `@langchain/core`'s `BaseChatModel` (to inject the Sentry callback handler) and into\n * `@langchain/openai`'s embedding methods, so it requires the Sentry runtime hook or bundler plugin.\n */\nexport const langChainIntegration = defineIntegration(_langChainIntegration);\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4BA,MAAM,mBAAmB;AAQzB,MAAM,oBAAoB;CACxB;CACA;CACA;CACA;CAEA;AACF;AAQA,SAAS,uBAA6B;CACpC,iCAAiC,iBAAiB;AACpD;AAEA,MAAM,0BAA0B,UAA4B,CAAC,MAAM;CACjE,OAAO;EACL,MAAM;EACN,MAAM,QAAQ;GAKZ,iCAAiC,QAAQ,sBAAsB,sBAAsB,CAAC,OAAO,GAAG,EAC9F,+BAA+B,MACjC,CAAC;GAGD,iCAAiC,QAAQ,sBAAsB,sBAAsB,CAAC,OAAO,CAAC;EAChG;CACF;AACF;AAEA,SAAS,qBAAqB,SAAiC;CAE7D,MAAM,gBAAgB,+BAA+B,OAAO;CAK5D,MAAM,iBAAiB,YAA2B;EAChD,MAAM,OAAQ,QAAsC;EACpD,IAAI,CAAC,MAAM,QAAQ,IAAI,GACrB;EAGF,IAAI,cAAc,KAAK;EACvB,IAAI,CAAC,eAAe,OAAO,gBAAgB,YAAY,MAAM,QAAQ,WAAW,GAAG;GACjF,cAAc,CAAC;GACf,KAAK,KAAK;EACZ;EAGA,YAAY,YAAY,wCACtB,YA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from "./config/aws-sdk.js";
|
|
4
|
+
import { clickhouseChannels } from "./config/clickhouse.js";
|
|
4
5
|
import { cronChannels } from "./config/cron.js";
|
|
5
6
|
import { dataloaderChannels } from "./config/dataloader.js";
|
|
6
7
|
import { expressChannels } from "./config/express.js";
|
|
@@ -62,6 +63,7 @@ const CHANNELS = {
|
|
|
62
63
|
...amqplibChannels,
|
|
63
64
|
...anthropicAiChannels,
|
|
64
65
|
...awsSdkChannels,
|
|
66
|
+
...clickhouseChannels,
|
|
65
67
|
...cronChannels,
|
|
66
68
|
...dataloaderChannels,
|
|
67
69
|
...expressChannels,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channels.js","names":[],"sources":["../../../src/orchestrion/channels.ts"],"sourcesContent":["import { amqplibChannels } from './config/amqplib';\nimport { anthropicAiChannels } from './config/anthropic-ai';\nimport { awsSdkChannels } from './config/aws-sdk';\nimport { cronChannels } from './config/cron';\nimport { dataloaderChannels } from './config/dataloader';\nimport { expressChannels } from './config/express';\nimport { firebaseChannels } from './config/firebase';\nimport { genericPoolChannels } from './config/generic-pool';\nimport { googleGenAiChannels } from './config/google-genai';\nimport { graphqlChannels } from './config/graphql';\nimport { groqChannels } from './config/groq';\nimport { hapiChannels } from './config/hapi';\nimport { honoChannels } from './config/hono';\nimport { ioredisChannels } from './config/ioredis';\nimport { kafkajsChannels } from './config/kafkajs';\nimport { knexChannels } from './config/knex';\nimport { koaChannels } from './config/koa';\nimport { langchainChannels } from './config/langchain';\nimport { langgraphChannels } from './config/langgraph';\nimport { lruMemoizerChannels } from './config/lru-memoizer';\nimport { mastraChannels } from './config/mastra';\nimport { mcpServerChannels } from './config/mcp-server';\nimport { mistralChannels } from './config/mistral';\nimport { mongodbChannels } from './config/mongodb';\nimport { mongooseChannels } from './config/mongoose';\nimport { mysql2Channels } from './config/mysql2';\nimport { mysqlChannels } from './config/mysql';\nimport { neonChannels } from './config/neon';\nimport { nestjsChannels } from './config/nestjs';\nimport { nodeCronChannels } from './config/node-cron';\nimport { nodeScheduleChannels } from './config/node-schedule';\nimport { openaiChannels } from './config/openai';\nimport { pgChannels } from './config/pg';\nimport { piAiChannels } from './config/pi-ai';\nimport { piDurableChannels } from './config/pi-durable';\nimport { postgresJsChannels } from './config/postgres';\nimport { prismaChannels } from './config/prisma';\nimport { redisChannels } from './config/redis';\nimport { remixChannels } from './config/remix';\nimport { tediousChannels } from './config/tedious';\nimport { togetherAiChannels } from './config/together-ai';\nimport { typesafeChannels } from './config/typesafe';\nimport { vercelAiChannels } from './config/vercel-ai';\n\n/**\n * Fully-qualified `diagnostics_channel` names that orchestrion publishes to.\n *\n * Orchestrion's transform always prefixes the configured `channelName` with\n * `orchestrion:${module.name}:`. So a config of\n * `{ channelName: 'query', module: { name: 'mysql' } }`\n * publishes to `orchestrion:mysql:query`.\n *\n * Subscribers (`integrations/<lib>/tracing-channel.ts`) consume the full\n * prefixed string from this map; the config files set only the unprefixed\n * suffix in `channelName`. Keeping both pieces in one file is what guarantees\n * they don't drift apart and silently stop firing.\n *\n * Kept sorted alphabetically by module so concurrent additions insert at different\n * points rather than all appending to the end (fewer merge conflicts).\n */\nexport const CHANNELS = {\n ...amqplibChannels,\n ...anthropicAiChannels,\n ...awsSdkChannels,\n ...cronChannels,\n ...dataloaderChannels,\n ...expressChannels,\n ...firebaseChannels,\n ...genericPoolChannels,\n ...googleGenAiChannels,\n ...graphqlChannels,\n ...groqChannels,\n ...hapiChannels,\n ...honoChannels,\n ...ioredisChannels,\n ...kafkajsChannels,\n ...knexChannels,\n ...koaChannels,\n ...langchainChannels,\n ...langgraphChannels,\n ...lruMemoizerChannels,\n ...mastraChannels,\n ...mcpServerChannels,\n ...mistralChannels,\n ...mongodbChannels,\n ...mongooseChannels,\n ...mysql2Channels,\n ...mysqlChannels,\n ...neonChannels,\n ...nestjsChannels,\n ...nodeCronChannels,\n ...nodeScheduleChannels,\n ...openaiChannels,\n ...pgChannels,\n ...piAiChannels,\n ...piDurableChannels,\n ...postgresJsChannels,\n ...prismaChannels,\n ...redisChannels,\n ...remixChannels,\n ...tediousChannels,\n ...togetherAiChannels,\n ...typesafeChannels,\n ...vercelAiChannels,\n} as const;\n\nexport type ChannelName = (typeof CHANNELS)[keyof typeof CHANNELS];\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"channels.js","names":[],"sources":["../../../src/orchestrion/channels.ts"],"sourcesContent":["import { amqplibChannels } from './config/amqplib';\nimport { anthropicAiChannels } from './config/anthropic-ai';\nimport { awsSdkChannels } from './config/aws-sdk';\nimport { clickhouseChannels } from './config/clickhouse';\nimport { cronChannels } from './config/cron';\nimport { dataloaderChannels } from './config/dataloader';\nimport { expressChannels } from './config/express';\nimport { firebaseChannels } from './config/firebase';\nimport { genericPoolChannels } from './config/generic-pool';\nimport { googleGenAiChannels } from './config/google-genai';\nimport { graphqlChannels } from './config/graphql';\nimport { groqChannels } from './config/groq';\nimport { hapiChannels } from './config/hapi';\nimport { honoChannels } from './config/hono';\nimport { ioredisChannels } from './config/ioredis';\nimport { kafkajsChannels } from './config/kafkajs';\nimport { knexChannels } from './config/knex';\nimport { koaChannels } from './config/koa';\nimport { langchainChannels } from './config/langchain';\nimport { langgraphChannels } from './config/langgraph';\nimport { lruMemoizerChannels } from './config/lru-memoizer';\nimport { mastraChannels } from './config/mastra';\nimport { mcpServerChannels } from './config/mcp-server';\nimport { mistralChannels } from './config/mistral';\nimport { mongodbChannels } from './config/mongodb';\nimport { mongooseChannels } from './config/mongoose';\nimport { mysql2Channels } from './config/mysql2';\nimport { mysqlChannels } from './config/mysql';\nimport { neonChannels } from './config/neon';\nimport { nestjsChannels } from './config/nestjs';\nimport { nodeCronChannels } from './config/node-cron';\nimport { nodeScheduleChannels } from './config/node-schedule';\nimport { openaiChannels } from './config/openai';\nimport { pgChannels } from './config/pg';\nimport { piAiChannels } from './config/pi-ai';\nimport { piDurableChannels } from './config/pi-durable';\nimport { postgresJsChannels } from './config/postgres';\nimport { prismaChannels } from './config/prisma';\nimport { redisChannels } from './config/redis';\nimport { remixChannels } from './config/remix';\nimport { tediousChannels } from './config/tedious';\nimport { togetherAiChannels } from './config/together-ai';\nimport { typesafeChannels } from './config/typesafe';\nimport { vercelAiChannels } from './config/vercel-ai';\n\n/**\n * Fully-qualified `diagnostics_channel` names that orchestrion publishes to.\n *\n * Orchestrion's transform always prefixes the configured `channelName` with\n * `orchestrion:${module.name}:`. So a config of\n * `{ channelName: 'query', module: { name: 'mysql' } }`\n * publishes to `orchestrion:mysql:query`.\n *\n * Subscribers (`integrations/<lib>/tracing-channel.ts`) consume the full\n * prefixed string from this map; the config files set only the unprefixed\n * suffix in `channelName`. Keeping both pieces in one file is what guarantees\n * they don't drift apart and silently stop firing.\n *\n * Kept sorted alphabetically by module so concurrent additions insert at different\n * points rather than all appending to the end (fewer merge conflicts).\n */\nexport const CHANNELS = {\n ...amqplibChannels,\n ...anthropicAiChannels,\n ...awsSdkChannels,\n ...clickhouseChannels,\n ...cronChannels,\n ...dataloaderChannels,\n ...expressChannels,\n ...firebaseChannels,\n ...genericPoolChannels,\n ...googleGenAiChannels,\n ...graphqlChannels,\n ...groqChannels,\n ...hapiChannels,\n ...honoChannels,\n ...ioredisChannels,\n ...kafkajsChannels,\n ...knexChannels,\n ...koaChannels,\n ...langchainChannels,\n ...langgraphChannels,\n ...lruMemoizerChannels,\n ...mastraChannels,\n ...mcpServerChannels,\n ...mistralChannels,\n ...mongodbChannels,\n ...mongooseChannels,\n ...mysql2Channels,\n ...mysqlChannels,\n ...neonChannels,\n ...nestjsChannels,\n ...nodeCronChannels,\n ...nodeScheduleChannels,\n ...openaiChannels,\n ...pgChannels,\n ...piAiChannels,\n ...piDurableChannels,\n ...postgresJsChannels,\n ...prismaChannels,\n ...redisChannels,\n ...remixChannels,\n ...tediousChannels,\n ...togetherAiChannels,\n ...typesafeChannels,\n ...vercelAiChannels,\n} as const;\n\nexport type ChannelName = (typeof CHANNELS)[keyof typeof CHANNELS];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,MAAa,WAAW;CACtB,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;AACL"}
|
|
@@ -29,6 +29,14 @@ const CHANNEL_INTEGRATION_DEFINITIONS = [
|
|
|
29
29
|
exportName: "neonIntegration",
|
|
30
30
|
modules: ["@neondatabase/serverless"]
|
|
31
31
|
},
|
|
32
|
+
{
|
|
33
|
+
exportName: "clickhouseIntegration",
|
|
34
|
+
modules: [
|
|
35
|
+
"@clickhouse/client",
|
|
36
|
+
"@clickhouse/client-web",
|
|
37
|
+
"@clickhouse/client-common"
|
|
38
|
+
]
|
|
39
|
+
},
|
|
32
40
|
{
|
|
33
41
|
exportName: "prismaIntegration",
|
|
34
42
|
modules: ["@prisma/orm-family-sql"]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel-integration-definitions.js","names":[],"sources":["../../../../src/orchestrion/config/channel-integration-definitions.ts"],"sourcesContent":["/**\n * Build-time metadata mapping each channel-subscriber integration — by the\n * `exportName` it is published under from `@sentry/server-utils` — to the\n * instrumented packages (orchestrion `module.name`) whose channels it\n * consumes.\n *\n * Kept in a separate, factory-free module on purpose: the module-injected\n * transform (reachable from every orchestrion bundler plugin) reads this to\n * generate the tiny snippet it injects into each instrumented file, and must\n * not drag any subscriber code — or its `@sentry/core` span machinery — into\n * the plugin's own build to do so.\n *\n * `exportName` must be a named export of `@sentry/server-utils`.\n * `modules` must match `module.name` values in `SENTRY_INSTRUMENTATIONS` — e.g.\n * `postgresIntegration` covers both `pg` and `pg-pool`, and `redisIntegration`\n * covers `redis`, `@redis/client` and `ioredis`.\n */\nexport const CHANNEL_INTEGRATION_DEFINITIONS = [\n { exportName: 'postgresIntegration', modules: ['pg', 'pg-pool'] },\n { exportName: 'postgresJsIntegration', modules: ['postgres'] },\n { exportName: 'neonIntegration', modules: ['@neondatabase/serverless'] },\n { exportName: 'prismaIntegration', modules: ['@prisma/orm-family-sql'] },\n { exportName: 'mysqlIntegration', modules: ['mysql'] },\n { exportName: 'mysql2Integration', modules: ['mysql2'] },\n { exportName: 'mongoIntegration', modules: ['mongodb'] },\n { exportName: 'mongooseIntegration', modules: ['mongoose'] },\n { exportName: 'knexIntegration', modules: ['knex'] },\n { exportName: 'tediousIntegration', modules: ['tedious'] },\n { exportName: 'genericPoolIntegration', modules: ['generic-pool'] },\n { exportName: 'lruMemoizerIntegration', modules: ['lru-memoizer'] },\n { exportName: 'openAIIntegration', modules: ['openai'] },\n { exportName: 'anthropicAIIntegration', modules: ['@anthropic-ai/sdk'] },\n { exportName: 'googleGenAIIntegration', modules: ['@google/genai'] },\n { exportName: 'mistralAIIntegration', modules: ['@mistralai/mistralai'] },\n { exportName: 'groqIntegration', modules: ['groq-sdk'] },\n { exportName: 'togetherAIIntegration', modules: ['together-ai'] },\n { exportName: 'typesafeIntegration', modules: ['@typesafe-ai/sdk'] },\n { exportName: 'vercelAIIntegration', modules: ['ai'] },\n {\n exportName: 'langChainIntegration',\n modules: [\n '@langchain/core',\n '@langchain/openai',\n '@langchain/google-common',\n '@langchain/google-genai',\n '@langchain/mistralai',\n '@langchain/typesafe',\n ],\n },\n { exportName: 'langGraphIntegration', modules: ['@langchain/langgraph'] },\n { exportName: 'mastraIntegration', modules: ['@mastra/core'] },\n { exportName: 'flueIntegration', modules: ['@flue/runtime'] },\n { exportName: 'piAiIntegration', modules: ['@earendil-works/pi-ai'] },\n { exportName: 'piDurableIntegration', modules: ['@earendil-works/pi-durable'] },\n { exportName: 'mcpServerIntegration', modules: ['@modelcontextprotocol/server', '@modelcontextprotocol/sdk'] },\n { exportName: 'awsIntegration', modules: ['@aws-sdk/smithy-client', '@smithy/core', '@smithy/smithy-client'] },\n { exportName: 'firebaseIntegration', modules: ['@firebase/firestore', 'firebase-functions'] },\n { exportName: 'amqplibIntegration', modules: ['amqplib'] },\n { exportName: 'hapiIntegration', modules: ['@hapi/hapi'] },\n { exportName: 'honoIntegration', modules: ['hono'] },\n { exportName: 'koaIntegration', modules: ['koa'] },\n { exportName: 'expressIntegration', modules: ['express', 'router'] },\n { exportName: 'graphqlIntegration', modules: ['graphql'] },\n { exportName: 'kafkaIntegration', modules: ['kafkajs'] },\n { exportName: 'redisIntegration', modules: ['redis', '@redis/client', 'ioredis'] },\n { exportName: 'dataloaderIntegration', modules: ['dataloader'] },\n { exportName: 'nitroIntegration', modules: ['h3'] },\n] as const satisfies ReadonlyArray<{ exportName: string; modules: readonly string[] }>;\n\n/** Look up the subscriber export name for an instrumented package, if any. */\nexport function subscriberExportForModule(moduleName: string): string | undefined {\n return CHANNEL_INTEGRATION_DEFINITIONS.find(d => (d.modules as readonly string[]).includes(moduleName))?.exportName;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,MAAa,kCAAkC;CAC7C;EAAE,YAAY;EAAuB,SAAS,CAAC,MAAM,SAAS;CAAE;CAChE;EAAE,YAAY;EAAyB,SAAS,CAAC,UAAU;CAAE;CAC7D;EAAE,YAAY;EAAmB,SAAS,CAAC,0BAA0B;CAAE;CACvE;EAAE,YAAY;EAAqB,SAAS,CAAC,wBAAwB;CAAE;CACvE;EAAE,YAAY;EAAoB,SAAS,CAAC,OAAO;CAAE;CACrD;EAAE,YAAY;EAAqB,SAAS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CAC5F;EAAE,YAAY;EAAsB,SAAS,CAAC,SAAS;CAAE;CACzD;EAAE,YAAY;EAAmB,SAAS,CAAC,YAAY;CAAE;CACzD;EAAE,YAAY;EAAmB,SAAS,CAAC,MAAM;CAAE;CACnD;EAAE,YAAY;EAAkB,SAAS,CAAC,KAAK;CAAE;CACjD;EAAE,YAAY;EAAsB,SAAS,CAAC,WAAW,QAAQ;CAAE;CACnE;EAAE,YAAY;EAAsB,SAAS,CAAC,SAAS;CAAE;CACzD;EAAE,YAAY;EAAoB,SAAS,CAAC,SAAS;CAAE;CACvD;EAAE,YAAY;EAAoB,SAAS;GAAC;GAAS;GAAiB;EAAS;CAAE;CACjF;EAAE,YAAY;EAAyB,SAAS,CAAC,YAAY;CAAE;CAC/D;EAAE,YAAY;EAAoB,SAAS,CAAC,IAAI;CAAE;AACpD;;AAGA,SAAgB,0BAA0B,YAAwC;CAChF,OAAO,gCAAgC,MAAK,MAAM,EAAE,QAA8B,SAAS,UAAU,CAAC,CAAC,EAAE;AAC3G"}
|
|
1
|
+
{"version":3,"file":"channel-integration-definitions.js","names":[],"sources":["../../../../src/orchestrion/config/channel-integration-definitions.ts"],"sourcesContent":["/**\n * Build-time metadata mapping each channel-subscriber integration — by the\n * `exportName` it is published under from `@sentry/server-utils` — to the\n * instrumented packages (orchestrion `module.name`) whose channels it\n * consumes.\n *\n * Kept in a separate, factory-free module on purpose: the module-injected\n * transform (reachable from every orchestrion bundler plugin) reads this to\n * generate the tiny snippet it injects into each instrumented file, and must\n * not drag any subscriber code — or its `@sentry/core` span machinery — into\n * the plugin's own build to do so.\n *\n * `exportName` must be a named export of `@sentry/server-utils`.\n * `modules` must match `module.name` values in `SENTRY_INSTRUMENTATIONS` — e.g.\n * `postgresIntegration` covers both `pg` and `pg-pool`, and `redisIntegration`\n * covers `redis`, `@redis/client` and `ioredis`.\n */\nexport const CHANNEL_INTEGRATION_DEFINITIONS = [\n { exportName: 'postgresIntegration', modules: ['pg', 'pg-pool'] },\n { exportName: 'postgresJsIntegration', modules: ['postgres'] },\n { exportName: 'neonIntegration', modules: ['@neondatabase/serverless'] },\n {\n exportName: 'clickhouseIntegration',\n modules: ['@clickhouse/client', '@clickhouse/client-web', '@clickhouse/client-common'],\n },\n { exportName: 'prismaIntegration', modules: ['@prisma/orm-family-sql'] },\n { exportName: 'mysqlIntegration', modules: ['mysql'] },\n { exportName: 'mysql2Integration', modules: ['mysql2'] },\n { exportName: 'mongoIntegration', modules: ['mongodb'] },\n { exportName: 'mongooseIntegration', modules: ['mongoose'] },\n { exportName: 'knexIntegration', modules: ['knex'] },\n { exportName: 'tediousIntegration', modules: ['tedious'] },\n { exportName: 'genericPoolIntegration', modules: ['generic-pool'] },\n { exportName: 'lruMemoizerIntegration', modules: ['lru-memoizer'] },\n { exportName: 'openAIIntegration', modules: ['openai'] },\n { exportName: 'anthropicAIIntegration', modules: ['@anthropic-ai/sdk'] },\n { exportName: 'googleGenAIIntegration', modules: ['@google/genai'] },\n { exportName: 'mistralAIIntegration', modules: ['@mistralai/mistralai'] },\n { exportName: 'groqIntegration', modules: ['groq-sdk'] },\n { exportName: 'togetherAIIntegration', modules: ['together-ai'] },\n { exportName: 'typesafeIntegration', modules: ['@typesafe-ai/sdk'] },\n { exportName: 'vercelAIIntegration', modules: ['ai'] },\n {\n exportName: 'langChainIntegration',\n modules: [\n '@langchain/core',\n '@langchain/openai',\n '@langchain/google-common',\n '@langchain/google-genai',\n '@langchain/mistralai',\n '@langchain/typesafe',\n ],\n },\n { exportName: 'langGraphIntegration', modules: ['@langchain/langgraph'] },\n { exportName: 'mastraIntegration', modules: ['@mastra/core'] },\n { exportName: 'flueIntegration', modules: ['@flue/runtime'] },\n { exportName: 'piAiIntegration', modules: ['@earendil-works/pi-ai'] },\n { exportName: 'piDurableIntegration', modules: ['@earendil-works/pi-durable'] },\n { exportName: 'mcpServerIntegration', modules: ['@modelcontextprotocol/server', '@modelcontextprotocol/sdk'] },\n { exportName: 'awsIntegration', modules: ['@aws-sdk/smithy-client', '@smithy/core', '@smithy/smithy-client'] },\n { exportName: 'firebaseIntegration', modules: ['@firebase/firestore', 'firebase-functions'] },\n { exportName: 'amqplibIntegration', modules: ['amqplib'] },\n { exportName: 'hapiIntegration', modules: ['@hapi/hapi'] },\n { exportName: 'honoIntegration', modules: ['hono'] },\n { exportName: 'koaIntegration', modules: ['koa'] },\n { exportName: 'expressIntegration', modules: ['express', 'router'] },\n { exportName: 'graphqlIntegration', modules: ['graphql'] },\n { exportName: 'kafkaIntegration', modules: ['kafkajs'] },\n { exportName: 'redisIntegration', modules: ['redis', '@redis/client', 'ioredis'] },\n { exportName: 'dataloaderIntegration', modules: ['dataloader'] },\n { exportName: 'nitroIntegration', modules: ['h3'] },\n] as const satisfies ReadonlyArray<{ exportName: string; modules: readonly string[] }>;\n\n/** Look up the subscriber export name for an instrumented package, if any. */\nexport function subscriberExportForModule(moduleName: string): string | undefined {\n return CHANNEL_INTEGRATION_DEFINITIONS.find(d => (d.modules as readonly string[]).includes(moduleName))?.exportName;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,MAAa,kCAAkC;CAC7C;EAAE,YAAY;EAAuB,SAAS,CAAC,MAAM,SAAS;CAAE;CAChE;EAAE,YAAY;EAAyB,SAAS,CAAC,UAAU;CAAE;CAC7D;EAAE,YAAY;EAAmB,SAAS,CAAC,0BAA0B;CAAE;CACvE;EACE,YAAY;EACZ,SAAS;GAAC;GAAsB;GAA0B;EAA2B;CACvF;CACA;EAAE,YAAY;EAAqB,SAAS,CAAC,wBAAwB;CAAE;CACvE;EAAE,YAAY;EAAoB,SAAS,CAAC,OAAO;CAAE;CACrD;EAAE,YAAY;EAAqB,SAAS,CAAC,QAAQ;CAAE;CACvD;EAAE,YAAY;EAAoB,SAAS,CAAC,SAAS;CAAE;CACvD;EAAE,YAAY;EAAuB,SAAS,CAAC,UAAU;CAAE;CAC3D;EAAE,YAAY;EAAmB,SAAS,CAAC,MAAM;CAAE;CACnD;EAAE,YAAY;E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AK;CAAE;CACjD;EAAE,YAAY;EAAsB,SAAS,CAAC,WAAW,QAAQ;CAAE;CACnE;EAAE,YAAY;EAAsB,SAAS,CAAC,SAAS;CAAE;CACzD;EAAE,YAAY;EAAoB,SAAS,CAAC,SAAS;CAAE;CACvD;EAAE,YAAY;EAAoB,SAAS;GAAC;GAAS;GAAiB;EAAS;CAAE;CACjF;EAAE,YAAY;EAAyB,SAAS,CAAC,YAAY;CAAE;CAC/D;EAAE,YAAY;EAAoB,SAAS,CAAC,IAAI;CAAE;AACpD;;AAGA,SAAgB,0BAA0B,YAAwC;CAChF,OAAO,gCAAgC,MAAK,MAAM,EAAE,QAA8B,SAAS,UAAU,CAAC,CAAC,EAAE;AAC3G"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { getModuleNames } from "./module-names.js";
|
|
2
|
+
// src/orchestrion/config/clickhouse.ts
|
|
3
|
+
const METHODS = [
|
|
4
|
+
"query",
|
|
5
|
+
"command",
|
|
6
|
+
"exec",
|
|
7
|
+
"insert"
|
|
8
|
+
];
|
|
9
|
+
const clickhouseConfig = [
|
|
10
|
+
{
|
|
11
|
+
name: "@clickhouse/client-common",
|
|
12
|
+
versionRange: ">=1.1.0 <1.23.0",
|
|
13
|
+
filePath: "dist/client.js"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: "@clickhouse/client",
|
|
17
|
+
versionRange: ">=1.23.0 <2",
|
|
18
|
+
filePath: "dist/common/client.js"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "@clickhouse/client-web",
|
|
22
|
+
versionRange: ">=1.23.0 <2",
|
|
23
|
+
filePath: "dist/common/client.js"
|
|
24
|
+
}
|
|
25
|
+
].flatMap((module) => METHODS.map((methodName) => ({
|
|
26
|
+
channelName: methodName,
|
|
27
|
+
module,
|
|
28
|
+
functionQuery: {
|
|
29
|
+
className: "ClickHouseClient",
|
|
30
|
+
methodName,
|
|
31
|
+
kind: "Async"
|
|
32
|
+
}
|
|
33
|
+
})));
|
|
34
|
+
const clickhouseModuleNames = getModuleNames(clickhouseConfig);
|
|
35
|
+
const clickhouseChannels = {
|
|
36
|
+
CLICKHOUSE_QUERY: "orchestrion:@clickhouse/client:query",
|
|
37
|
+
CLICKHOUSE_COMMAND: "orchestrion:@clickhouse/client:command",
|
|
38
|
+
CLICKHOUSE_EXEC: "orchestrion:@clickhouse/client:exec",
|
|
39
|
+
CLICKHOUSE_INSERT: "orchestrion:@clickhouse/client:insert",
|
|
40
|
+
CLICKHOUSE_WEB_QUERY: "orchestrion:@clickhouse/client-web:query",
|
|
41
|
+
CLICKHOUSE_WEB_COMMAND: "orchestrion:@clickhouse/client-web:command",
|
|
42
|
+
CLICKHOUSE_WEB_EXEC: "orchestrion:@clickhouse/client-web:exec",
|
|
43
|
+
CLICKHOUSE_WEB_INSERT: "orchestrion:@clickhouse/client-web:insert",
|
|
44
|
+
CLICKHOUSE_COMMON_QUERY: "orchestrion:@clickhouse/client-common:query",
|
|
45
|
+
CLICKHOUSE_COMMON_COMMAND: "orchestrion:@clickhouse/client-common:command",
|
|
46
|
+
CLICKHOUSE_COMMON_EXEC: "orchestrion:@clickhouse/client-common:exec",
|
|
47
|
+
CLICKHOUSE_COMMON_INSERT: "orchestrion:@clickhouse/client-common:insert"
|
|
48
|
+
};
|
|
49
|
+
export { clickhouseChannels, clickhouseConfig, clickhouseModuleNames };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=clickhouse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clickhouse.js","names":[],"sources":["../../../../src/orchestrion/config/clickhouse.ts"],"sourcesContent":["import type { InstrumentationConfig } from '../apmTypes';\n\nimport { getModuleNames } from './module-names';\n\n// `ClickHouseClient` sends every statement through four `async` methods: `query`, `command`, `exec`\n// and `insert`. None of them calls another, so each call is traced as exactly one db span. `ping`\n// and `close` carry no statement and are left alone.\n//\n// Two file layouts across the supported range:\n// - `< 1.23.0` → the class lives in the separate `@clickhouse/client-common` package (`dist/client.js`)\n// - `>= 1.23.0` → `@clickhouse/client` and `@clickhouse/client-web` each ship that code in\n// `dist/common/client.js`\n//\n// Starts at 1.1.0: before it, `command` delegated to `exec` (two spans per command) and the client\n// did not keep the `connectionParams` the span attributes are read from.\n//\n// The Node.js `NodeClickHouseClient` subclass only forwards `query` to `super`, and its class name\n// doesn't match `className`, so it doesn't add a second span.\nconst METHODS = ['query', 'command', 'exec', 'insert'] as const;\n\nconst MODULES = [\n { name: '@clickhouse/client-common', versionRange: '>=1.1.0 <1.23.0', filePath: 'dist/client.js' },\n { name: '@clickhouse/client', versionRange: '>=1.23.0 <2', filePath: 'dist/common/client.js' },\n { name: '@clickhouse/client-web', versionRange: '>=1.23.0 <2', filePath: 'dist/common/client.js' },\n];\n\nexport const clickhouseConfig: InstrumentationConfig[] = MODULES.flatMap(module =>\n METHODS.map(methodName => ({\n channelName: methodName,\n module,\n functionQuery: { className: 'ClickHouseClient', methodName, kind: 'Async' as const },\n })),\n);\n\nexport const clickhouseModuleNames = getModuleNames(clickhouseConfig);\n\nexport const clickhouseChannels = {\n CLICKHOUSE_QUERY: 'orchestrion:@clickhouse/client:query',\n CLICKHOUSE_COMMAND: 'orchestrion:@clickhouse/client:command',\n CLICKHOUSE_EXEC: 'orchestrion:@clickhouse/client:exec',\n CLICKHOUSE_INSERT: 'orchestrion:@clickhouse/client:insert',\n CLICKHOUSE_WEB_QUERY: 'orchestrion:@clickhouse/client-web:query',\n CLICKHOUSE_WEB_COMMAND: 'orchestrion:@clickhouse/client-web:command',\n CLICKHOUSE_WEB_EXEC: 'orchestrion:@clickhouse/client-web:exec',\n CLICKHOUSE_WEB_INSERT: 'orchestrion:@clickhouse/client-web:insert',\n CLICKHOUSE_COMMON_QUERY: 'orchestrion:@clickhouse/client-common:query',\n CLICKHOUSE_COMMON_COMMAND: 'orchestrion:@clickhouse/client-common:command',\n CLICKHOUSE_COMMON_EXEC: 'orchestrion:@clickhouse/client-common:exec',\n CLICKHOUSE_COMMON_INSERT: 'orchestrion:@clickhouse/client-common:insert',\n} as const;\n"],"mappings":";;AAkBA,MAAM,UAAU;CAAC;CAAS;CAAW;CAAQ;AAAQ;AAQrD,MAAa,mBAA4C;CALvD;EAAE,MAAM;EAA6B,cAAc;EAAmB,UAAU;CAAiB;CACjG;EAAE,MAAM;EAAsB,cAAc;EAAe,UAAU;CAAwB;CAC7F;EAAE,MAAM;EAA0B,cAAc;EAAe,UAAU;CAAwB;AAG1C,CAAA,CAAQ,SAAQ,WACvE,QAAQ,KAAI,gBAAe;CACzB,aAAa;CACb;CACA,eAAe;EAAE,WAAW;EAAoB;EAAY,MAAM;CAAiB;AACrF,EAAE,CACJ;AAEA,MAAa,wBAAwB,eAAe,gBAAgB;AAEpE,MAAa,qBAAqB;CAChC,kBAAkB;CAClB,oBAAoB;CACpB,iBAAiB;CACjB,mBAAmB;CACnB,sBAAsB;CACtB,wBAAwB;CACxB,qBAAqB;CACrB,uBAAuB;CACvB,yBAAyB;CACzB,2BAA2B;CAC3B,wBAAwB;CACxB,0BAA0B;AAC5B"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { awsSdkConfig } from "./aws-sdk.js";
|
|
2
2
|
import { amqplibConfig } from "./amqplib.js";
|
|
3
3
|
import { anthropicAiConfig } from "./anthropic-ai.js";
|
|
4
|
+
import { clickhouseConfig } from "./clickhouse.js";
|
|
4
5
|
import { cronConfig } from "./cron.js";
|
|
5
6
|
import { dataloaderConfig } from "./dataloader.js";
|
|
6
7
|
import { expressConfig } from "./express.js";
|
|
@@ -63,6 +64,7 @@ const SENTRY_INSTRUMENTATIONS = [
|
|
|
63
64
|
...amqplibConfig,
|
|
64
65
|
...anthropicAiConfig,
|
|
65
66
|
...awsSdkConfig,
|
|
67
|
+
...clickhouseConfig,
|
|
66
68
|
...cronConfig,
|
|
67
69
|
...dataloaderConfig,
|
|
68
70
|
...expressConfig,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/orchestrion/config/index.ts"],"sourcesContent":["import type { InstrumentationConfig } from '../apmTypes';\n\nimport { uniq } from '@sentry/core';\n\nimport { awsSdkConfig } from './aws-sdk';\nimport { amqplibConfig } from './amqplib';\nimport { anthropicAiConfig } from './anthropic-ai';\nimport { cronConfig } from './cron';\nimport { dataloaderConfig } from './dataloader';\nimport { expressConfig } from './express';\nimport { firebaseConfig } from './firebase';\nimport { genericPoolConfig } from './generic-pool';\nimport { googleGenAiConfig } from './google-genai';\nimport { graphqlConfig } from './graphql';\nimport { groqConfig } from './groq';\nimport { hapiConfig } from './hapi';\nimport { honoConfig } from './hono';\nimport { ioredisConfig } from './ioredis';\nimport { kafkajsConfig } from './kafkajs';\nimport { knexConfig } from './knex';\nimport { koaConfig } from './koa';\nimport { langchainConfig } from './langchain';\nimport { langgraphConfig } from './langgraph';\nimport { lruMemoizerConfig } from './lru-memoizer';\nimport { flueConfig } from './flue';\nimport { mastraConfig } from './mastra';\nimport { piAiConfig } from './pi-ai';\nimport { piDurableConfig } from './pi-durable';\nimport { mcpServerConfig } from './mcp-server';\nimport { mistralConfig } from './mistral';\nimport { mongodbConfig } from './mongodb';\nimport { mongooseConfig } from './mongoose';\nimport { mysql2Config } from './mysql2';\nimport { mysqlConfig } from './mysql';\nimport { neonConfig } from './neon';\nimport { nestjsConfig } from './nestjs';\nimport { nitroConfig } from './nitro';\nimport { nodeCronConfig } from './node-cron';\nimport { nodeScheduleConfig } from './node-schedule';\nimport { openaiConfig } from './openai';\nimport { pgConfig } from './pg';\nimport { postgresJsConfig } from './postgres';\nimport { prismaConfig } from './prisma';\nimport { redisConfig } from './redis';\nimport { remixConfig } from './remix';\nimport { remixV3Config } from './remix-v3';\nimport { tediousConfig } from './tedious';\nimport { togetherAiConfig } from './together-ai';\nimport { typesafeConfig } from './typesafe';\nimport { vercelAiConfig } from './vercel-ai';\n// Kept sorted alphabetically by module so concurrent additions insert at different\n// points rather than all appending to the end (fewer merge conflicts).\n\n/**\n * The orchestrion code-transform configs. Every instrumentable library is here\n * so the transform is all-or-nothing: whenever orchestrion is enabled, all of\n * these are injected. The channel LISTENERS may live elsewhere (e.g. the NestJS\n * one lives in `@sentry/nestjs`), but the config that decides what gets\n * transformed is centralized here.\n *\n * This module MUST stay pure, stateless data. It is loaded in more than one realm\n * at once — the build-time bundler plugin inlines it into the server chunk, while\n * `@sentry/server-runtime-injection`'s external `register` loads its own copy from\n * `node_modules` at runtime. Two identical, side-effect-free arrays are harmless;\n * any module-level mutable state here would silently diverge between those copies.\n */\nexport const SENTRY_INSTRUMENTATIONS: InstrumentationConfig[] = [\n ...amqplibConfig,\n ...anthropicAiConfig,\n ...awsSdkConfig,\n ...cronConfig,\n ...dataloaderConfig,\n ...expressConfig,\n ...firebaseConfig,\n ...genericPoolConfig,\n ...googleGenAiConfig,\n ...graphqlConfig,\n ...groqConfig,\n ...hapiConfig,\n ...honoConfig,\n ...ioredisConfig,\n ...kafkajsConfig,\n ...knexConfig,\n ...koaConfig,\n ...langchainConfig,\n ...langgraphConfig,\n ...lruMemoizerConfig,\n ...flueConfig,\n ...mastraConfig,\n ...mcpServerConfig,\n ...mistralConfig,\n ...mongodbConfig,\n ...mongooseConfig,\n ...mysql2Config,\n ...mysqlConfig,\n ...neonConfig,\n ...nestjsConfig,\n ...nitroConfig,\n ...nodeCronConfig,\n ...nodeScheduleConfig,\n ...openaiConfig,\n ...pgConfig,\n ...piAiConfig,\n ...piDurableConfig,\n ...postgresJsConfig,\n ...prismaConfig,\n ...redisConfig,\n ...remixConfig,\n ...remixV3Config,\n ...tediousConfig,\n ...togetherAiConfig,\n ...typesafeConfig,\n ...vercelAiConfig,\n];\n\n/**\n * The subset of {@link SENTRY_INSTRUMENTATIONS} the RUNTIME loader\n * (`@sentry/server-runtime-injection`'s `register`, reached via `--import` or\n * `Sentry.init()`) can actually apply.\n *\n * Registration-only configs (native-channel libraries such as `ai` v7,\n * `ioredis`, `@redis/client`, `mysql2`, `mongoose`) carry the custom\n * `MODULE_REGISTRATION_TRANSFORM` operator. That operator is wired into the\n * BUNDLER plugins only (see `orchestrion/bundler/moduleInjectedTransform.ts`,\n * applied via `bundler/options.ts`'s `customTransforms`); the runtime loader's\n * `initialize()` receives no custom transforms. Attempting one of these at\n * runtime therefore throws `TypeError: transform is not a function`, which the\n * loader misreports as the always-on \"`@sentry/server-runtime-injection` was\n * bundled ... loads uninstrumented\" warning even though nothing is wrong.\n *\n * Excluding them at runtime is correct, not just a way to silence the warning:\n * these libraries publish their own tracing channels, and their integrations\n * subscribe through `setupOnce()` / `waitForTracingChannelBinding`,\n * independently of the module-injected snippet. That snippet only fires\n * `orchestrion.module-injected`, which drives the `setup()` /\n * `invokeOrchestrionInstrumentation` path; for a native-channel version that\n * path subscribes to the injected `orchestrion:*` channels the library never\n * publishes — a no-op. So running these at runtime would add no spans. The\n * snippet earns its keep only on the BUNDLER path — notably bundler-only SDKs\n * (e.g. `@sentry/cloudflare`) that discover a loaded module via that event to\n * instantiate its integration factory. `@sentry/node` registers its\n * integrations statically, so it does not need it.\n */\nexport const SENTRY_RUNTIME_INSTRUMENTATIONS: InstrumentationConfig[] = SENTRY_INSTRUMENTATIONS.filter(\n config => !config.transform,\n);\n\n/**\n * The unique set of package names instrumented by `SENTRY_INSTRUMENTATIONS`\n * merged with any caller-provided `instrumentations` (e.g. `['mysql']`).\n *\n * Bundler plugins MUST ensure these are actually bundled rather than\n * externalized: an externalized dependency is resolved from `node_modules` at\n * runtime and never passes through the code transform's `onLoad`, so its\n * diagnostics_channel calls are silently never injected. This includes a\n * plugin's custom `instrumentations`, otherwise those extra packages can stay\n * externalized and their transform never runs.\n */\nexport function instrumentedModuleNames(instrumentations: InstrumentationConfig[] = []): string[] {\n return [\n ...uniq([...SENTRY_INSTRUMENTATIONS, ...instrumentations].map(i => i.module.name)),\n // Additional things that need to be bundled but are not covered by the above\n // Remix needs to bundle this so @remix-run/server-runtime is _also_ bundled\n '@remix-run/node',\n ];\n}\n\n/** The instrumented module names from the default Sentry config, with no custom additions. */\nexport const INSTRUMENTED_MODULE_NAMES: string[] = instrumentedModuleNames();\n\n/**\n * The package names the SDK instruments through the orchestrion module transform (its\n * diagnostics-channel injection). Pass these to a server bundler's \"keep external\" option so the\n * packages load through Node's module loader — the only path the transform can hook — instead of\n * being inlined into the server bundle. A framework that has no Sentry bundler plugin (e.g. eve, via\n * `build.externalDependencies`) is the main caller; a listed package the app doesn't use is simply\n * ignored by the bundler.\n *\n * Unlike {@link INSTRUMENTED_MODULE_NAMES}, this is the plain instrumented set with no bundler-only\n * additions — those force a helper package to be *bundled*, the opposite of keeping it external.\n */\nexport function getInstrumentedModuleNames(): string[] {\n return uniq(SENTRY_INSTRUMENTATIONS.map(instrumentation => instrumentation.module.name));\n}\n\n/**\n * Returns `external` with any instrumented packages removed, so a bundler that\n * uses an \"external\" denylist (esbuild, Bun, Rollup) still bundles — and thus\n * transforms — them. Matches an exact package name (`'mysql'`) or a subpath\n * (`'mysql/lib/...'`); wildcard/other patterns are left untouched. `undefined`\n * is returned unchanged.\n *\n * Pass `moduleNames` from `instrumentedModuleNames(options.instrumentations)` so\n * custom instrumentations are stripped too; it defaults to the Sentry config\n * list. (Vite uses an `ssr.noExternal` allowlist instead, so it consumes\n * `instrumentedModuleNames` directly rather than this helper.)\n */\nexport function withoutInstrumentedExternals(\n external: readonly string[] | undefined,\n moduleNames: string[] = INSTRUMENTED_MODULE_NAMES,\n): string[] | undefined {\n if (!external) {\n return undefined;\n }\n return external.filter(entry => !moduleNames.some(name => entry === name || entry.startsWith(`${name}/`)));\n}\n\n// This is exported so that the nestjs package can use it to subscribe to the channels.\nexport { nestjsChannels } from './nestjs';\n// This is exported so that the remix package can use it to subscribe to the channels.\nexport { remixChannels } from './remix';\n// Exported so the remix package can subscribe to the Remix 3 channels, and hand only these configs to\n// the browser transform.\nexport { remixV3Channels, remixV3Config } from './remix-v3';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,MAAa,0BAAmD;CAC9D,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;CACH,GAAG;AACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAa,kCAA2D,wBAAwB,QAC9F,WAAU,CAAC,OAAO,SACpB;;;;;;;;;;;;AAaA,SAAgB,wBAAwB,mBAA4C,CAAC,GAAa;CAChG,OAAO,CACL,GAAG,KAAK,CAAC,GAAG,yBAAyB,GAAG,gBAAgB,CAAC,CAAC,KAAI,MAAK,EAAE,OAAO,IAAI,CAAC,GAGjF,iBACF;AACF;;AAGA,MAAa,4BAAsC,wBAAwB;;;;;;;;;;;;AAa3E,SAAgB,6BAAuC;CACrD,OAAO,KAAK,wBAAwB,KAAI,oBAAmB,gBAAgB,OAAO,IAAI,CAAC;AACzF;;;;;;;;;;;;;AAcA,SAAgB,6BACd,UACA,cAAwB,2BACF;CACtB,IAAI,CAAC,UACH;CAEF,OAAO,SAAS,QAAO,UAAS,CAAC,YAAY,MAAK,SAAQ,UAAU,QAAQ,MAAM,WAAW,GAAG,KAAK,EAAE,CAAC,CAAC;AAC3G"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/orchestrion/config/index.ts"],"sourcesContent":["import type { InstrumentationConfig } from '../apmTypes';\n\nimport { uniq } from '@sentry/core';\n\nimport { awsSdkConfig } from './aws-sdk';\nimport { amqplibConfig } from './amqplib';\nimport { anthropicAiConfig } from './anthropic-ai';\nimport { clickhouseConfig } from './clickhouse';\nimport { cronConfig } from './cron';\nimport { dataloaderConfig } from './dataloader';\nimport { expressConfig } from './express';\nimport { firebaseConfig } from './firebase';\nimport { genericPoolConfig } from './generic-pool';\nimport { googleGenAiConfig } from './google-genai';\nimport { graphqlConfig } from './graphql';\nimport { groqConfig } from './groq';\nimport { hapiConfig } from './hapi';\nimport { honoConfig } from './hono';\nimport { ioredisConfig } from './ioredis';\nimport { kafkajsConfig } from './kafkajs';\nimport { knexConfig } from './knex';\nimport { koaConfig } from './koa';\nimport { langchainConfig } from './langchain';\nimport { langgraphConfig } from './langgraph';\nimport { lruMemoizerConfig } from './lru-memoizer';\nimport { flueConfig } from './flue';\nimport { mastraConfig } from './mastra';\nimport { piAiConfig } from './pi-ai';\nimport { piDurableConfig } from './pi-durable';\nimport { mcpServerConfig } from './mcp-server';\nimport { mistralConfig } from './mistral';\nimport { mongodbConfig } from './mongodb';\nimport { mongooseConfig } from './mongoose';\nimport { mysql2Config } from './mysql2';\nimport { mysqlConfig } from './mysql';\nimport { neonConfig } from './neon';\nimport { nestjsConfig } from './nestjs';\nimport { nitroConfig } from './nitro';\nimport { nodeCronConfig } from './node-cron';\nimport { nodeScheduleConfig } from './node-schedule';\nimport { openaiConfig } from './openai';\nimport { pgConfig } from './pg';\nimport { postgresJsConfig } from './postgres';\nimport { prismaConfig } from './prisma';\nimport { redisConfig } from './redis';\nimport { remixConfig } from './remix';\nimport { remixV3Config } from './remix-v3';\nimport { tediousConfig } from './tedious';\nimport { togetherAiConfig } from './together-ai';\nimport { typesafeConfig } from './typesafe';\nimport { vercelAiConfig } from './vercel-ai';\n// Kept sorted alphabetically by module so concurrent additions insert at different\n// points rather than all appending to the end (fewer merge conflicts).\n\n/**\n * The orchestrion code-transform configs. Every instrumentable library is here\n * so the transform is all-or-nothing: whenever orchestrion is enabled, all of\n * these are injected. The channel LISTENERS may live elsewhere (e.g. the NestJS\n * one lives in `@sentry/nestjs`), but the config that decides what gets\n * transformed is centralized here.\n *\n * This module MUST stay pure, stateless data. It is loaded in more than one realm\n * at once — the build-time bundler plugin inlines it into the server chunk, while\n * `@sentry/server-runtime-injection`'s external `register` loads its own copy from\n * `node_modules` at runtime. Two identical, side-effect-free arrays are harmless;\n * any module-level mutable state here would silently diverge between those copies.\n */\nexport const SENTRY_INSTRUMENTATIONS: InstrumentationConfig[] = [\n ...amqplibConfig,\n ...anthropicAiConfig,\n ...awsSdkConfig,\n ...clickhouseConfig,\n ...cronConfig,\n ...dataloaderConfig,\n ...expressConfig,\n ...firebaseConfig,\n ...genericPoolConfig,\n ...googleGenAiConfig,\n ...graphqlConfig,\n ...groqConfig,\n ...hapiConfig,\n ...honoConfig,\n ...ioredisConfig,\n ...kafkajsConfig,\n ...knexConfig,\n ...koaConfig,\n ...langchainConfig,\n ...langgraphConfig,\n ...lruMemoizerConfig,\n ...flueConfig,\n ...mastraConfig,\n ...mcpServerConfig,\n ...mistralConfig,\n ...mongodbConfig,\n ...mongooseConfig,\n ...mysql2Config,\n ...mysqlConfig,\n ...neonConfig,\n ...nestjsConfig,\n ...nitroConfig,\n ...nodeCronConfig,\n ...nodeScheduleConfig,\n ...openaiConfig,\n ...pgConfig,\n ...piAiConfig,\n ...piDurableConfig,\n ...postgresJsConfig,\n ...prismaConfig,\n ...redisConfig,\n ...remixConfig,\n ...remixV3Config,\n ...tediousConfig,\n ...togetherAiConfig,\n ...typesafeConfig,\n ...vercelAiConfig,\n];\n\n/**\n * The subset of {@link SENTRY_INSTRUMENTATIONS} the RUNTIME loader\n * (`@sentry/server-runtime-injection`'s `register`, reached via `--import` or\n * `Sentry.init()`) can actually apply.\n *\n * Registration-only configs (native-channel libraries such as `ai` v7,\n * `ioredis`, `@redis/client`, `mysql2`, `mongoose`) carry the custom\n * `MODULE_REGISTRATION_TRANSFORM` operator. That operator is wired into the\n * BUNDLER plugins only (see `orchestrion/bundler/moduleInjectedTransform.ts`,\n * applied via `bundler/options.ts`'s `customTransforms`); the runtime loader's\n * `initialize()` receives no custom transforms. Attempting one of these at\n * runtime therefore throws `TypeError: transform is not a function`, which the\n * loader misreports as the always-on \"`@sentry/server-runtime-injection` was\n * bundled ... loads uninstrumented\" warning even though nothing is wrong.\n *\n * Excluding them at runtime is correct, not just a way to silence the warning:\n * these libraries publish their own tracing channels, and their integrations\n * subscribe through `setupOnce()` / `waitForTracingChannelBinding`,\n * independently of the module-injected snippet. That snippet only fires\n * `orchestrion.module-injected`, which drives the `setup()` /\n * `invokeOrchestrionInstrumentation` path; for a native-channel version that\n * path subscribes to the injected `orchestrion:*` channels the library never\n * publishes — a no-op. So running these at runtime would add no spans. The\n * snippet earns its keep only on the BUNDLER path — notably bundler-only SDKs\n * (e.g. `@sentry/cloudflare`) that discover a loaded module via that event to\n * instantiate its integration factory. `@sentry/node` registers its\n * integrations statically, so it does not need it.\n */\nexport const SENTRY_RUNTIME_INSTRUMENTATIONS: InstrumentationConfig[] = SENTRY_INSTRUMENTATIONS.filter(\n config => !config.transform,\n);\n\n/**\n * The unique set of package names instrumented by `SENTRY_INSTRUMENTATIONS`\n * merged with any caller-provided `instrumentations` (e.g. `['mysql']`).\n *\n * Bundler plugins MUST ensure these are actually bundled rather than\n * externalized: an externalized dependency is resolved from `node_modules` at\n * runtime and never passes through the code transform's `onLoad`, so its\n * diagnostics_channel calls are silently never injected. This includes a\n * plugin's custom `instrumentations`, otherwise those extra packages can stay\n * externalized and their transform never runs.\n */\nexport function instrumentedModuleNames(instrumentations: InstrumentationConfig[] = []): string[] {\n return [\n ...uniq([...SENTRY_INSTRUMENTATIONS, ...instrumentations].map(i => i.module.name)),\n // Additional things that need to be bundled but are not covered by the above\n // Remix needs to bundle this so @remix-run/server-runtime is _also_ bundled\n '@remix-run/node',\n ];\n}\n\n/** The instrumented module names from the default Sentry config, with no custom additions. */\nexport const INSTRUMENTED_MODULE_NAMES: string[] = instrumentedModuleNames();\n\n/**\n * The package names the SDK instruments through the orchestrion module transform (its\n * diagnostics-channel injection). Pass these to a server bundler's \"keep external\" option so the\n * packages load through Node's module loader — the only path the transform can hook — instead of\n * being inlined into the server bundle. A framework that has no Sentry bundler plugin (e.g. eve, via\n * `build.externalDependencies`) is the main caller; a listed package the app doesn't use is simply\n * ignored by the bundler.\n *\n * Unlike {@link INSTRUMENTED_MODULE_NAMES}, this is the plain instrumented set with no bundler-only\n * additions — those force a helper package to be *bundled*, the opposite of keeping it external.\n */\nexport function getInstrumentedModuleNames(): string[] {\n return uniq(SENTRY_INSTRUMENTATIONS.map(instrumentation => instrumentation.module.name));\n}\n\n/**\n * Returns `external` with any instrumented packages removed, so a bundler that\n * uses an \"external\" denylist (esbuild, Bun, Rollup) still bundles — and thus\n * transforms — them. Matches an exact package name (`'mysql'`) or a subpath\n * (`'mysql/lib/...'`); wildcard/other patterns are left untouched. `undefined`\n * is returned unchanged.\n *\n * Pass `moduleNames` from `instrumentedModuleNames(options.instrumentations)` so\n * custom instrumentations are stripped too; it defaults to the Sentry config\n * list. (Vite uses an `ssr.noExternal` allowlist instead, so it consumes\n * `instrumentedModuleNames` directly rather than this helper.)\n */\nexport function withoutInstrumentedExternals(\n external: readonly string[] | undefined,\n moduleNames: string[] = INSTRUMENTED_MODULE_NAMES,\n): string[] | undefined {\n if (!external) {\n return undefined;\n }\n return external.filter(entry => !moduleNames.some(name => entry === name || entry.startsWith(`${name}/`)));\n}\n\n// This is exported so that the nestjs package can use it to subscribe to the channels.\nexport { nestjsChannels } from './nestjs';\n// This is exported so that the remix package can use it to subscribe to the channels.\nexport { remixChannels } from './remix';\n// Exported so the remix package can subscribe to the Remix 3 channels, and hand only these configs to\n// the browser transform.\nexport { remixV3Channels, remixV3Config } from './remix-v3';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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"type":"module","version":"11.
|
|
1
|
+
{"type":"module","version":"11.17.0","sideEffects":false}
|