@sentry/server-utils 11.22.0 → 11.23.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/THIRD-PARTY-LICENSES.txt +10 -10
- package/build/cjs/chunks/config.js +2 -2
- package/build/cjs/chunks/config.js.map +1 -1
- package/build/cjs/chunks/core.js +0 -1
- package/build/cjs/chunks/exports.js +72 -27
- package/build/cjs/chunks/exports.js.map +1 -1
- package/build/cjs/chunks/module-details-from-path.js +427 -428
- package/build/cjs/chunks/module-details-from-path.js.map +1 -1
- package/build/cjs/chunks/moduleInjectedTransform.js +419 -421
- package/build/cjs/chunks/moduleInjectedTransform.js.map +1 -1
- package/build/cjs/chunks/rolldown-runtime.js +8 -6
- package/build/cjs/index.js +42 -25
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.request-handler.js +2 -2
- package/build/cjs/orchestrion/bundler/bun.js +1 -1
- package/build/cjs/orchestrion/bundler/esbuild.js +1 -1
- package/build/cjs/orchestrion/bundler/rollup.js +1 -1
- package/build/cjs/orchestrion/bundler/vite.js +2 -2
- package/build/cjs/orchestrion/bundler/webpack-loader.js +2 -2
- package/build/cjs/orchestrion/bundler/webpack.js +4 -4
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/defineProperty.js +1 -1
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/assertClassBrand.js +1 -1
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/checkPrivateRedeclaration.js +1 -1
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/classPrivateFieldGet2.js +1 -1
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/classPrivateFieldInitSpec.js +1 -1
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/classPrivateFieldSet2.js +1 -1
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/classPrivateMethodInitSpec.js +1 -1
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/defineProperty.js +1 -1
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/toPrimitive.js +1 -1
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/toPropertyKey.js +1 -1
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/esm/typeof.js +1 -1
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/toPrimitive.js +1 -1
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/toPropertyKey.js +1 -1
- package/build/esm/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.160.0}/helpers/typeof.js +1 -1
- package/build/esm/_virtual/_rolldown/runtime.js +8 -6
- package/build/esm/ai/anthropic-ai/index.js +2 -2
- package/build/esm/ai/anthropic-ai/streaming.js +11 -2
- package/build/esm/ai/anthropic-ai/streaming.js.map +1 -1
- package/build/esm/ai/anthropic-ai/tool-runner.js +3 -3
- package/build/esm/ai/anthropic-ai/utils.js +2 -2
- package/build/esm/ai/core/span-hooks.js +1 -1
- package/build/esm/ai/core/time-to-first-chunk.js +1 -1
- package/build/esm/ai/core/utils.js +2 -2
- package/build/esm/ai/flue/index.js +2 -2
- package/build/esm/ai/flue/utils.js +2 -2
- package/build/esm/ai/google-genai/decisions.js +1 -1
- package/build/esm/ai/google-genai/index.js +2 -2
- package/build/esm/ai/google-genai/streaming.js +9 -2
- package/build/esm/ai/google-genai/streaming.js.map +1 -1
- package/build/esm/ai/google-genai/utils.js +1 -1
- package/build/esm/ai/langchain/embeddings.js +3 -3
- package/build/esm/ai/langchain/index.js +15 -9
- package/build/esm/ai/langchain/index.js.map +1 -1
- package/build/esm/ai/langchain/typesafe-classifier.js +2 -2
- package/build/esm/ai/langchain/utils.js +3 -4
- package/build/esm/ai/langchain/utils.js.map +1 -1
- package/build/esm/ai/langgraph/agent-span.js +3 -3
- package/build/esm/ai/langgraph/index.js +1 -1
- package/build/esm/ai/langgraph/stream.js +2 -2
- package/build/esm/ai/langgraph/utils.js +3 -3
- package/build/esm/ai/mastra/index.js +2 -2
- package/build/esm/ai/mastra/span-registry.js +1 -1
- package/build/esm/ai/mastra/utils.js +2 -2
- package/build/esm/ai/mistral/index.js +2 -2
- package/build/esm/ai/mistral/streaming.js +18 -9
- package/build/esm/ai/mistral/streaming.js.map +1 -1
- package/build/esm/ai/openai/index.js +2 -2
- package/build/esm/ai/openai/mapping.js +1 -1
- package/build/esm/ai/openai/streaming.js +15 -2
- package/build/esm/ai/openai/streaming.js.map +1 -1
- package/build/esm/ai/openai/utils.js +2 -2
- package/build/esm/ai/pi-ai/chat.js +12 -4
- package/build/esm/ai/pi-ai/chat.js.map +1 -1
- package/build/esm/ai/pi-ai/providers.js +1 -1
- package/build/esm/ai/pi-ai/recording.js +1 -1
- package/build/esm/ai/pi-durable/index.js +2 -2
- package/build/esm/ai/pi-durable/runs.js +3 -3
- package/build/esm/ai/pi-durable/tools.js +3 -3
- package/build/esm/ai/tanstack-ai/index.js +2 -2
- package/build/esm/ai/tanstack-ai/utils.js +2 -2
- package/build/esm/ai/typesafe/index.js +3 -3
- package/build/esm/ai/workers-ai/index.js +2 -2
- package/build/esm/ai/workers-ai/streaming.js +7 -5
- package/build/esm/ai/workers-ai/streaming.js.map +1 -1
- package/build/esm/ai/workers-ai/utils.js +3 -3
- package/build/esm/async-context.js +1 -1
- package/build/esm/cron/common.js +1 -1
- package/build/esm/cron/cron.js +1 -1
- package/build/esm/cron/node-cron.js +1 -1
- package/build/esm/cron/node-schedule.js +1 -1
- package/build/esm/eve.js +1 -1
- package/build/esm/integrations/amqplib.js +3 -3
- package/build/esm/integrations/anthropic.js +3 -4
- package/build/esm/integrations/anthropic.js.map +1 -1
- package/build/esm/integrations/aws-sdk/index.js +3 -3
- package/build/esm/integrations/aws-sdk/services/MessageAttributes.js +1 -1
- package/build/esm/integrations/aws-sdk/services/bedrock-runtime-content.js +2 -2
- package/build/esm/integrations/aws-sdk/services/bedrock-runtime.js +3 -3
- package/build/esm/integrations/aws-sdk/services/dynamodb.js +1 -1
- package/build/esm/integrations/aws-sdk/services/lambda.js +2 -2
- package/build/esm/integrations/aws-sdk/services/sns.js +3 -3
- package/build/esm/integrations/aws-sdk/services/sqs.js +2 -2
- package/build/esm/integrations/bullmq/meter.js +2 -2
- package/build/esm/integrations/bullmq/tracer.js +2 -2
- package/build/esm/integrations/clickhouse.js +3 -3
- package/build/esm/integrations/cron.js +1 -1
- package/build/esm/integrations/dataloader.js +3 -3
- package/build/esm/integrations/express/error-handler.js +1 -1
- package/build/esm/integrations/express/index.js +1 -1
- package/build/esm/integrations/express/instrumentation.js +3 -3
- package/build/esm/integrations/fastify/errors.js +1 -1
- package/build/esm/integrations/fastify/index.js +1 -1
- package/build/esm/integrations/fastify/instrumentation.js +3 -3
- package/build/esm/integrations/firebase/firestore.js +2 -2
- package/build/esm/integrations/firebase/functions.js +1 -1
- package/build/esm/integrations/firebase/index.js +1 -1
- package/build/esm/integrations/flue.js +1 -1
- package/build/esm/integrations/generic-pool.js +3 -3
- package/build/esm/integrations/google-genai.js +2 -2
- package/build/esm/integrations/graphql/graphql-dc-subscriber.js +3 -3
- package/build/esm/integrations/graphql/index.js +1 -1
- package/build/esm/integrations/graphql/resolvers.js +2 -2
- package/build/esm/integrations/graphql/spans.js +3 -3
- package/build/esm/integrations/groq.js +1 -1
- package/build/esm/integrations/hapi/hapi-error-handler.js +1 -1
- package/build/esm/integrations/hapi/hapi-utils.js +4 -5
- package/build/esm/integrations/hapi/hapi-utils.js.map +1 -1
- package/build/esm/integrations/hapi/index.js +1 -1
- package/build/esm/integrations/hono/applyPatches.js +1 -1
- package/build/esm/integrations/hono/createHonoMiddleware.js +1 -1
- package/build/esm/integrations/hono/honoIntegration.js +3 -3
- package/build/esm/integrations/hono/matchResult.js +1 -1
- package/build/esm/integrations/hono/middlewareHandlers.js +2 -2
- package/build/esm/integrations/hono/patchAppRequest.js +3 -3
- package/build/esm/integrations/hono/patchAppUse.js +1 -1
- package/build/esm/integrations/hono/patchRoute.js +1 -1
- package/build/esm/integrations/hono/wrapMiddlewareSpan.js +3 -3
- package/build/esm/integrations/kafkajs/consumer.js +2 -2
- package/build/esm/integrations/kafkajs/index.js +1 -1
- package/build/esm/integrations/kafkajs/spans.js +2 -2
- package/build/esm/integrations/knex.js +3 -3
- package/build/esm/integrations/koa/index.js +3 -3
- package/build/esm/integrations/langchain.js +1 -1
- package/build/esm/integrations/langgraph.js +1 -1
- package/build/esm/integrations/lru-memoizer.js +1 -1
- package/build/esm/integrations/mastra-classifier.js +2 -2
- package/build/esm/integrations/mastra.js +4 -4
- package/build/esm/integrations/mcp-server.js +2 -2
- package/build/esm/integrations/mistral.js +2 -2
- package/build/esm/integrations/mongodb/index.js +1 -1
- package/build/esm/integrations/mongodb/mongodb-span.js +1 -1
- package/build/esm/integrations/mongoose/index.js +1 -1
- package/build/esm/integrations/mongoose/mongoose-dc-subscriber.js +3 -3
- package/build/esm/integrations/mongoose/mongoose-legacy-span.js +1 -1
- package/build/esm/integrations/mysql.js +3 -3
- package/build/esm/integrations/mysql2/index.js +1 -1
- package/build/esm/integrations/mysql2/mysql2-dc-subscriber.js +3 -3
- package/build/esm/integrations/neon.js +3 -3
- package/build/esm/integrations/nitro/captureStorageEvents.js +3 -3
- package/build/esm/integrations/nitro/captureTracingEvents.js +3 -3
- package/build/esm/integrations/nitro/index.js +1 -1
- package/build/esm/integrations/nitro/setServerTimingHeaders.js +1 -1
- package/build/esm/integrations/node-cron.js +1 -1
- package/build/esm/integrations/node-schedule.js +1 -1
- package/build/esm/integrations/openai-compatible.js +2 -2
- package/build/esm/integrations/openai.js +2 -2
- package/build/esm/integrations/pg.js +3 -3
- package/build/esm/integrations/pi-ai.js +1 -1
- package/build/esm/integrations/pi-durable.js +1 -1
- package/build/esm/integrations/pino.js +1 -1
- package/build/esm/integrations/postgresjs/index.js +3 -3
- package/build/esm/integrations/postgresjs/postgresjs-dc-subscriber.js +3 -3
- package/build/esm/integrations/postgresjs-wrapper.js +1 -1
- package/build/esm/integrations/prisma/index.js +1 -1
- package/build/esm/integrations/prisma/orchestrion.js +8 -12
- package/build/esm/integrations/prisma/orchestrion.js.map +1 -1
- package/build/esm/integrations/prisma/tracing-helper.js +2 -2
- package/build/esm/integrations/redis/index.js +3 -3
- package/build/esm/integrations/redis/ioredis-channel-subscriber.js +3 -3
- package/build/esm/integrations/redis/redis-cache.js +1 -1
- package/build/esm/integrations/redis/redis-dc-subscriber.js +3 -3
- package/build/esm/integrations/serveTunnel.js +2 -2
- package/build/esm/integrations/tanstack-ai.js +1 -1
- package/build/esm/integrations/tedious.js +4 -4
- package/build/esm/integrations/together-ai.js +1 -1
- package/build/esm/integrations/typesafe.js +1 -1
- package/build/esm/integrations/vercel-ai/extract.js +1 -1
- package/build/esm/integrations/vercel-ai/index.js +1 -1
- package/build/esm/integrations/vercel-ai/util.js +21 -2
- package/build/esm/integrations/vercel-ai/util.js.map +1 -1
- package/build/esm/integrations/vercel-ai/vercel-ai-dc-subscriber.js +3 -3
- package/build/esm/integrations/vercel-ai/vercel-ai-orchestrion-subscriber.js +1 -1
- package/build/esm/integrations/vercel-ai/vercel-ai-tool-telemetry.js +3 -3
- package/build/esm/integrations/winston.js +1 -1
- package/build/esm/opentelemetry.js +1 -1
- package/build/esm/orchestrion/bundler/esbuild.js +1 -1
- package/build/esm/orchestrion/bundler/externalRequire.js +1 -1
- package/build/esm/orchestrion/bundler/rollup.js +1 -1
- package/build/esm/orchestrion/bundler/webpack-loader.js +1 -1
- package/build/esm/orchestrion/bundler/webpack.js +1 -1
- package/build/esm/orchestrion/config/index.js +1 -1
- package/build/esm/orchestrion/config/mistral.js +1 -1
- package/build/esm/orchestrion/config/mistral.js.map +1 -1
- package/build/esm/orchestrion/detect.js +1 -1
- package/build/esm/orchestrion/instrumentation.js +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/tracing-channel.js +1 -2
- package/build/esm/tracing-channel.js.map +1 -1
- package/build/esm/utils/cronMonitoring.js +1 -1
- package/build/esm/utils/diagnosticsChannel.js +1 -1
- package/build/esm/utils/module.js +2 -2
- package/build/esm/utils/module.js.map +1 -1
- package/build/esm/utils/monitorStream.js +1 -1
- package/build/esm/utils/serverTimingTraceHeader.js +1 -1
- package/build/esm/utils/tunnelServer.js +1 -1
- package/build/esm/utils/wrapServerRequestHandler.js +4 -4
- package/build/esm/vendored/@apm-js-collab/code-transformer/lib/matcher.js +3 -3
- package/build/esm/vendored/@apm-js-collab/code-transformer/lib/transformer.js +5 -5
- package/build/esm/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/core-BiWIBBjf.js +1 -1
- package/build/esm/vendored/@apm-js-collab/code-transformer-bundler-plugins/dist/esm/webpack-loader-factory.js +1 -1
- package/build/esm/vendored/esquery/dist/esquery.min.js +1 -0
- package/build/esm/vendored/esquery/dist/esquery.min.js.map +1 -1
- package/build/esm/vendored/meriyah/dist/meriyah.js +416 -418
- package/build/esm/vendored/meriyah/dist/meriyah.js.map +1 -1
- package/build/esm/vendored/meriyah/dist/meriyah2.js +416 -418
- package/build/esm/vendored/meriyah/dist/meriyah2.js.map +1 -1
- package/build/esm/vendored/source-map/lib/base64-vlq.js +1 -1
- package/build/esm/vendored/source-map/lib/base64-vlq.js.map +1 -1
- package/build/types/ai/anthropic-ai/streaming.d.ts.map +1 -1
- package/build/types/ai/anthropic-ai/types.d.ts +1 -0
- package/build/types/ai/anthropic-ai/types.d.ts.map +1 -1
- package/build/types/ai/google-genai/streaming.d.ts.map +1 -1
- package/build/types/ai/langchain/index.d.ts.map +1 -1
- package/build/types/ai/mistral/streaming.d.ts.map +1 -1
- package/build/types/ai/openai/streaming.d.ts.map +1 -1
- package/build/types/ai/pi-ai/chat.d.ts.map +1 -1
- package/build/types/ai/workers-ai/streaming.d.ts.map +1 -1
- package/build/types/integrations/vercel-ai/util.d.ts.map +1 -1
- package/build/types/orchestrion/config/mistral.d.ts +3 -3
- package/build/types/tracing-channel.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hapi-utils.js","names":[],"sources":["../../../../src/integrations/hapi/hapi-utils.ts"],"sourcesContent":["/*\n * OTel-free, `@hapi/*`-free port of the span-building helpers and handler/ext\n * wrap logic from the vendored `@opentelemetry/instrumentation-hapi`\n * (upstream @opentelemetry/instrumentation-hapi@0.64.0). Span output (names,\n * origins, attributes) is kept close to that instrumentation — except the\n * span ops, which are normalized to cross-framework ops (`handler` for plugin\n * routes, `router` for routes, `middleware` for server extensions); span\n * creation goes through the `@sentry/core` API and the OTel active-span guard\n * is replaced with `getActiveSpan()`.\n */\n\nimport {\n getActiveSpan,\n getClient,\n hasSpanStreamingEnabled,\n isObjectLike,\n REQUEST_HANDLER_SPAN_NAME_FALLBACK,\n ROUTER_SPAN_NAME_FALLBACK,\n startSpan,\n} from '@sentry/core';\nimport {\n HAPI_EXT_TYPE,\n HAPI_PLUGIN_NAME,\n HAPI_TYPE,\n HTTP_REQUEST_METHOD,\n HTTP_ROUTE,\n SENTRY_OP,\n SENTRY_ORIGIN,\n SERVER_EXT_TYPE,\n} from '@sentry/conventions/attributes';\nimport { HANDLER, MIDDLEWARE, ROUTER } from '@sentry/conventions/op';\nimport type {\n HapiRequest,\n LifecycleMethod,\n PatchableExtMethod,\n PatchableServerRoute,\n ServerExtDirectInput,\n ServerExtEventsObject,\n ServerExtEventsRequestObject,\n ServerRequestExtType,\n ServerRouteOptions,\n} from './hapi-types';\nimport { handlerPatched, HapiLayerType, HapiLifecycleMethodNames } from './hapi-types';\nimport { setHttpServerSpanRouteAttribute } from '../../utils/setHttpServerSpanRouteAttribute';\n\n/**\n * Default function deciding whether an error should be sent to Sentry.\n *\n * Captures 5xx errors and any error whose status can't be resolved; skips 3xx\n * and 4xx (client errors / redirects) and 2xx-and-below outliers are captured\n * as they usually signal an unmapped thrown error. Mirrors the defaults used by\n * the other server framework integrations.\n */\nexport function defaultShouldHandleError(error: unknown, request: HapiRequest): boolean {\n const statusCode = getResponseStatusCode(request, error);\n if (typeof statusCode !== 'number') {\n return true;\n }\n // 3xx and 4xx errors are not sent by default.\n return statusCode >= 500 || statusCode <= 299;\n}\n\n/**\n * Resolve the HTTP status for an errored hapi request: prefer the resolved\n * response (Boom `output.statusCode`, else `statusCode`), falling back to a Boom\n * error passed directly.\n */\nfunction getResponseStatusCode(request: HapiRequest, error: unknown): number | undefined {\n const response = request.response;\n if (isObjectLike(response)) {\n if (response.isBoom && isObjectLike(response.output) && typeof response.output.statusCode === 'number') {\n return response.output.statusCode;\n }\n if (typeof response.statusCode === 'number') {\n return response.statusCode;\n }\n }\n\n if (isObjectLike(error) && isObjectLike(error.output) && typeof error.output.statusCode === 'number') {\n return error.output.statusCode;\n }\n\n return undefined;\n}\n\ntype SpanAttributes = Record<string, string | undefined>;\n\ninterface SpanMetadata {\n attributes: SpanAttributes;\n name: string;\n}\n\nconst isLifecycleExtType = (variableToCheck: unknown): variableToCheck is ServerRequestExtType => {\n return typeof variableToCheck === 'string' && HapiLifecycleMethodNames.has(variableToCheck);\n};\n\nconst isLifecycleExtEventObj = (variableToCheck: unknown): variableToCheck is ServerExtEventsRequestObject => {\n const event = (variableToCheck as ServerExtEventsRequestObject)?.type;\n return event !== undefined && isLifecycleExtType(event);\n};\n\nconst isDirectExtInput = (variableToCheck: unknown): variableToCheck is ServerExtDirectInput => {\n return (\n Array.isArray(variableToCheck) &&\n variableToCheck.length <= 3 &&\n isLifecycleExtType(variableToCheck[0]) &&\n typeof variableToCheck[1] === 'function'\n );\n};\n\nconst isPatchableExtMethod = (\n variableToCheck: PatchableExtMethod | PatchableExtMethod[],\n): variableToCheck is PatchableExtMethod => {\n return !Array.isArray(variableToCheck);\n};\n\n/** Build the span name and attributes for a Hapi route. */\nexport const getRouteMetadata = ({\n path,\n method,\n pluginName,\n}: {\n path: string;\n method?: string;\n pluginName?: string;\n}): SpanMetadata => {\n const attributes: SpanAttributes = {\n [HTTP_ROUTE]: path,\n [HTTP_REQUEST_METHOD]: method,\n };\n\n if (pluginName) {\n attributes[HAPI_TYPE] = HapiLayerType.PLUGIN;\n attributes[HAPI_PLUGIN_NAME] = pluginName;\n } else {\n attributes[HAPI_TYPE] = HapiLayerType.ROUTER;\n }\n\n const client = getClient();\n // With span streaming, span names have to be low cardinality, so router and request\n // handler spans are named after their route alone, without the method prefix.\n const isStreamedSpan = !!client && hasSpanStreamingEnabled(client);\n const fallbackName = pluginName ? REQUEST_HANDLER_SPAN_NAME_FALLBACK : ROUTER_SPAN_NAME_FALLBACK;\n const staticName = method ? `${method} ${path}` : path;\n\n return {\n attributes,\n name: isStreamedSpan ? path || fallbackName : staticName,\n };\n};\n\n/** Build the span name and attributes for a Hapi server extension. */\nexport const getExtMetadata = (\n extPoint: ServerRequestExtType,\n pluginName?: string,\n methodName?: string,\n): SpanMetadata => {\n let baseName = `ext - ${extPoint}`;\n if (methodName && methodName !== 'method') {\n // `method` is the default name for the extension in the ServerExtEventsObject format.\n baseName = `ext - ${extPoint} - ${methodName}`;\n }\n const attributes: SpanAttributes = {\n [HAPI_EXT_TYPE]: extPoint,\n // TODO(v12): Remove `server.ext.type`, which `hapi.ext.type` replaces.\n // oxlint-disable-next-line typescript/no-deprecated\n [SERVER_EXT_TYPE]: extPoint,\n [HAPI_TYPE]: HapiLayerType.EXT,\n };\n if (pluginName) {\n return {\n attributes: { ...attributes, [HAPI_PLUGIN_NAME]: pluginName },\n name: `${pluginName}: ${baseName}`,\n };\n }\n return { attributes, name: baseName };\n};\n\nconst HAPI_TYPE_TO_SPAN_OP: Record<string, string> = {\n [HapiLayerType.PLUGIN]: HANDLER,\n [HapiLayerType.ROUTER]: ROUTER,\n [HapiLayerType.EXT]: MIDDLEWARE,\n};\n\nfunction startMetadataSpan(metadata: SpanMetadata, original: () => unknown): unknown {\n const hapiType = metadata.attributes[HAPI_TYPE];\n const op = hapiType ? HAPI_TYPE_TO_SPAN_OP[hapiType] : undefined;\n return startSpan(\n {\n name: metadata.name,\n attributes: {\n ...metadata.attributes,\n [SENTRY_OP]: op,\n [SENTRY_ORIGIN]: 'auto.http.hapi',\n },\n },\n original,\n );\n}\n\n// The route config can register several methods (or `'*'`), so read the method\n// Hapi resolved for this request instead.\nfunction getRequestMethod(request: unknown): string | undefined {\n return isObjectLike(request) && typeof request.method === 'string' ? request.method.toUpperCase() : undefined;\n}\n\n/**\n * Patches each individual route handler method in order to create the span. It\n * does not create spans when there is no parent span.\n */\nfunction wrapRouteHandler(route: PatchableServerRoute, pluginName?: string): PatchableServerRoute {\n if (route[handlerPatched] === true) return route;\n route[handlerPatched] = true;\n\n const wrapHandler: (oldHandler: LifecycleMethod) => LifecycleMethod = oldHandler => {\n return function (this: unknown, ...params: Parameters<LifecycleMethod>) {\n if (!getActiveSpan()) {\n return oldHandler.call(this, ...params);\n }\n setHttpServerSpanRouteAttribute(route.path);\n const metadata = getRouteMetadata({ path: route.path, method: getRequestMethod(params[0]), pluginName });\n return startMetadataSpan(metadata, () => oldHandler.call(this, ...params));\n };\n };\n\n if (typeof route.handler === 'function') {\n route.handler = wrapHandler(route.handler as LifecycleMethod);\n } else if (typeof route.options === 'function') {\n const oldOptions = route.options;\n route.options = function (server: unknown): ServerRouteOptions {\n const options = oldOptions(server);\n if (typeof options.handler === 'function') {\n options.handler = wrapHandler(options.handler as LifecycleMethod);\n }\n return options;\n };\n } else if (typeof route.options?.handler === 'function') {\n route.options.handler = wrapHandler(route.options.handler as LifecycleMethod);\n }\n return route;\n}\n\n/**\n * Wraps request extension methods to add instrumentation to each new extension\n * handler. It does not create spans when there is no parent span.\n */\nfunction wrapExtMethods<T extends PatchableExtMethod | PatchableExtMethod[]>(\n method: T,\n extPoint: ServerRequestExtType,\n pluginName?: string,\n): T {\n if (Array.isArray(method)) {\n for (const [i, m] of method.entries()) {\n method[i] = wrapExtMethods(m, extPoint);\n }\n return method;\n } else if (isPatchableExtMethod(method)) {\n if (method[handlerPatched] === true) return method;\n method[handlerPatched] = true;\n\n const newHandler: PatchableExtMethod = function (this: unknown, ...params: Parameters<LifecycleMethod>) {\n if (!getActiveSpan()) {\n return method.apply(this, params);\n }\n const metadata = getExtMetadata(extPoint, pluginName, method.name);\n return startMetadataSpan(metadata, () => method.apply(undefined, params));\n };\n // Mark the wrapper too (not just the original)\n newHandler[handlerPatched] = true;\n return newHandler as T;\n }\n return method;\n}\n\n/**\n * Wrap the route handler(s) in the live `server.route` arguments array, mutating\n * `args[0]` in place. `args[0]` is either a single route options object or an\n * array of them. Idempotent via the `handlerPatched` marker.\n */\nexport function wrapRouteArguments(args: unknown[], pluginName?: string): void {\n const route = args[0] as PatchableServerRoute | PatchableServerRoute[];\n if (Array.isArray(route)) {\n for (const [i, r] of route.entries()) {\n route[i] = wrapRouteHandler(r, pluginName);\n }\n } else {\n args[0] = wrapRouteHandler(route, pluginName);\n }\n}\n\n/**\n * Wrap the extension method(s) in the live `server.ext` arguments array,\n * mutating `args` in place. Handles the three accepted input shapes:\n * `(eventsArray)`, `(lifecycleEventObject)`, and `(extTypeString, method, options)`.\n * Idempotent via the `handlerPatched` marker.\n */\nexport function wrapExtArguments(args: unknown[], pluginName?: string): void {\n if (Array.isArray(args[0])) {\n const eventsList = args[0] as ServerExtEventsObject[] | ServerExtEventsRequestObject[];\n for (const [i, eventObj] of eventsList.entries()) {\n if (isLifecycleExtType(eventObj.type)) {\n const lifecycleEventObj = eventObj as ServerExtEventsRequestObject;\n const handler = wrapExtMethods(lifecycleEventObj.method, eventObj.type, pluginName);\n lifecycleEventObj.method = handler;\n eventsList[i] = lifecycleEventObj;\n }\n }\n return;\n } else if (isDirectExtInput(args)) {\n const extInput: ServerExtDirectInput = args;\n const method: PatchableExtMethod = extInput[1];\n const handler = wrapExtMethods(method, extInput[0], pluginName);\n args[1] = handler;\n return;\n } else if (isLifecycleExtEventObj(args[0])) {\n const lifecycleEventObj = args[0];\n const handler = wrapExtMethods(lifecycleEventObj.method, lifecycleEventObj.type, pluginName);\n lifecycleEventObj.method = handler;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAqDA,SAAgB,yBAAyB,OAAgB,SAA+B;CACtF,MAAM,aAAa,sBAAsB,SAAS,KAAK;CACvD,IAAI,OAAO,eAAe,UACxB,OAAO;CAGT,OAAO,cAAc,OAAO,cAAc;AAC5C;;;;;;AAOA,SAAS,sBAAsB,SAAsB,OAAoC;CACvF,MAAM,WAAW,QAAQ;CACzB,IAAI,aAAa,QAAQ,GAAG;EAC1B,IAAI,SAAS,UAAU,aAAa,SAAS,MAAM,KAAK,OAAO,SAAS,OAAO,eAAe,UAC5F,OAAO,SAAS,OAAO;EAEzB,IAAI,OAAO,SAAS,eAAe,UACjC,OAAO,SAAS;CAEpB;CAEA,IAAI,aAAa,KAAK,KAAK,aAAa,MAAM,MAAM,KAAK,OAAO,MAAM,OAAO,eAAe,UAC1F,OAAO,MAAM,OAAO;AAIxB;AASA,MAAM,sBAAsB,oBAAsE;CAChG,OAAO,OAAO,oBAAoB,YAAY,yBAAyB,IAAI,eAAe;AAC5F;AAEA,MAAM,0BAA0B,oBAA8E;CAC5G,MAAM,QAAS,iBAAkD;CACjE,OAAO,UAAU,KAAA,KAAa,mBAAmB,KAAK;AACxD;AAEA,MAAM,oBAAoB,oBAAsE;CAC9F,OACE,MAAM,QAAQ,eAAe,KAC7B,gBAAgB,UAAU,KAC1B,mBAAmB,gBAAgB,EAAE,KACrC,OAAO,gBAAgB,OAAO;AAElC;AAEA,MAAM,w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,GAAW,MAAM,CAAC;EAC1E;EAEA,WAAW,kBAAkB;EAC7B,OAAO;CACT;CACA,OAAO;AACT;;;;;;AAOA,SAAgB,mBAAmB,MAAiB,YAA2B;CAC7E,MAAM,QAAQ,KAAK;CACnB,IAAI,MAAM,QAAQ,KAAK,GACrB,KAAK,MAAM,CAAC,GAAG,MAAM,MAAM,QAAQ,GACjC,MAAM,KAAK,iBAAiB,GAAG,UAAU;MAG3C,KAAK,KAAK,iBAAiB,OAAO,UAAU;AAEhD;;;;;;;AAQA,SAAgB,iBAAiB,MAAiB,YAA2B;CAC3E,IAAI,MAAM,QAAQ,KAAK,EAAE,GAAG;EAC1B,MAAM,aAAa,KAAK;EACxB,KAAK,MAAM,CAAC,GAAG,aAAa,WAAW,QAAQ,GAC7C,IAAI,mBAAmB,SAAS,IAAI,GAAG;GACrC,MAAM,oBAAoB;GAE1B,kBAAkB,SADF,eAAe,kBAAkB,QAAQ,SAAS,MAAM,UACvC;GACjC,WAAW,KAAK;EAClB;EAEF;CACF,OAAO,IAAI,iBAAiB,IAAI,GAAG;EACjC,MAAM,WAAiC;EACvC,MAAM,SAA6B,SAAS;EAE5C,KAAK,KADW,eAAe,QAAQ,SAAS,IAAI,UACpC;EAChB;CACF,OAAO,IAAI,uBAAuB,KAAK,EAAE,GAAG;EAC1C,MAAM,oBAAoB,KAAK;EAE/B,kBAAkB,SADF,eAAe,kBAAkB,QAAQ,kBAAkB,MAAM,UAChD;CACnC;AACF"}
|
|
1
|
+
{"version":3,"file":"hapi-utils.js","names":[],"sources":["../../../../src/integrations/hapi/hapi-utils.ts"],"sourcesContent":["/*\n * OTel-free, `@hapi/*`-free port of the span-building helpers and handler/ext\n * wrap logic from the vendored `@opentelemetry/instrumentation-hapi`\n * (upstream @opentelemetry/instrumentation-hapi@0.64.0). Span output (names,\n * origins, attributes) is kept close to that instrumentation — except the\n * span ops, which are normalized to cross-framework ops (`handler` for plugin\n * routes, `router` for routes, `middleware` for server extensions); span\n * creation goes through the `@sentry/core` API and the OTel active-span guard\n * is replaced with `getActiveSpan()`.\n */\n\nimport {\n getActiveSpan,\n getClient,\n hasSpanStreamingEnabled,\n isObjectLike,\n REQUEST_HANDLER_SPAN_NAME_FALLBACK,\n ROUTER_SPAN_NAME_FALLBACK,\n startSpan,\n} from '@sentry/core';\nimport {\n HAPI_EXT_TYPE,\n HAPI_PLUGIN_NAME,\n HAPI_TYPE,\n HTTP_REQUEST_METHOD,\n HTTP_ROUTE,\n SENTRY_OP,\n SENTRY_ORIGIN,\n SERVER_EXT_TYPE,\n} from '@sentry/conventions/attributes';\nimport { HANDLER, MIDDLEWARE, ROUTER } from '@sentry/conventions/op';\nimport type {\n HapiRequest,\n LifecycleMethod,\n PatchableExtMethod,\n PatchableServerRoute,\n ServerExtDirectInput,\n ServerExtEventsObject,\n ServerExtEventsRequestObject,\n ServerRequestExtType,\n ServerRouteOptions,\n} from './hapi-types';\nimport { handlerPatched, HapiLayerType, HapiLifecycleMethodNames } from './hapi-types';\nimport { setHttpServerSpanRouteAttribute } from '../../utils/setHttpServerSpanRouteAttribute';\n\n/**\n * Default function deciding whether an error should be sent to Sentry.\n *\n * Captures 5xx errors and any error whose status can't be resolved; skips 3xx\n * and 4xx (client errors / redirects) and 2xx-and-below outliers are captured\n * as they usually signal an unmapped thrown error. Mirrors the defaults used by\n * the other server framework integrations.\n */\nexport function defaultShouldHandleError(error: unknown, request: HapiRequest): boolean {\n const statusCode = getResponseStatusCode(request, error);\n if (typeof statusCode !== 'number') {\n return true;\n }\n // 3xx and 4xx errors are not sent by default.\n return statusCode >= 500 || statusCode <= 299;\n}\n\n/**\n * Resolve the HTTP status for an errored hapi request: prefer the resolved\n * response (Boom `output.statusCode`, else `statusCode`), falling back to a Boom\n * error passed directly.\n */\nfunction getResponseStatusCode(request: HapiRequest, error: unknown): number | undefined {\n const response = request.response;\n if (isObjectLike(response)) {\n if (response.isBoom && isObjectLike(response.output) && typeof response.output.statusCode === 'number') {\n return response.output.statusCode;\n }\n if (typeof response.statusCode === 'number') {\n return response.statusCode;\n }\n }\n\n if (isObjectLike(error) && isObjectLike(error.output) && typeof error.output.statusCode === 'number') {\n return error.output.statusCode;\n }\n\n return undefined;\n}\n\ntype SpanAttributes = Record<string, string | undefined>;\n\ninterface SpanMetadata {\n attributes: SpanAttributes;\n name: string;\n}\n\nconst isLifecycleExtType = (variableToCheck: unknown): variableToCheck is ServerRequestExtType => {\n return typeof variableToCheck === 'string' && HapiLifecycleMethodNames.has(variableToCheck);\n};\n\nconst isLifecycleExtEventObj = (variableToCheck: unknown): variableToCheck is ServerExtEventsRequestObject => {\n const event = (variableToCheck as ServerExtEventsRequestObject)?.type;\n return event !== undefined && isLifecycleExtType(event);\n};\n\nconst isDirectExtInput = (variableToCheck: unknown): variableToCheck is ServerExtDirectInput => {\n return (\n Array.isArray(variableToCheck) &&\n variableToCheck.length <= 3 &&\n isLifecycleExtType(variableToCheck[0]) &&\n typeof variableToCheck[1] === 'function'\n );\n};\n\nconst isPatchableExtMethod = (\n variableToCheck: PatchableExtMethod | PatchableExtMethod[],\n): variableToCheck is PatchableExtMethod => {\n return !Array.isArray(variableToCheck);\n};\n\n/** Build the span name and attributes for a Hapi route. */\nexport const getRouteMetadata = ({\n path,\n method,\n pluginName,\n}: {\n path: string;\n method?: string;\n pluginName?: string;\n}): SpanMetadata => {\n const attributes: SpanAttributes = {\n [HTTP_ROUTE]: path,\n [HTTP_REQUEST_METHOD]: method,\n };\n\n if (pluginName) {\n attributes[HAPI_TYPE] = HapiLayerType.PLUGIN;\n attributes[HAPI_PLUGIN_NAME] = pluginName;\n } else {\n attributes[HAPI_TYPE] = HapiLayerType.ROUTER;\n }\n\n const client = getClient();\n // With span streaming, span names have to be low cardinality, so router and request\n // handler spans are named after their route alone, without the method prefix.\n const isStreamedSpan = !!client && hasSpanStreamingEnabled(client);\n const fallbackName = pluginName ? REQUEST_HANDLER_SPAN_NAME_FALLBACK : ROUTER_SPAN_NAME_FALLBACK;\n const staticName = method ? `${method} ${path}` : path;\n\n return {\n attributes,\n name: isStreamedSpan ? path || fallbackName : staticName,\n };\n};\n\n/** Build the span name and attributes for a Hapi server extension. */\nexport const getExtMetadata = (\n extPoint: ServerRequestExtType,\n pluginName?: string,\n methodName?: string,\n): SpanMetadata => {\n let baseName = `ext - ${extPoint}`;\n if (methodName && methodName !== 'method') {\n // `method` is the default name for the extension in the ServerExtEventsObject format.\n baseName = `ext - ${extPoint} - ${methodName}`;\n }\n const attributes: SpanAttributes = {\n [HAPI_EXT_TYPE]: extPoint,\n // TODO(v12): Remove `server.ext.type`, which `hapi.ext.type` replaces.\n // oxlint-disable-next-line typescript/no-deprecated\n [SERVER_EXT_TYPE]: extPoint,\n [HAPI_TYPE]: HapiLayerType.EXT,\n };\n if (pluginName) {\n return {\n attributes: { ...attributes, [HAPI_PLUGIN_NAME]: pluginName },\n name: `${pluginName}: ${baseName}`,\n };\n }\n return { attributes, name: baseName };\n};\n\nconst HAPI_TYPE_TO_SPAN_OP: Record<string, string> = {\n [HapiLayerType.PLUGIN]: HANDLER,\n [HapiLayerType.ROUTER]: ROUTER,\n [HapiLayerType.EXT]: MIDDLEWARE,\n};\n\nfunction startMetadataSpan(metadata: SpanMetadata, original: () => unknown): unknown {\n const hapiType = metadata.attributes[HAPI_TYPE];\n const op = hapiType ? HAPI_TYPE_TO_SPAN_OP[hapiType] : undefined;\n return startSpan(\n {\n name: metadata.name,\n attributes: {\n ...metadata.attributes,\n [SENTRY_OP]: op,\n [SENTRY_ORIGIN]: 'auto.http.hapi',\n },\n },\n original,\n );\n}\n\n// The route config can register several methods (or `'*'`), so read the method\n// Hapi resolved for this request instead.\nfunction getRequestMethod(request: unknown): string | undefined {\n return isObjectLike(request) && typeof request.method === 'string' ? request.method.toUpperCase() : undefined;\n}\n\n/**\n * Patches each individual route handler method in order to create the span. It\n * does not create spans when there is no parent span.\n */\nfunction wrapRouteHandler(route: PatchableServerRoute, pluginName?: string): PatchableServerRoute {\n if (route[handlerPatched] === true) return route;\n route[handlerPatched] = true;\n\n const wrapHandler: (oldHandler: LifecycleMethod) => LifecycleMethod = oldHandler => {\n return function (this: unknown, ...params: Parameters<LifecycleMethod>) {\n if (!getActiveSpan()) {\n return oldHandler.call(this, ...params);\n }\n setHttpServerSpanRouteAttribute(route.path);\n const metadata = getRouteMetadata({ path: route.path, method: getRequestMethod(params[0]), pluginName });\n return startMetadataSpan(metadata, () => oldHandler.call(this, ...params));\n };\n };\n\n if (typeof route.handler === 'function') {\n route.handler = wrapHandler(route.handler as LifecycleMethod);\n } else if (typeof route.options === 'function') {\n const oldOptions = route.options;\n route.options = function (server: unknown): ServerRouteOptions {\n const options = oldOptions(server);\n if (typeof options.handler === 'function') {\n options.handler = wrapHandler(options.handler as LifecycleMethod);\n }\n return options;\n };\n } else if (typeof route.options?.handler === 'function') {\n route.options.handler = wrapHandler(route.options.handler as LifecycleMethod);\n }\n return route;\n}\n\n/**\n * Wraps request extension methods to add instrumentation to each new extension\n * handler. It does not create spans when there is no parent span.\n */\nfunction wrapExtMethods<T extends PatchableExtMethod | PatchableExtMethod[]>(\n method: T,\n extPoint: ServerRequestExtType,\n pluginName?: string,\n): T {\n if (Array.isArray(method)) {\n for (const [i, m] of method.entries()) {\n method[i] = wrapExtMethods(m, extPoint);\n }\n return method;\n } else if (isPatchableExtMethod(method)) {\n if (method[handlerPatched] === true) return method;\n method[handlerPatched] = true;\n\n const newHandler: PatchableExtMethod = function (this: unknown, ...params: Parameters<LifecycleMethod>) {\n if (!getActiveSpan()) {\n return method.apply(this, params);\n }\n const metadata = getExtMetadata(extPoint, pluginName, method.name);\n return startMetadataSpan(metadata, () => method.apply(undefined, params));\n };\n // Mark the wrapper too (not just the original)\n newHandler[handlerPatched] = true;\n return newHandler as T;\n }\n return method;\n}\n\n/**\n * Wrap the route handler(s) in the live `server.route` arguments array, mutating\n * `args[0]` in place. `args[0]` is either a single route options object or an\n * array of them. Idempotent via the `handlerPatched` marker.\n */\nexport function wrapRouteArguments(args: unknown[], pluginName?: string): void {\n const route = args[0] as PatchableServerRoute | PatchableServerRoute[];\n if (Array.isArray(route)) {\n for (const [i, r] of route.entries()) {\n route[i] = wrapRouteHandler(r, pluginName);\n }\n } else {\n args[0] = wrapRouteHandler(route, pluginName);\n }\n}\n\n/**\n * Wrap the extension method(s) in the live `server.ext` arguments array,\n * mutating `args` in place. Handles the three accepted input shapes:\n * `(eventsArray)`, `(lifecycleEventObject)`, and `(extTypeString, method, options)`.\n * Idempotent via the `handlerPatched` marker.\n */\nexport function wrapExtArguments(args: unknown[], pluginName?: string): void {\n if (Array.isArray(args[0])) {\n const eventsList = args[0] as ServerExtEventsObject[] | ServerExtEventsRequestObject[];\n for (const [i, eventObj] of eventsList.entries()) {\n if (isLifecycleExtType(eventObj.type)) {\n const lifecycleEventObj = eventObj as ServerExtEventsRequestObject;\n const handler = wrapExtMethods(lifecycleEventObj.method, eventObj.type, pluginName);\n lifecycleEventObj.method = handler;\n eventsList[i] = lifecycleEventObj;\n }\n }\n return;\n } else if (isDirectExtInput(args)) {\n const extInput: ServerExtDirectInput = args;\n const method: PatchableExtMethod = extInput[1];\n const handler = wrapExtMethods(method, extInput[0], pluginName);\n args[1] = handler;\n return;\n } else if (isLifecycleExtEventObj(args[0])) {\n const lifecycleEventObj = args[0];\n const handler = wrapExtMethods(lifecycleEventObj.method, lifecycleEventObj.type, pluginName);\n lifecycleEventObj.method = handler;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAqDA,SAAgB,yBAAyB,OAAgB,SAA+B;CACtF,MAAM,aAAa,sBAAsB,SAAS,KAAK;CACvD,IAAI,OAAO,eAAe,UACxB,OAAO;CAGT,OAAO,cAAc,OAAO,cAAc;AAC5C;;;;;;AAOA,SAAS,sBAAsB,SAAsB,OAAoC;CACvF,MAAM,WAAW,QAAQ;CACzB,IAAI,aAAa,QAAQ,GAAG;EAC1B,IAAI,SAAS,UAAU,aAAa,SAAS,MAAM,KAAK,OAAO,SAAS,OAAO,eAAe,UAC5F,OAAO,SA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eADmB,SAAS,IACL,SAAS,IAAI,UACpC;EAChB;CACF,OAAO,IAAI,uBAAuB,KAAK,EAAE,GAAG;EAC1C,MAAM,oBAAoB,KAAK;EAE/B,kBAAkB,SADF,eAAe,kBAAkB,QAAQ,kBAAkB,MAAM,UAChD;CACnC;AACF"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { tracingChannel } from "../../utils/diagnosticsChannel.js";
|
|
2
|
+
import { defineIntegration } from "@sentry/core";
|
|
2
3
|
import { CHANNELS } from "../../orchestrion/channels.js";
|
|
3
4
|
import { hapiModuleNames } from "../../orchestrion/config/hapi.js";
|
|
4
5
|
import { invokeOrchestrionInstrumentation } from "../../orchestrion/instrumentation.js";
|
|
5
6
|
import { attachHapiErrorHandler } from "./hapi-error-handler.js";
|
|
6
7
|
import { wrapExtArguments, wrapRouteArguments } from "./hapi-utils.js";
|
|
7
|
-
import { defineIntegration } from "@sentry/core";
|
|
8
8
|
// src/integrations/hapi/index.ts
|
|
9
9
|
const INTEGRATION_NAME = "Hapi";
|
|
10
10
|
const _hapiIntegration = (({ shouldHandleError } = {}) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { debug } from "@sentry/core";
|
|
1
2
|
import { DEBUG_BUILD } from "../../debug-build.js";
|
|
2
3
|
import { patchAppRequest } from "./patchAppRequest.js";
|
|
3
4
|
import { patchAppUse, patchHttpMethodHandlers } from "./patchAppUse.js";
|
|
4
5
|
import { installRouteHookOnPrototype, wrapSubAppMiddleware } from "./patchRoute.js";
|
|
5
|
-
import { debug } from "@sentry/core";
|
|
6
6
|
// src/integrations/hono/applyPatches.ts
|
|
7
7
|
let _routeHook;
|
|
8
8
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { addNonEnumerableProperty, getDefaultIsolationScope, getIsolationScope } from "@sentry/core";
|
|
1
2
|
import { SENTRY_HONO_MIDDLEWARE } from "./constants.js";
|
|
2
3
|
import { captureContextError, requestHandler, responseHandler } from "./middlewareHandlers.js";
|
|
3
|
-
import { addNonEnumerableProperty, getDefaultIsolationScope, getIsolationScope } from "@sentry/core";
|
|
4
4
|
// src/integrations/hono/createHonoMiddleware.ts
|
|
5
5
|
const HONO_REQUEST_HANDLED = Symbol.for("sentry.hono.requestHandled");
|
|
6
6
|
const HONO_SHOULD_HANDLE_ERROR = Symbol.for("sentry.hono.shouldHandleError");
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { tracingChannel } from "../../utils/diagnosticsChannel.js";
|
|
2
|
+
import { SENTRY_OP, SENTRY_ORIGIN } from "@sentry/conventions/attributes";
|
|
3
|
+
import { HTTP_SERVER } from "@sentry/conventions/op";
|
|
4
|
+
import { defineIntegration, startInactiveSpan } from "@sentry/core";
|
|
2
5
|
import { CHANNELS } from "../../orchestrion/channels.js";
|
|
3
6
|
import { honoModuleNames } from "../../orchestrion/config/hono.js";
|
|
4
7
|
import { invokeOrchestrionInstrumentation } from "../../orchestrion/instrumentation.js";
|
|
@@ -11,9 +14,6 @@ import { getMiddlewareFlags } from "./isMiddleware.js";
|
|
|
11
14
|
import { isMatchedHandlerList, wrapRouteHandlers } from "./matchResult.js";
|
|
12
15
|
import { extractPathname, isInternalRequestSpanActive } from "./patchAppRequest.js";
|
|
13
16
|
import { wrapMiddlewareWithSpan } from "./wrapMiddlewareSpan.js";
|
|
14
|
-
import { SENTRY_OP, SENTRY_ORIGIN } from "@sentry/conventions/attributes";
|
|
15
|
-
import { defineIntegration, startInactiveSpan } from "@sentry/core";
|
|
16
|
-
import { HTTP_SERVER } from "@sentry/conventions/op";
|
|
17
17
|
// src/integrations/hono/honoIntegration.ts
|
|
18
18
|
const INTEGRATION_NAME = "Hono";
|
|
19
19
|
function getHonoRuntime() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { sentryOriginalTraps } from "./sentryOriginalTraps.js";
|
|
2
1
|
import { addNonEnumerableProperty, isPlainObject } from "@sentry/core";
|
|
2
|
+
import { sentryOriginalTraps } from "./sentryOriginalTraps.js";
|
|
3
3
|
// src/integrations/hono/matchResult.ts
|
|
4
4
|
const ROUTE_HANDLER_INDEX = Symbol.for("sentry.hono.routeHandlerIndex");
|
|
5
5
|
const RECORDS_ROUTE_HANDLER_INDEX = Symbol.for("sentry.hono.recordsRouteHandlerIndex");
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { INTERNAL_setSegmentNameSourceIfSegment, captureException, getActiveSpan, getClient, getDefaultIsolationScope, getIsolationScope, getRootSpan, spanToJSON, updateSpanName, winterCGHeadersToDict, winterCGRequestToRequestData } from "@sentry/core";
|
|
2
|
+
import { getClientIPAddress } from "@sentry/core/server";
|
|
1
3
|
import { readConnInfo } from "./connInfo.js";
|
|
2
4
|
import { hasFetchEvent } from "./hono-context.js";
|
|
3
5
|
import { defaultShouldHandleError } from "./defaultShouldHandleError.js";
|
|
@@ -6,8 +8,6 @@ import { getMatchedHandlers, onRouteHandlerStart, wrapRouteHandlers } from "./ma
|
|
|
6
8
|
import { resolveRouteName } from "./resolveRouteName.js";
|
|
7
9
|
import { unwrapThrownValue } from "./unwrapThrownValue.js";
|
|
8
10
|
import { CLIENT_ADDRESS, CLIENT_PORT, HTTP_ROUTE, NETWORK_PEER_ADDRESS, NETWORK_PEER_PORT, NETWORK_TRANSPORT, NETWORK_TYPE } from "@sentry/conventions/attributes";
|
|
9
|
-
import { INTERNAL_setSegmentNameSourceIfSegment, captureException, getActiveSpan, getClient, getDefaultIsolationScope, getIsolationScope, getRootSpan, spanToJSON, updateSpanName, winterCGHeadersToDict, winterCGRequestToRequestData } from "@sentry/core";
|
|
10
|
-
import { getClientIPAddress } from "@sentry/core/server";
|
|
11
11
|
// src/integrations/hono/middlewareHandlers.ts
|
|
12
12
|
/**
|
|
13
13
|
* Request handler for Hono framework
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { SENTRY_OP, SENTRY_ORIGIN } from "@sentry/conventions/attributes";
|
|
2
|
+
import { HTTP_SERVER } from "@sentry/conventions/op";
|
|
3
|
+
import { debug, getActiveSpan, getOriginalFunction, startSpan } from "@sentry/core";
|
|
1
4
|
import { INTERNAL_REQUEST_ORIGIN } from "./constants.js";
|
|
2
5
|
import { DEBUG_BUILD } from "../../debug-build.js";
|
|
3
6
|
import { sentryOriginalTraps } from "./sentryOriginalTraps.js";
|
|
4
|
-
import { SENTRY_OP, SENTRY_ORIGIN } from "@sentry/conventions/attributes";
|
|
5
|
-
import { debug, getActiveSpan, getOriginalFunction, startSpan } from "@sentry/core";
|
|
6
|
-
import { HTTP_SERVER } from "@sentry/conventions/op";
|
|
7
7
|
// src/integrations/hono/patchAppRequest.ts
|
|
8
8
|
const INTERNAL_REQUEST_OP = HTTP_SERVER;
|
|
9
9
|
const INTERNAL_REQUEST_SPAN_ACTIVE = Symbol.for("sentry.hono.internalRequestSpanActive");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { debug } from "@sentry/core";
|
|
1
2
|
import { DEBUG_BUILD } from "../../debug-build.js";
|
|
2
3
|
import { wrapMiddlewareWithSpan } from "./wrapMiddlewareSpan.js";
|
|
3
|
-
import { debug } from "@sentry/core";
|
|
4
4
|
// src/integrations/hono/patchAppUse.ts
|
|
5
5
|
const patchedUseInstances = /* @__PURE__ */ new WeakSet();
|
|
6
6
|
const patchedMethodInstances = /* @__PURE__ */ new WeakSet();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { debug, getOriginalFunction } from "@sentry/core";
|
|
1
2
|
import { DEBUG_BUILD } from "../../debug-build.js";
|
|
2
3
|
import { getMiddlewareFlags } from "./isMiddleware.js";
|
|
3
4
|
import { patchAppRequest } from "./patchAppRequest.js";
|
|
4
5
|
import { wrapMiddlewareWithSpan } from "./wrapMiddlewareSpan.js";
|
|
5
6
|
import { sentryOriginalTraps } from "./sentryOriginalTraps.js";
|
|
6
|
-
import { debug, getOriginalFunction } from "@sentry/core";
|
|
7
7
|
// src/integrations/hono/patchRoute.ts
|
|
8
8
|
/**
|
|
9
9
|
* Creates the two-phase state machine for the route hook.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { SENTRY_OP, SENTRY_ORIGIN } from "@sentry/conventions/attributes";
|
|
2
|
+
import { MIDDLEWARE } from "@sentry/conventions/op";
|
|
3
|
+
import { SPAN_STATUS_ERROR, getActiveSpan, getOriginalFunction, getRootSpan, startInactiveSpan } from "@sentry/core";
|
|
1
4
|
import "./constants.js";
|
|
2
5
|
import { defaultShouldHandleError } from "./defaultShouldHandleError.js";
|
|
3
6
|
import { sentryOriginalTraps } from "./sentryOriginalTraps.js";
|
|
4
|
-
import { SENTRY_OP, SENTRY_ORIGIN } from "@sentry/conventions/attributes";
|
|
5
|
-
import { SPAN_STATUS_ERROR, getActiveSpan, getOriginalFunction, getRootSpan, startInactiveSpan } from "@sentry/core";
|
|
6
|
-
import { MIDDLEWARE } from "@sentry/conventions/op";
|
|
7
7
|
// src/integrations/hono/wrapMiddlewareSpan.ts
|
|
8
8
|
const MIDDLEWARE_ORIGIN = "auto.middleware.hono";
|
|
9
9
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ATTR_MESSAGING_DESTINATION_PARTITION_ID, MESSAGING_OPERATION_TYPE_VALUE_PROCESS, MESSAGING_OPERATION_TYPE_VALUE_RECEIVE } from "./semconv.js";
|
|
2
|
-
import { endSpansOnPromise, getHeaderAsString, getLinksFromHeaders, startConsumerSpan } from "./spans.js";
|
|
3
1
|
import { MESSAGING_BATCH_MESSAGE_COUNT } from "@sentry/conventions/attributes";
|
|
4
2
|
import { continueTrace, startNewTrace, withActiveSpan } from "@sentry/core";
|
|
3
|
+
import { ATTR_MESSAGING_DESTINATION_PARTITION_ID, MESSAGING_OPERATION_TYPE_VALUE_PROCESS, MESSAGING_OPERATION_TYPE_VALUE_RECEIVE } from "./semconv.js";
|
|
4
|
+
import { endSpansOnPromise, getHeaderAsString, getLinksFromHeaders, startConsumerSpan } from "./spans.js";
|
|
5
5
|
// src/integrations/kafkajs/consumer.ts
|
|
6
6
|
const consumerCallbackWrapped = Symbol("sentry-kafkajs-consumer-callback-wrapped");
|
|
7
7
|
/** Whether `fn` is a callback this module already wrapped, so callers skip re-wrapping it. */
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { tracingChannel } from "../../utils/diagnosticsChannel.js";
|
|
2
|
+
import { defineIntegration } from "@sentry/core";
|
|
2
3
|
import { CHANNELS } from "../../orchestrion/channels.js";
|
|
3
4
|
import { kafkajsModuleNames } from "../../orchestrion/config/kafkajs.js";
|
|
4
5
|
import { invokeOrchestrionInstrumentation } from "../../orchestrion/instrumentation.js";
|
|
5
6
|
import { isWrappedConsumerCallback, wrapEachBatch, wrapEachMessage } from "./consumer.js";
|
|
6
7
|
import { applyErrorToSpans, startProducerSpan } from "./spans.js";
|
|
7
|
-
import { defineIntegration } from "@sentry/core";
|
|
8
8
|
// src/integrations/kafkajs/index.ts
|
|
9
9
|
const INTEGRATION_NAME = "Kafka";
|
|
10
10
|
function subscribeToProducer() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ATTR_MESSAGING_DESTINATION_PARTITION_ID, ATTR_MESSAGING_KAFKA_MESSAGE_KEY, ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE, ATTR_MESSAGING_KAFKA_OFFSET, ERROR_TYPE_VALUE_OTHER, MESSAGING_OPERATION_TYPE_VALUE_RECEIVE, MESSAGING_OPERATION_TYPE_VALUE_SEND, MESSAGING_SYSTEM_VALUE_KAFKA } from "./semconv.js";
|
|
2
1
|
import { ERROR_TYPE, MESSAGING_DESTINATION_NAME, MESSAGING_OPERATION_NAME, MESSAGING_OPERATION_TYPE, MESSAGING_SYSTEM, SENTRY_KIND, SENTRY_OP, SENTRY_ORIGIN } from "@sentry/conventions/attributes";
|
|
3
|
-
import { SPAN_STATUS_ERROR, getClient, getTraceData, hasSpanStreamingEnabled, isObjectLike, propagationContextFromHeaders, startInactiveSpan } from "@sentry/core";
|
|
4
2
|
import { QUEUE_PROCESS, QUEUE_PUBLISH, QUEUE_RECEIVE } from "@sentry/conventions/op";
|
|
3
|
+
import { SPAN_STATUS_ERROR, getClient, getTraceData, hasSpanStreamingEnabled, isObjectLike, propagationContextFromHeaders, startInactiveSpan } from "@sentry/core";
|
|
4
|
+
import { ATTR_MESSAGING_DESTINATION_PARTITION_ID, ATTR_MESSAGING_KAFKA_MESSAGE_KEY, ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE, ATTR_MESSAGING_KAFKA_OFFSET, ERROR_TYPE_VALUE_OTHER, MESSAGING_OPERATION_TYPE_VALUE_RECEIVE, MESSAGING_OPERATION_TYPE_VALUE_SEND, MESSAGING_SYSTEM_VALUE_KAFKA } from "./semconv.js";
|
|
5
5
|
// src/integrations/kafkajs/spans.ts
|
|
6
6
|
const PRODUCER_ORIGIN = "auto.queue.kafkajs.producer";
|
|
7
7
|
const CONSUMER_ORIGIN = "auto.queue.kafkajs.consumer";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { tracingChannel } from "../utils/diagnosticsChannel.js";
|
|
2
|
+
import { SPAN_STATUS_ERROR, debug, defineIntegration, getActiveSpan, startInactiveSpan, truncate, waitForTracingChannelBinding } from "@sentry/core";
|
|
3
|
+
import { DB_NAMESPACE, DB_OPERATION_NAME, DB_SYSTEM_NAME, DB_USER, NETWORK_TRANSPORT, SENTRY_KIND, SENTRY_OP, SENTRY_ORIGIN, SERVER_ADDRESS, SERVER_PORT } from "@sentry/conventions/attributes";
|
|
4
|
+
import { DB } from "@sentry/conventions/op";
|
|
2
5
|
import { DEBUG_BUILD } from "../debug-build.js";
|
|
3
6
|
import { CHANNELS } from "../orchestrion/channels.js";
|
|
4
7
|
import { bindTracingChannelToSpan } from "../tracing-channel.js";
|
|
5
8
|
import { getSqlQueryAttributes, getSqlSpanName, toSqlDialect } from "../utils/sql.js";
|
|
6
|
-
import { DB_NAMESPACE, DB_OPERATION_NAME, DB_SYSTEM_NAME, DB_USER, NETWORK_TRANSPORT, SENTRY_KIND, SENTRY_OP, SENTRY_ORIGIN, SERVER_ADDRESS, SERVER_PORT } from "@sentry/conventions/attributes";
|
|
7
|
-
import { SPAN_STATUS_ERROR, debug, defineIntegration, getActiveSpan, startInactiveSpan, truncate, waitForTracingChannelBinding } from "@sentry/core";
|
|
8
|
-
import { DB } from "@sentry/conventions/op";
|
|
9
9
|
// src/integrations/knex.ts
|
|
10
10
|
const INTEGRATION_NAME = "Knex";
|
|
11
11
|
const ORIGIN = "auto.db.knex";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { tracingChannel } from "../../utils/diagnosticsChannel.js";
|
|
2
|
+
import { ROUTER_SPAN_NAME_FALLBACK, addNonEnumerableProperty, debug, defineIntegration, getActiveSpan, getClient, getDefaultIsolationScope, getIsolationScope, hasSpanStreamingEnabled, startSpan } from "@sentry/core";
|
|
3
|
+
import { CODE_FUNCTION_NAME, HTTP_ROUTE, KOA_TYPE, SENTRY_OP, SENTRY_ORIGIN } from "@sentry/conventions/attributes";
|
|
4
|
+
import { MIDDLEWARE, ROUTER } from "@sentry/conventions/op";
|
|
2
5
|
import { DEBUG_BUILD } from "../../debug-build.js";
|
|
3
6
|
import { CHANNELS } from "../../orchestrion/channels.js";
|
|
4
7
|
import { koaModuleNames } from "../../orchestrion/config/koa.js";
|
|
5
8
|
import { invokeOrchestrionInstrumentation } from "../../orchestrion/instrumentation.js";
|
|
6
9
|
import { setHttpServerSpanRouteAttribute } from "../../utils/setHttpServerSpanRouteAttribute.js";
|
|
7
10
|
import { KOA_CONTEXT_SPAN, attachKoaErrorHandler } from "./koa-error-handler.js";
|
|
8
|
-
import { CODE_FUNCTION_NAME, HTTP_ROUTE, KOA_TYPE, SENTRY_OP, SENTRY_ORIGIN } from "@sentry/conventions/attributes";
|
|
9
|
-
import { ROUTER_SPAN_NAME_FALLBACK, addNonEnumerableProperty, debug, defineIntegration, getActiveSpan, getClient, getDefaultIsolationScope, getIsolationScope, hasSpanStreamingEnabled, startSpan } from "@sentry/core";
|
|
10
|
-
import { MIDDLEWARE, ROUTER } from "@sentry/conventions/op";
|
|
11
11
|
// src/integrations/koa/index.ts
|
|
12
12
|
const INTEGRATION_NAME = "Koa";
|
|
13
13
|
const ORIGIN = "auto.http.koa";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { tracingChannel } from "../utils/diagnosticsChannel.js";
|
|
2
|
+
import { _INTERNAL_skipAiProviderWrapping, defineIntegration, startInactiveSpan } from "@sentry/core";
|
|
2
3
|
import { ANTHROPIC_AI_INTEGRATION_NAME } from "../ai/anthropic-ai/constants.js";
|
|
3
4
|
import { GOOGLE_GENAI_INTEGRATION_NAME } from "../ai/google-genai/constants.js";
|
|
4
5
|
import { createLangChainCallbackHandler } from "../ai/langchain/index.js";
|
|
@@ -14,7 +15,6 @@ import { CHANNELS } from "../orchestrion/channels.js";
|
|
|
14
15
|
import { langchainEmbeddingsChannels, langchainModuleNames } from "../orchestrion/config/langchain.js";
|
|
15
16
|
import { bindTracingChannelToSpan } from "../tracing-channel.js";
|
|
16
17
|
import { invokeOrchestrionInstrumentation } from "../orchestrion/instrumentation.js";
|
|
17
|
-
import { _INTERNAL_skipAiProviderWrapping, defineIntegration, startInactiveSpan } from "@sentry/core";
|
|
18
18
|
// src/integrations/langchain.ts
|
|
19
19
|
const INTEGRATION_NAME = LANGCHAIN_INTEGRATION_NAME;
|
|
20
20
|
const SKIPPED_PROVIDERS = [
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { tracingChannel } from "../utils/diagnosticsChannel.js";
|
|
2
|
+
import { debug, defineIntegration, isObjectLike } from "@sentry/core";
|
|
2
3
|
import { createLangChainCallbackHandler } from "../ai/langchain/index.js";
|
|
3
4
|
import { instrumentCompiledGraph, isInsideManualLangGraphInstrumentation } from "../ai/langgraph/index.js";
|
|
4
5
|
import { LANGGRAPH_INTEGRATION_NAME } from "../ai/langgraph/constants.js";
|
|
@@ -7,7 +8,6 @@ import { DEBUG_BUILD } from "../debug-build.js";
|
|
|
7
8
|
import { CHANNELS } from "../orchestrion/channels.js";
|
|
8
9
|
import { langgraphModuleNames } from "../orchestrion/config/langgraph.js";
|
|
9
10
|
import { invokeOrchestrionInstrumentation } from "../orchestrion/instrumentation.js";
|
|
10
|
-
import { debug, defineIntegration, isObjectLike } from "@sentry/core";
|
|
11
11
|
// src/integrations/langgraph.ts
|
|
12
12
|
const INTEGRATION_NAME = LANGGRAPH_INTEGRATION_NAME;
|
|
13
13
|
let insideCreateReactAgent = false;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { tracingChannel } from "../utils/diagnosticsChannel.js";
|
|
2
|
+
import { defineIntegration } from "@sentry/core";
|
|
2
3
|
import { CHANNELS } from "../orchestrion/channels.js";
|
|
3
4
|
import { bindTracingChannelToSpan } from "../tracing-channel.js";
|
|
4
5
|
import { lruMemoizerModuleNames } from "../orchestrion/config/lru-memoizer.js";
|
|
5
6
|
import { invokeOrchestrionInstrumentation } from "../orchestrion/instrumentation.js";
|
|
6
|
-
import { defineIntegration } from "@sentry/core";
|
|
7
7
|
// src/integrations/lru-memoizer.ts
|
|
8
8
|
const INTEGRATION_NAME = "LruMemoizer";
|
|
9
9
|
const _lruMemoizerIntegration = (() => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { GEN_AI_INPUT_MESSAGES, GEN_AI_OUTPUT_MESSAGES } from "@sentry/conventions/attributes";
|
|
2
|
+
import { isObjectLike } from "@sentry/core";
|
|
1
3
|
import { processClassifierEvaluationData, setStartingClassifierEvaluation } from "../ai/mastra/classifier-evaluation.js";
|
|
2
4
|
import { getEvaluationInputMessages, getEvaluationOutputMessages } from "../ai/core/utils.js";
|
|
3
5
|
import { CHANNELS } from "../orchestrion/channels.js";
|
|
4
6
|
import { safeChannelCallback } from "../tracing-channel.js";
|
|
5
7
|
import { tracingChannel } from "../utils/diagnosticsChannel.js";
|
|
6
|
-
import { GEN_AI_INPUT_MESSAGES, GEN_AI_OUTPUT_MESSAGES } from "@sentry/conventions/attributes";
|
|
7
|
-
import { isObjectLike } from "@sentry/core";
|
|
8
8
|
// src/integrations/mastra-classifier.ts
|
|
9
9
|
/**
|
|
10
10
|
* Add the evaluated state, questions and answers of a `Classifier.evaluate()` call to the exporter's
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { tracingChannel } from "../utils/diagnosticsChannel.js";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { GLOBAL_OBJ, captureException, consoleSandbox, debug, defineIntegration, isObjectLike, withActiveSpan } from "@sentry/core";
|
|
2
6
|
import { MASTRA_EXPORTER_BRAND, MASTRA_INTEGRATION_NAME } from "../ai/mastra/constants.js";
|
|
3
7
|
import { SentryMastraExporter } from "../ai/mastra/index.js";
|
|
4
8
|
import { getSentrySpanForMastraId } from "../ai/mastra/span-registry.js";
|
|
@@ -8,10 +12,6 @@ import { mastraModuleNames } from "../orchestrion/config/mastra.js";
|
|
|
8
12
|
import { recordClassifierEvaluations } from "./mastra-classifier.js";
|
|
9
13
|
import { invokeOrchestrionInstrumentation } from "../orchestrion/instrumentation.js";
|
|
10
14
|
import { bindSpanToChannelStore, safeChannelCallback } from "../tracing-channel.js";
|
|
11
|
-
import { GLOBAL_OBJ, captureException, consoleSandbox, debug, defineIntegration, isObjectLike, withActiveSpan } from "@sentry/core";
|
|
12
|
-
import { createRequire } from "node:module";
|
|
13
|
-
import { join } from "node:path";
|
|
14
|
-
import { fileURLToPath } from "node:url";
|
|
15
15
|
// src/integrations/mastra.ts
|
|
16
16
|
/** Mastra AISpan → the id the exporter keys its Sentry span on. */
|
|
17
17
|
function mastraSpanId(span) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { tracingChannel } from "../utils/diagnosticsChannel.js";
|
|
2
|
+
import { defineIntegration } from "@sentry/core";
|
|
3
|
+
import { wrapMcpServerWithSentry } from "@sentry/core/server";
|
|
2
4
|
import { CHANNELS } from "../orchestrion/channels.js";
|
|
3
5
|
import { mcpServerModuleNames } from "../orchestrion/config/mcp-server.js";
|
|
4
6
|
import { invokeOrchestrionInstrumentation } from "../orchestrion/instrumentation.js";
|
|
5
7
|
import { safeChannelCallback } from "../tracing-channel.js";
|
|
6
|
-
import { defineIntegration } from "@sentry/core";
|
|
7
|
-
import { wrapMcpServerWithSentry } from "@sentry/core/server";
|
|
8
8
|
// src/integrations/mcp-server.ts
|
|
9
9
|
const INTEGRATION_NAME = "McpServer";
|
|
10
10
|
const _mcpServerIntegration = (() => {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { SENTRY_ORIGIN } from "@sentry/conventions/attributes";
|
|
1
2
|
import { tracingChannel } from "../utils/diagnosticsChannel.js";
|
|
3
|
+
import { defineIntegration, startInactiveSpan } from "@sentry/core";
|
|
2
4
|
import { getGenAiSpanOp, markCancelledIfAborted, resolveGenAiCallRecording } from "../ai/core/utils.js";
|
|
3
5
|
import { runGenAiSpanEnd, runGenAiSpanStart } from "../ai/core/span-hooks.js";
|
|
4
6
|
import { addRequestAttributes, extractRequestAttributes } from "../ai/mistral/index.js";
|
|
@@ -10,8 +12,6 @@ import { CHANNELS } from "../orchestrion/channels.js";
|
|
|
10
12
|
import { mistralModuleNames } from "../orchestrion/config/mistral.js";
|
|
11
13
|
import { invokeOrchestrionInstrumentation } from "../orchestrion/instrumentation.js";
|
|
12
14
|
import { bindTracingChannelToSpan } from "../tracing-channel.js";
|
|
13
|
-
import { SENTRY_ORIGIN } from "@sentry/conventions/attributes";
|
|
14
|
-
import { defineIntegration, startInactiveSpan } from "@sentry/core";
|
|
15
15
|
// src/integrations/mistral.ts
|
|
16
16
|
const INTEGRATION_NAME = MISTRAL_INTEGRATION_NAME;
|
|
17
17
|
const INSTRUMENTED_CHANNELS = [
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { tracingChannel } from "../../utils/diagnosticsChannel.js";
|
|
2
|
+
import { defineIntegration } from "@sentry/core";
|
|
2
3
|
import { getV3CommandOperation, getV3SpanAttributes, getV4SpanAttributes, startMongoSpan } from "./mongodb-span.js";
|
|
3
4
|
import { CHANNELS } from "../../orchestrion/channels.js";
|
|
4
5
|
import { bindTracingChannelToSpan } from "../../tracing-channel.js";
|
|
5
6
|
import { mongodbModuleNames } from "../../orchestrion/config/mongodb.js";
|
|
6
7
|
import { invokeOrchestrionInstrumentation } from "../../orchestrion/instrumentation.js";
|
|
7
|
-
import { defineIntegration } from "@sentry/core";
|
|
8
8
|
// src/integrations/mongodb/index.ts
|
|
9
9
|
const INTEGRATION_NAME = "Mongo";
|
|
10
10
|
const ORIGIN = "auto.db.mongo";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DB_COLLECTION_NAME, DB_CONNECTION_STRING, DB_NAMESPACE, DB_OPERATION_NAME, DB_QUERY_TEXT, DB_SYSTEM_NAME, SENTRY_KIND, SENTRY_OP, SENTRY_ORIGIN, SERVER_ADDRESS, SERVER_PORT } from "@sentry/conventions/attributes";
|
|
2
|
-
import { getActiveSpan, getClient, hasSpanStreamingEnabled, isObjectLike, startInactiveSpan } from "@sentry/core";
|
|
3
2
|
import { DB } from "@sentry/conventions/op";
|
|
3
|
+
import { getActiveSpan, getClient, hasSpanStreamingEnabled, isObjectLike, startInactiveSpan } from "@sentry/core";
|
|
4
4
|
// src/integrations/mongodb/mongodb-span.ts
|
|
5
5
|
const DB_SYSTEM_VALUE_MONGODB = "mongodb";
|
|
6
6
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { tracingChannel } from "../../utils/diagnosticsChannel.js";
|
|
2
|
+
import { defineIntegration, getActiveSpan, waitForTracingChannelBinding } from "@sentry/core";
|
|
2
3
|
import { subscribeMongooseDiagnosticChannels } from "./mongoose-dc-subscriber.js";
|
|
3
4
|
import { startMongooseLegacySpan } from "./mongoose-legacy-span.js";
|
|
4
5
|
import { CHANNELS } from "../../orchestrion/channels.js";
|
|
5
6
|
import { MONGOOSE_CONTEXT_CAPTURE_CHANNELS, mongooseModuleNames } from "../../orchestrion/config/mongoose.js";
|
|
6
7
|
import { bindTracingChannelToSpan } from "../../tracing-channel.js";
|
|
7
8
|
import { invokeOrchestrionInstrumentation } from "../../orchestrion/instrumentation.js";
|
|
8
|
-
import { defineIntegration, getActiveSpan, waitForTracingChannelBinding } from "@sentry/core";
|
|
9
9
|
// src/integrations/mongoose/index.ts
|
|
10
10
|
const INTEGRATION_NAME = "Mongoose";
|
|
11
11
|
const ORIGIN = "auto.db.mongoose";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DEBUG_BUILD } from "../../debug-build.js";
|
|
2
|
-
import { bindTracingChannelToSpan } from "../../tracing-channel.js";
|
|
3
1
|
import { DB_COLLECTION_NAME, DB_NAMESPACE, DB_OPERATION_BATCH_SIZE, DB_OPERATION_NAME, DB_QUERY_TEXT, DB_SYSTEM_NAME, SENTRY_OP, SENTRY_ORIGIN, SERVER_ADDRESS, SERVER_PORT } from "@sentry/conventions/attributes";
|
|
4
|
-
import { debug, getClient, hasSpanStreamingEnabled, isObjectLike, startInactiveSpan } from "@sentry/core";
|
|
5
2
|
import { DB } from "@sentry/conventions/op";
|
|
3
|
+
import { debug, getClient, hasSpanStreamingEnabled, isObjectLike, startInactiveSpan } from "@sentry/core";
|
|
4
|
+
import { DEBUG_BUILD } from "../../debug-build.js";
|
|
5
|
+
import { bindTracingChannelToSpan } from "../../tracing-channel.js";
|
|
6
6
|
// src/integrations/mongoose/mongoose-dc-subscriber.ts
|
|
7
7
|
const MONGOOSE_DC_CHANNEL_QUERY = "mongoose:query";
|
|
8
8
|
const MONGOOSE_DC_CHANNEL_AGGREGATE = "mongoose:aggregate";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DB_COLLECTION_NAME, DB_NAMESPACE, DB_OPERATION_NAME, DB_SYSTEM_NAME, DB_USER, SENTRY_KIND, SENTRY_OP, SENTRY_ORIGIN, SERVER_ADDRESS, SERVER_PORT } from "@sentry/conventions/attributes";
|
|
2
|
-
import { getClient, hasSpanStreamingEnabled, startInactiveSpan } from "@sentry/core";
|
|
3
2
|
import { DB } from "@sentry/conventions/op";
|
|
3
|
+
import { getClient, hasSpanStreamingEnabled, startInactiveSpan } from "@sentry/core";
|
|
4
4
|
// src/integrations/mongoose/mongoose-legacy-span.ts
|
|
5
5
|
const DB_SYSTEM_NAME_VALUE_MONGODB = "mongodb";
|
|
6
6
|
/**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { tracingChannel } from "../utils/diagnosticsChannel.js";
|
|
2
|
+
import { DB_CONNECTION_STRING, DB_NAMESPACE, DB_SYSTEM_NAME, DB_USER, SENTRY_KIND, SENTRY_OP, SENTRY_ORIGIN, SERVER_ADDRESS, SERVER_PORT } from "@sentry/conventions/attributes";
|
|
3
|
+
import { DB } from "@sentry/conventions/op";
|
|
4
|
+
import { bindScopeToEmitter, defineIntegration, getCurrentScope, isObjectLike, startInactiveSpan } from "@sentry/core";
|
|
2
5
|
import { getSqlQueryAttributes, getSqlSpanName } from "../utils/sql.js";
|
|
3
6
|
import { CHANNELS } from "../orchestrion/channels.js";
|
|
4
7
|
import { bindTracingChannelToSpan } from "../tracing-channel.js";
|
|
5
8
|
import { mysqlModuleNames } from "../orchestrion/config/mysql.js";
|
|
6
9
|
import { invokeOrchestrionInstrumentation } from "../orchestrion/instrumentation.js";
|
|
7
|
-
import { DB_CONNECTION_STRING, DB_NAMESPACE, DB_SYSTEM_NAME, DB_USER, SENTRY_KIND, SENTRY_OP, SENTRY_ORIGIN, SERVER_ADDRESS, SERVER_PORT } from "@sentry/conventions/attributes";
|
|
8
|
-
import { bindScopeToEmitter, defineIntegration, getCurrentScope, isObjectLike, startInactiveSpan } from "@sentry/core";
|
|
9
|
-
import { DB } from "@sentry/conventions/op";
|
|
10
10
|
// src/integrations/mysql.ts
|
|
11
11
|
const INTEGRATION_NAME = "Mysql";
|
|
12
12
|
const DB_SYSTEM_NAME_VALUE_MYSQL = "mysql";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { tracingChannel } from "../../utils/diagnosticsChannel.js";
|
|
2
|
+
import { defineIntegration, isObjectLike, startInactiveSpan, waitForTracingChannelBinding } from "@sentry/core";
|
|
2
3
|
import { getSqlQueryAttributes, getSqlSpanName } from "../../utils/sql.js";
|
|
3
4
|
import { subscribeMysql2DiagnosticChannels } from "./mysql2-dc-subscriber.js";
|
|
4
5
|
import { CHANNELS } from "../../orchestrion/channels.js";
|
|
@@ -6,7 +7,6 @@ import { bindTracingChannelToSpan } from "../../tracing-channel.js";
|
|
|
6
7
|
import { mysql2ModuleNames } from "../../orchestrion/config/mysql2.js";
|
|
7
8
|
import { invokeOrchestrionInstrumentation } from "../../orchestrion/instrumentation.js";
|
|
8
9
|
import { DB_NAMESPACE, DB_SYSTEM_NAME, DB_USER, SENTRY_KIND, SENTRY_OP, SENTRY_ORIGIN, SERVER_ADDRESS, SERVER_PORT } from "@sentry/conventions/attributes";
|
|
9
|
-
import { defineIntegration, isObjectLike, startInactiveSpan, waitForTracingChannelBinding } from "@sentry/core";
|
|
10
10
|
import { DB } from "@sentry/conventions/op";
|
|
11
11
|
// src/integrations/mysql2/index.ts
|
|
12
12
|
const INTEGRATION_NAME = "Mysql2";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { bindTracingChannelToSpan } from "../../tracing-channel.js";
|
|
2
|
-
import { getSqlQueryAttributes, getSqlSpanName } from "../../utils/sql.js";
|
|
3
1
|
import { DB_NAMESPACE, DB_SYSTEM_NAME, SENTRY_OP, SENTRY_ORIGIN, SERVER_ADDRESS, SERVER_PORT } from "@sentry/conventions/attributes";
|
|
4
|
-
import { startInactiveSpan } from "@sentry/core";
|
|
5
2
|
import { DB } from "@sentry/conventions/op";
|
|
3
|
+
import { startInactiveSpan } from "@sentry/core";
|
|
4
|
+
import { bindTracingChannelToSpan } from "../../tracing-channel.js";
|
|
5
|
+
import { getSqlQueryAttributes, getSqlSpanName } from "../../utils/sql.js";
|
|
6
6
|
// src/integrations/mysql2/mysql2-dc-subscriber.ts
|
|
7
7
|
const MYSQL2_DC_CHANNEL_QUERY = "mysql2:query";
|
|
8
8
|
const MYSQL2_DC_CHANNEL_EXECUTE = "mysql2:execute";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { tracingChannel } from "../utils/diagnosticsChannel.js";
|
|
2
|
+
import { DB_OPERATION_BATCH_SIZE, DB_OPERATION_NAME, DB_QUERY_SUMMARY, DB_QUERY_TEXT, DB_SYSTEM_NAME, SENTRY_KIND, SENTRY_OP, SENTRY_ORIGIN } from "@sentry/conventions/attributes";
|
|
3
|
+
import { DB } from "@sentry/conventions/op";
|
|
4
|
+
import { defineIntegration, getActiveSpan, startInactiveSpan } from "@sentry/core";
|
|
2
5
|
import { getLowCardinalitySqlSpanName, getSqlQueryAttributes } from "../utils/sql.js";
|
|
3
6
|
import { CHANNELS } from "../orchestrion/channels.js";
|
|
4
7
|
import { neonModuleNames } from "../orchestrion/config/neon.js";
|
|
5
8
|
import { invokeOrchestrionInstrumentation } from "../orchestrion/instrumentation.js";
|
|
6
9
|
import { bindTracingChannelToSpan } from "../tracing-channel.js";
|
|
7
10
|
import { bindPgQueryChannel, getConnectionAttributes, setReturnedRows } from "./pg.js";
|
|
8
|
-
import { DB_OPERATION_BATCH_SIZE, DB_OPERATION_NAME, DB_QUERY_SUMMARY, DB_QUERY_TEXT, DB_SYSTEM_NAME, SENTRY_KIND, SENTRY_OP, SENTRY_ORIGIN } from "@sentry/conventions/attributes";
|
|
9
|
-
import { defineIntegration, getActiveSpan, startInactiveSpan } from "@sentry/core";
|
|
10
|
-
import { DB } from "@sentry/conventions/op";
|
|
11
11
|
// src/integrations/neon.ts
|
|
12
12
|
const INTEGRATION_NAME = "Neon";
|
|
13
13
|
const ORIGIN = "auto.db.neon";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { bindTracingChannelToSpan } from "../../tracing-channel.js";
|
|
2
|
-
import { tracingChannel } from "../../utils/diagnosticsChannel.js";
|
|
3
1
|
import { CACHE_HIT, CACHE_KEY, CACHE_OPERATION, DB_COLLECTION_NAME, DB_OPERATION_NAME, DB_SYSTEM_NAME, SENTRY_OP, SENTRY_ORIGIN } from "@sentry/conventions/attributes";
|
|
4
|
-
import { CACHE_OPERATION_NAMES, GLOBAL_OBJ, _INTERNAL_safeDateNow, getClient, hasSpanStreamingEnabled, isObjectLike, startInactiveSpan } from "@sentry/core";
|
|
5
2
|
import { CACHE_GET, CACHE_PUT, CACHE_REMOVE } from "@sentry/conventions/op";
|
|
3
|
+
import { CACHE_OPERATION_NAMES, GLOBAL_OBJ, _INTERNAL_safeDateNow, getClient, hasSpanStreamingEnabled, isObjectLike, startInactiveSpan } from "@sentry/core";
|
|
6
4
|
import { flushIfServerless } from "@sentry/core/server";
|
|
5
|
+
import { bindTracingChannelToSpan } from "../../tracing-channel.js";
|
|
6
|
+
import { tracingChannel } from "../../utils/diagnosticsChannel.js";
|
|
7
7
|
// src/integrations/nitro/captureStorageEvents.ts
|
|
8
8
|
const ORIGIN = "auto.cache.nitro";
|
|
9
9
|
const TRACED_OPERATIONS = [
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { SENTRY_OP, SENTRY_ORIGIN, SENTRY_SEGMENT_NAME_SOURCE, SERVER_PORT } from "@sentry/conventions/attributes";
|
|
2
|
+
import { HANDLER, HTTP_SERVER, MIDDLEWARE } from "@sentry/conventions/op";
|
|
3
|
+
import { GLOBAL_OBJ, HTTP_SPAN_NAME_FALLBACK, getActiveSpan, getClient, getHttpSpanDetailsFromUrlObject, getRootSpan, hasSpanStreamingEnabled, httpHeadersToSpanAttributes, isObjectLike, parseStringToURLObject, setHttpStatus, spanToJSON, startInactiveSpan } from "@sentry/core";
|
|
1
4
|
import { bindTracingChannelToSpan } from "../../tracing-channel.js";
|
|
2
5
|
import { tracingChannel } from "../../utils/diagnosticsChannel.js";
|
|
3
6
|
import { setHttpServerSpanRouteAttribute } from "../../utils/setHttpServerSpanRouteAttribute.js";
|
|
4
|
-
import { SENTRY_OP, SENTRY_ORIGIN, SENTRY_SEGMENT_NAME_SOURCE, SERVER_PORT } from "@sentry/conventions/attributes";
|
|
5
|
-
import { GLOBAL_OBJ, HTTP_SPAN_NAME_FALLBACK, getActiveSpan, getClient, getHttpSpanDetailsFromUrlObject, getRootSpan, hasSpanStreamingEnabled, httpHeadersToSpanAttributes, isObjectLike, parseStringToURLObject, setHttpStatus, spanToJSON, startInactiveSpan } from "@sentry/core";
|
|
6
|
-
import { HANDLER, HTTP_SERVER, MIDDLEWARE } from "@sentry/conventions/op";
|
|
7
7
|
// src/integrations/nitro/captureTracingEvents.ts
|
|
8
8
|
/**
|
|
9
9
|
* Captures tracing events emitted by Nitro tracing channels.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { defineIntegration } from "@sentry/core";
|
|
1
2
|
import { captureStorageEvents } from "./captureStorageEvents.js";
|
|
2
3
|
import { captureTracingEvents } from "./captureTracingEvents.js";
|
|
3
4
|
import { captureServerTimingHeaders } from "./setServerTimingHeaders.js";
|
|
4
|
-
import { defineIntegration } from "@sentry/core";
|
|
5
5
|
// src/integrations/nitro/index.ts
|
|
6
6
|
const INTEGRATION_NAME = "Nitro";
|
|
7
7
|
const _nitroIntegration = ((options = {}) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { tracingChannel } from "../../utils/diagnosticsChannel.js";
|
|
2
1
|
import { GLOBAL_OBJ, getTraceData } from "@sentry/core";
|
|
2
|
+
import { tracingChannel } from "../../utils/diagnosticsChannel.js";
|
|
3
3
|
// src/integrations/nitro/setServerTimingHeaders.ts
|
|
4
4
|
/**
|
|
5
5
|
* Subscribes to the h3 request tracing channel to set Server-Timing trace headers on every response.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { defineIntegration } from "@sentry/core";
|
|
1
2
|
import { CHANNELS } from "../orchestrion/channels.js";
|
|
2
3
|
import { nodeCronModuleNames } from "../orchestrion/config/node-cron.js";
|
|
3
4
|
import { invokeOrchestrionInstrumentation } from "../orchestrion/instrumentation.js";
|
|
4
5
|
import { cronExpressionToMonitorConfig, shouldMonitorJob, subscribeToJobCreation, wrapScheduledJob } from "../utils/cronMonitoring.js";
|
|
5
|
-
import { defineIntegration } from "@sentry/core";
|
|
6
6
|
// src/integrations/node-cron.ts
|
|
7
7
|
const INTEGRATION_NAME = "NodeCron";
|
|
8
8
|
const _nodeCronIntegration = ((options = {}) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { defineIntegration } from "@sentry/core";
|
|
1
2
|
import { CHANNELS } from "../orchestrion/channels.js";
|
|
2
3
|
import { nodeScheduleModuleNames } from "../orchestrion/config/node-schedule.js";
|
|
3
4
|
import { invokeOrchestrionInstrumentation } from "../orchestrion/instrumentation.js";
|
|
4
5
|
import { cronExpressionToMonitorConfig, shouldMonitorJob, subscribeToScheduleChange, updateMonitorConfig, wrapScheduledJob } from "../utils/cronMonitoring.js";
|
|
5
|
-
import { defineIntegration } from "@sentry/core";
|
|
6
6
|
// src/integrations/node-schedule.ts
|
|
7
7
|
const INTEGRATION_NAME = "NodeSchedule";
|
|
8
8
|
const _nodeScheduleIntegration = ((options = {}) => {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { tracingChannel } from "../utils/diagnosticsChannel.js";
|
|
2
|
+
import { _INTERNAL_shouldSkipAiProviderWrapping, getClient, hasSpanStreamingEnabled, startInactiveSpan } from "@sentry/core";
|
|
3
|
+
import { GEN_AI_PROVIDER_NAME, SENTRY_ORIGIN } from "@sentry/conventions/attributes";
|
|
2
4
|
import { getGenAiSpanOp, getRequestSignal, markCancelledIfAborted, resolveGenAiCallRecording } from "../ai/core/utils.js";
|
|
3
5
|
import { wrapApiPromiseResponse } from "../ai/core/apiPromise.js";
|
|
4
6
|
import { runGenAiSpanEnd, runGenAiSpanStart } from "../ai/core/span-hooks.js";
|
|
@@ -7,8 +9,6 @@ import { instrumentStream } from "../ai/openai/streaming.js";
|
|
|
7
9
|
import { addResponseAttributes } from "../ai/openai/utils.js";
|
|
8
10
|
import { invokeOrchestrionInstrumentation } from "../orchestrion/instrumentation.js";
|
|
9
11
|
import { bindTracingChannelToSpan } from "../tracing-channel.js";
|
|
10
|
-
import { GEN_AI_PROVIDER_NAME, SENTRY_ORIGIN } from "@sentry/conventions/attributes";
|
|
11
|
-
import { _INTERNAL_shouldSkipAiProviderWrapping, getClient, hasSpanStreamingEnabled, startInactiveSpan } from "@sentry/core";
|
|
12
12
|
// src/integrations/openai-compatible.ts
|
|
13
13
|
/**
|
|
14
14
|
* Builds a diagnostics-channel integration for an OpenAI-compatible provider SDK. It subscribes to the
|