@sentry/server-utils 11.0.0 → 11.2.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/README.md +7 -5
- package/build/THIRD-PARTY-LICENSES.txt +32 -32
- package/build/cjs/ai/anthropic-ai/index.js +10 -10
- package/build/cjs/ai/anthropic-ai/index.js.map +1 -1
- package/build/cjs/ai/core/apiPromise.js +54 -0
- package/build/cjs/ai/core/apiPromise.js.map +1 -0
- package/build/cjs/ai/google-genai/streaming.js +0 -8
- package/build/cjs/ai/google-genai/streaming.js.map +1 -1
- package/build/cjs/ai/typesafe/constants.js +10 -0
- package/build/cjs/ai/typesafe/constants.js.map +1 -0
- package/build/cjs/ai/typesafe/index.js +113 -0
- package/build/cjs/ai/typesafe/index.js.map +1 -0
- package/build/cjs/index.js +35 -18
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.no-diagnostic-channels.js +9 -2
- package/build/cjs/index.no-diagnostic-channels.js.map +1 -1
- package/build/cjs/integrations/amqplib.js +11 -24
- package/build/cjs/integrations/amqplib.js.map +1 -1
- package/build/cjs/integrations/anthropic.js +13 -16
- package/build/cjs/integrations/anthropic.js.map +1 -1
- package/build/cjs/integrations/aws-sdk/index.js +2 -15
- package/build/cjs/integrations/aws-sdk/index.js.map +1 -1
- package/build/cjs/integrations/dataloader.js +5 -18
- package/build/cjs/integrations/dataloader.js.map +1 -1
- package/build/cjs/integrations/express/index.js +2 -15
- package/build/cjs/integrations/express/index.js.map +1 -1
- package/build/cjs/integrations/express/instrumentation.js +12 -1
- package/build/cjs/integrations/express/instrumentation.js.map +1 -1
- package/build/cjs/integrations/fastify/errors.js +2 -15
- package/build/cjs/integrations/fastify/errors.js.map +1 -1
- package/build/cjs/integrations/fastify/instrumentation.js +2 -15
- package/build/cjs/integrations/fastify/instrumentation.js.map +1 -1
- package/build/cjs/integrations/firebase/instrumentation.js +3 -16
- package/build/cjs/integrations/firebase/instrumentation.js.map +1 -1
- package/build/cjs/integrations/generic-pool.js +2 -15
- package/build/cjs/integrations/generic-pool.js.map +1 -1
- package/build/cjs/integrations/google-genai.js +2 -15
- package/build/cjs/integrations/google-genai.js.map +1 -1
- package/build/cjs/integrations/graphql/index.js +6 -19
- package/build/cjs/integrations/graphql/index.js.map +1 -1
- package/build/cjs/integrations/hapi/index.js +5 -18
- package/build/cjs/integrations/hapi/index.js.map +1 -1
- package/build/cjs/integrations/hono/applyPatches.js +38 -0
- package/build/cjs/integrations/hono/applyPatches.js.map +1 -0
- package/build/cjs/integrations/hono/constants.js +6 -0
- package/build/cjs/integrations/hono/constants.js.map +1 -0
- package/build/cjs/integrations/hono/createHonoMiddleware.js +44 -0
- package/build/cjs/integrations/hono/createHonoMiddleware.js.map +1 -0
- package/build/cjs/integrations/hono/defaultShouldHandleError.js +12 -0
- package/build/cjs/integrations/hono/defaultShouldHandleError.js.map +1 -0
- package/build/cjs/integrations/hono/hono-context.js +14 -0
- package/build/cjs/integrations/hono/hono-context.js.map +1 -0
- package/build/cjs/integrations/hono/honoIntegration.js +126 -0
- package/build/cjs/integrations/hono/honoIntegration.js.map +1 -0
- package/build/cjs/integrations/hono/isMiddleware.js +14 -0
- package/build/cjs/integrations/hono/isMiddleware.js.map +1 -0
- package/build/cjs/integrations/hono/middlewareHandlers.js +79 -0
- package/build/cjs/integrations/hono/middlewareHandlers.js.map +1 -0
- package/build/cjs/integrations/hono/patchAppRequest.js +82 -0
- package/build/cjs/integrations/hono/patchAppRequest.js.map +1 -0
- package/build/cjs/integrations/hono/patchAppUse.js +70 -0
- package/build/cjs/integrations/hono/patchAppUse.js.map +1 -0
- package/build/cjs/integrations/hono/patchRoute.js +81 -0
- package/build/cjs/integrations/hono/patchRoute.js.map +1 -0
- package/build/cjs/integrations/hono/resolveRouteName.js +31 -0
- package/build/cjs/integrations/hono/resolveRouteName.js.map +1 -0
- package/build/cjs/integrations/hono/wrapMiddlewareSpan.js +52 -0
- package/build/cjs/integrations/hono/wrapMiddlewareSpan.js.map +1 -0
- package/build/cjs/integrations/index.js +7 -2
- package/build/cjs/integrations/index.js.map +1 -1
- package/build/cjs/integrations/kafkajs/index.js +3 -16
- package/build/cjs/integrations/kafkajs/index.js.map +1 -1
- package/build/cjs/integrations/knex.js +4 -17
- package/build/cjs/integrations/knex.js.map +1 -1
- package/build/cjs/integrations/koa/index.js +3 -16
- package/build/cjs/integrations/koa/index.js.map +1 -1
- package/build/cjs/integrations/langchain.js +3 -16
- package/build/cjs/integrations/langchain.js.map +1 -1
- package/build/cjs/integrations/langgraph.js +3 -16
- package/build/cjs/integrations/langgraph.js.map +1 -1
- package/build/cjs/integrations/lru-memoizer.js +2 -15
- package/build/cjs/integrations/lru-memoizer.js.map +1 -1
- package/build/cjs/integrations/mastra.js +4 -17
- package/build/cjs/integrations/mastra.js.map +1 -1
- package/build/cjs/integrations/mcp-server.js +37 -0
- package/build/cjs/integrations/mcp-server.js.map +1 -0
- package/build/cjs/integrations/mistral.js +2 -15
- package/build/cjs/integrations/mistral.js.map +1 -1
- package/build/cjs/integrations/mongodb/index.js +4 -17
- package/build/cjs/integrations/mongodb/index.js.map +1 -1
- package/build/cjs/integrations/mongoose/index.js +5 -18
- package/build/cjs/integrations/mongoose/index.js.map +1 -1
- package/build/cjs/integrations/mysql.js +2 -15
- package/build/cjs/integrations/mysql.js.map +1 -1
- package/build/cjs/integrations/mysql2/index.js +4 -17
- package/build/cjs/integrations/mysql2/index.js.map +1 -1
- package/build/cjs/integrations/openai-compatible.js +13 -17
- package/build/cjs/integrations/openai-compatible.js.map +1 -1
- package/build/cjs/integrations/openai.js +13 -17
- package/build/cjs/integrations/openai.js.map +1 -1
- package/build/cjs/integrations/postgres-js.js +5 -18
- package/build/cjs/integrations/postgres-js.js.map +1 -1
- package/build/cjs/integrations/postgres.js +2 -15
- package/build/cjs/integrations/postgres.js.map +1 -1
- package/build/cjs/integrations/prisma/index.js +9 -0
- package/build/cjs/integrations/prisma/index.js.map +1 -1
- package/build/cjs/integrations/prisma/orchestrion.js +140 -0
- package/build/cjs/integrations/prisma/orchestrion.js.map +1 -0
- package/build/cjs/integrations/prisma/tracing-helper.js +1 -0
- package/build/cjs/integrations/prisma/tracing-helper.js.map +1 -1
- package/build/cjs/integrations/redis/index.js +7 -20
- package/build/cjs/integrations/redis/index.js.map +1 -1
- package/build/cjs/integrations/redis/ioredis-channel-subscriber.js +3 -16
- package/build/cjs/integrations/redis/ioredis-channel-subscriber.js.map +1 -1
- package/build/cjs/integrations/tedious.js +3 -16
- package/build/cjs/integrations/tedious.js.map +1 -1
- package/build/cjs/integrations/typesafe.js +45 -0
- package/build/cjs/integrations/typesafe.js.map +1 -0
- package/build/cjs/integrations/vercel-ai/index.js +4 -17
- package/build/cjs/integrations/vercel-ai/index.js.map +1 -1
- package/build/cjs/integrations/vercel-ai/vercel-ai-dc-subscriber.js +33 -2
- package/build/cjs/integrations/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -1
- package/build/cjs/orchestrion/bundler/bun.js.map +1 -1
- package/build/cjs/orchestrion/bundler/moduleInjectedTransform.js +1 -1
- package/build/cjs/orchestrion/bundler/moduleInjectedTransform.js.map +1 -1
- package/build/cjs/orchestrion/bundler/rollup.js +23 -0
- package/build/cjs/orchestrion/bundler/rollup.js.map +1 -1
- package/build/cjs/orchestrion/channels.js +8 -0
- package/build/cjs/orchestrion/channels.js.map +1 -1
- package/build/cjs/orchestrion/config/amqplib.js +1 -1
- package/build/cjs/orchestrion/config/amqplib.js.map +1 -1
- package/build/cjs/orchestrion/config/anthropic-ai.js +3 -3
- package/build/cjs/orchestrion/config/anthropic-ai.js.map +1 -1
- package/build/cjs/orchestrion/config/channel-integration-definitions.js +4 -0
- package/build/cjs/orchestrion/config/channel-integration-definitions.js.map +1 -1
- package/build/cjs/orchestrion/config/hono.js +32 -0
- package/build/cjs/orchestrion/config/hono.js.map +1 -0
- package/build/cjs/orchestrion/config/index.js +11 -0
- package/build/cjs/orchestrion/config/index.js.map +1 -1
- package/build/cjs/orchestrion/config/mcp-server.js +41 -0
- package/build/cjs/orchestrion/config/mcp-server.js.map +1 -0
- package/build/cjs/orchestrion/config/openai-compatible.js +2 -2
- package/build/cjs/orchestrion/config/openai-compatible.js.map +1 -1
- package/build/cjs/orchestrion/config/openai.js +5 -7
- package/build/cjs/orchestrion/config/openai.js.map +1 -1
- package/build/cjs/orchestrion/config/prisma.js +53 -0
- package/build/cjs/orchestrion/config/prisma.js.map +1 -0
- package/build/cjs/orchestrion/config/remix-v3.js +23 -0
- package/build/cjs/orchestrion/config/remix-v3.js.map +1 -0
- package/build/cjs/orchestrion/config/tedious.js +1 -1
- package/build/cjs/orchestrion/config/tedious.js.map +1 -1
- package/build/cjs/orchestrion/config/typesafe.js +18 -0
- package/build/cjs/orchestrion/config/typesafe.js.map +1 -0
- package/build/cjs/orchestrion/instrumentation.js +2 -15
- package/build/cjs/orchestrion/instrumentation.js.map +1 -1
- package/build/cjs/utils/diagnosticsChannel.js +47 -0
- package/build/cjs/utils/diagnosticsChannel.js.map +1 -0
- package/build/cjs/utils/sql.js +12 -9
- package/build/cjs/utils/sql.js.map +1 -1
- package/build/esm/ai/anthropic-ai/index.js +4 -4
- package/build/esm/ai/anthropic-ai/utils.js +1 -1
- package/build/esm/ai/core/apiPromise.js +52 -0
- package/build/esm/ai/core/apiPromise.js.map +1 -0
- package/build/esm/ai/core/utils.js +1 -1
- package/build/esm/ai/google-genai/streaming.js +0 -8
- package/build/esm/ai/google-genai/streaming.js.map +1 -1
- package/build/esm/ai/typesafe/constants.js +6 -0
- package/build/esm/ai/typesafe/constants.js.map +1 -0
- package/build/esm/ai/typesafe/index.js +108 -0
- package/build/esm/ai/typesafe/index.js.map +1 -0
- package/build/esm/index.js +7 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/index.no-diagnostic-channels.js +3 -0
- package/build/esm/index.no-diagnostic-channels.js.map +1 -1
- package/build/esm/integrations/amqplib.js +13 -13
- package/build/esm/integrations/amqplib.js.map +1 -1
- package/build/esm/integrations/anthropic.js +13 -3
- package/build/esm/integrations/anthropic.js.map +1 -1
- package/build/esm/integrations/aws-sdk/index.js +2 -2
- package/build/esm/integrations/aws-sdk/index.js.map +1 -1
- package/build/esm/integrations/dataloader.js +5 -5
- package/build/esm/integrations/dataloader.js.map +1 -1
- package/build/esm/integrations/express/index.js +2 -2
- package/build/esm/integrations/express/index.js.map +1 -1
- package/build/esm/integrations/express/instrumentation.js +12 -1
- package/build/esm/integrations/express/instrumentation.js.map +1 -1
- package/build/esm/integrations/fastify/errors.js +2 -2
- package/build/esm/integrations/fastify/errors.js.map +1 -1
- package/build/esm/integrations/fastify/instrumentation.js +2 -2
- package/build/esm/integrations/fastify/instrumentation.js.map +1 -1
- package/build/esm/integrations/firebase/instrumentation.js +3 -3
- package/build/esm/integrations/firebase/instrumentation.js.map +1 -1
- package/build/esm/integrations/generic-pool.js +2 -2
- package/build/esm/integrations/generic-pool.js.map +1 -1
- package/build/esm/integrations/google-genai.js +2 -2
- package/build/esm/integrations/google-genai.js.map +1 -1
- package/build/esm/integrations/graphql/index.js +6 -6
- package/build/esm/integrations/graphql/index.js.map +1 -1
- package/build/esm/integrations/hapi/index.js +5 -5
- package/build/esm/integrations/hapi/index.js.map +1 -1
- package/build/esm/integrations/hono/applyPatches.js +34 -0
- package/build/esm/integrations/hono/applyPatches.js.map +1 -0
- package/build/esm/integrations/hono/constants.js +4 -0
- package/build/esm/integrations/hono/constants.js.map +1 -0
- package/build/esm/integrations/hono/createHonoMiddleware.js +41 -0
- package/build/esm/integrations/hono/createHonoMiddleware.js.map +1 -0
- package/build/esm/integrations/hono/defaultShouldHandleError.js +10 -0
- package/build/esm/integrations/hono/defaultShouldHandleError.js.map +1 -0
- package/build/esm/integrations/hono/hono-context.js +12 -0
- package/build/esm/integrations/hono/hono-context.js.map +1 -0
- package/build/esm/integrations/hono/honoIntegration.js +123 -0
- package/build/esm/integrations/hono/honoIntegration.js.map +1 -0
- package/build/esm/integrations/hono/isMiddleware.js +12 -0
- package/build/esm/integrations/hono/isMiddleware.js.map +1 -0
- package/build/esm/integrations/hono/middlewareHandlers.js +75 -0
- package/build/esm/integrations/hono/middlewareHandlers.js.map +1 -0
- package/build/esm/integrations/hono/patchAppRequest.js +78 -0
- package/build/esm/integrations/hono/patchAppRequest.js.map +1 -0
- package/build/esm/integrations/hono/patchAppUse.js +67 -0
- package/build/esm/integrations/hono/patchAppUse.js.map +1 -0
- package/build/esm/integrations/hono/patchRoute.js +78 -0
- package/build/esm/integrations/hono/patchRoute.js.map +1 -0
- package/build/esm/integrations/hono/resolveRouteName.js +29 -0
- package/build/esm/integrations/hono/resolveRouteName.js.map +1 -0
- package/build/esm/integrations/hono/wrapMiddlewareSpan.js +50 -0
- package/build/esm/integrations/hono/wrapMiddlewareSpan.js.map +1 -0
- package/build/esm/integrations/index.js +7 -2
- package/build/esm/integrations/index.js.map +1 -1
- package/build/esm/integrations/kafkajs/index.js +3 -3
- package/build/esm/integrations/kafkajs/index.js.map +1 -1
- package/build/esm/integrations/knex.js +4 -4
- package/build/esm/integrations/knex.js.map +1 -1
- package/build/esm/integrations/koa/index.js +3 -3
- package/build/esm/integrations/koa/index.js.map +1 -1
- package/build/esm/integrations/langchain.js +3 -3
- package/build/esm/integrations/langchain.js.map +1 -1
- package/build/esm/integrations/langgraph.js +3 -3
- package/build/esm/integrations/langgraph.js.map +1 -1
- package/build/esm/integrations/lru-memoizer.js +2 -2
- package/build/esm/integrations/lru-memoizer.js.map +1 -1
- package/build/esm/integrations/mastra.js +4 -4
- package/build/esm/integrations/mastra.js.map +1 -1
- package/build/esm/integrations/mcp-server.js +35 -0
- package/build/esm/integrations/mcp-server.js.map +1 -0
- package/build/esm/integrations/mistral.js +2 -2
- package/build/esm/integrations/mistral.js.map +1 -1
- package/build/esm/integrations/mongodb/index.js +4 -4
- package/build/esm/integrations/mongodb/index.js.map +1 -1
- package/build/esm/integrations/mongoose/index.js +5 -5
- package/build/esm/integrations/mongoose/index.js.map +1 -1
- package/build/esm/integrations/mysql.js +2 -2
- package/build/esm/integrations/mysql.js.map +1 -1
- package/build/esm/integrations/mysql2/index.js +4 -4
- package/build/esm/integrations/mysql2/index.js.map +1 -1
- package/build/esm/integrations/openai-compatible.js +13 -4
- package/build/esm/integrations/openai-compatible.js.map +1 -1
- package/build/esm/integrations/openai.js +13 -4
- package/build/esm/integrations/openai.js.map +1 -1
- package/build/esm/integrations/postgres-js.js +5 -5
- package/build/esm/integrations/postgres-js.js.map +1 -1
- package/build/esm/integrations/postgres.js +2 -2
- package/build/esm/integrations/postgres.js.map +1 -1
- package/build/esm/integrations/prisma/index.js +9 -0
- package/build/esm/integrations/prisma/index.js.map +1 -1
- package/build/esm/integrations/prisma/orchestrion.js +138 -0
- package/build/esm/integrations/prisma/orchestrion.js.map +1 -0
- package/build/esm/integrations/prisma/tracing-helper.js +1 -1
- package/build/esm/integrations/prisma/tracing-helper.js.map +1 -1
- package/build/esm/integrations/redis/index.js +7 -7
- package/build/esm/integrations/redis/index.js.map +1 -1
- package/build/esm/integrations/redis/ioredis-channel-subscriber.js +3 -3
- package/build/esm/integrations/redis/ioredis-channel-subscriber.js.map +1 -1
- package/build/esm/integrations/tedious.js +3 -3
- package/build/esm/integrations/tedious.js.map +1 -1
- package/build/esm/integrations/typesafe.js +43 -0
- package/build/esm/integrations/typesafe.js.map +1 -0
- package/build/esm/integrations/vercel-ai/index.js +4 -4
- package/build/esm/integrations/vercel-ai/index.js.map +1 -1
- package/build/esm/integrations/vercel-ai/vercel-ai-dc-subscriber.js +34 -3
- package/build/esm/integrations/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -1
- package/build/esm/orchestrion/bundler/bun.js.map +1 -1
- package/build/esm/orchestrion/bundler/moduleInjectedTransform.js +1 -1
- package/build/esm/orchestrion/bundler/moduleInjectedTransform.js.map +1 -1
- package/build/esm/orchestrion/bundler/rollup.js +22 -1
- package/build/esm/orchestrion/bundler/rollup.js.map +1 -1
- package/build/esm/orchestrion/channels.js +8 -0
- package/build/esm/orchestrion/channels.js.map +1 -1
- package/build/esm/orchestrion/config/amqplib.js +1 -1
- package/build/esm/orchestrion/config/amqplib.js.map +1 -1
- package/build/esm/orchestrion/config/anthropic-ai.js +3 -3
- package/build/esm/orchestrion/config/anthropic-ai.js.map +1 -1
- package/build/esm/orchestrion/config/channel-integration-definitions.js +4 -0
- package/build/esm/orchestrion/config/channel-integration-definitions.js.map +1 -1
- package/build/esm/orchestrion/config/hono.js +28 -0
- package/build/esm/orchestrion/config/hono.js.map +1 -0
- package/build/esm/orchestrion/config/index.js +11 -0
- package/build/esm/orchestrion/config/index.js.map +1 -1
- package/build/esm/orchestrion/config/mcp-server.js +37 -0
- package/build/esm/orchestrion/config/mcp-server.js.map +1 -0
- package/build/esm/orchestrion/config/openai-compatible.js +2 -2
- package/build/esm/orchestrion/config/openai-compatible.js.map +1 -1
- package/build/esm/orchestrion/config/openai.js +5 -7
- package/build/esm/orchestrion/config/openai.js.map +1 -1
- package/build/esm/orchestrion/config/prisma.js +47 -0
- package/build/esm/orchestrion/config/prisma.js.map +1 -0
- package/build/esm/orchestrion/config/remix-v3.js +20 -0
- package/build/esm/orchestrion/config/remix-v3.js.map +1 -0
- package/build/esm/orchestrion/config/tedious.js +1 -1
- package/build/esm/orchestrion/config/tedious.js.map +1 -1
- package/build/esm/orchestrion/config/typesafe.js +14 -0
- package/build/esm/orchestrion/config/typesafe.js.map +1 -0
- package/build/esm/orchestrion/instrumentation.js +2 -2
- package/build/esm/orchestrion/instrumentation.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/utils/diagnosticsChannel.js +30 -0
- package/build/esm/utils/diagnosticsChannel.js.map +1 -0
- package/build/esm/utils/sql.js +12 -9
- package/build/esm/utils/sql.js.map +1 -1
- package/build/types/ai/core/apiPromise.d.ts +2 -0
- package/build/types/ai/core/apiPromise.d.ts.map +1 -0
- package/build/types/ai/google-genai/streaming.d.ts.map +1 -1
- package/build/types/ai/index.d.ts +1 -0
- package/build/types/ai/index.d.ts.map +1 -1
- package/build/types/ai/typesafe/constants.d.ts +4 -0
- package/build/types/ai/typesafe/constants.d.ts.map +1 -0
- package/build/types/ai/typesafe/index.d.ts +21 -0
- package/build/types/ai/typesafe/index.d.ts.map +1 -0
- package/build/types/exports.d.ts +4 -0
- package/build/types/exports.d.ts.map +1 -1
- package/build/types/index.d.ts +5 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/integrations/anthropic.d.ts.map +1 -1
- package/build/types/integrations/express/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/hono/applyPatches.d.ts +28 -0
- package/build/types/integrations/hono/applyPatches.d.ts.map +1 -0
- package/build/types/integrations/hono/constants.d.ts +2 -0
- package/build/types/integrations/hono/constants.d.ts.map +1 -0
- package/build/types/integrations/hono/createHonoMiddleware.d.ts +33 -0
- package/build/types/integrations/hono/createHonoMiddleware.d.ts.map +1 -0
- package/build/types/integrations/hono/defaultShouldHandleError.d.ts +12 -0
- package/build/types/integrations/hono/defaultShouldHandleError.d.ts.map +1 -0
- package/build/types/integrations/hono/hono-context.d.ts +6 -0
- package/build/types/integrations/hono/hono-context.d.ts.map +1 -0
- package/build/types/integrations/hono/honoIntegration.d.ts +29 -0
- package/build/types/integrations/hono/honoIntegration.d.ts.map +1 -0
- package/build/types/integrations/hono/honoTypes.d.ts +57 -0
- package/build/types/integrations/hono/honoTypes.d.ts.map +1 -0
- package/build/types/integrations/hono/index.d.ts +8 -0
- package/build/types/integrations/hono/index.d.ts.map +1 -0
- package/build/types/integrations/hono/isMiddleware.d.ts +13 -0
- package/build/types/integrations/hono/isMiddleware.d.ts.map +1 -0
- package/build/types/integrations/hono/middlewareHandlers.d.ts +20 -0
- package/build/types/integrations/hono/middlewareHandlers.d.ts.map +1 -0
- package/build/types/integrations/hono/patchAppRequest.d.ts +26 -0
- package/build/types/integrations/hono/patchAppRequest.d.ts.map +1 -0
- package/build/types/integrations/hono/patchAppUse.d.ts +16 -0
- package/build/types/integrations/hono/patchAppUse.d.ts.map +1 -0
- package/build/types/integrations/hono/patchRoute.d.ts +35 -0
- package/build/types/integrations/hono/patchRoute.d.ts.map +1 -0
- package/build/types/integrations/hono/resolveRouteName.d.ts +10 -0
- package/build/types/integrations/hono/resolveRouteName.d.ts.map +1 -0
- package/build/types/integrations/hono/types.d.ts +25 -0
- package/build/types/integrations/hono/types.d.ts.map +1 -0
- package/build/types/integrations/hono/wrapMiddlewareSpan.d.ts +9 -0
- package/build/types/integrations/hono/wrapMiddlewareSpan.d.ts.map +1 -0
- package/build/types/integrations/index.d.ts.map +1 -1
- package/build/types/integrations/mcp-server.d.ts +10 -0
- package/build/types/integrations/mcp-server.d.ts.map +1 -0
- package/build/types/integrations/openai-compatible.d.ts.map +1 -1
- package/build/types/integrations/openai.d.ts.map +1 -1
- package/build/types/integrations/prisma/index.d.ts +3 -1
- package/build/types/integrations/prisma/index.d.ts.map +1 -1
- package/build/types/integrations/prisma/orchestrion.d.ts +10 -0
- package/build/types/integrations/prisma/orchestrion.d.ts.map +1 -0
- package/build/types/integrations/prisma/tracing-helper.d.ts +2 -0
- package/build/types/integrations/prisma/tracing-helper.d.ts.map +1 -1
- package/build/types/integrations/typesafe.d.ts +10 -0
- package/build/types/integrations/typesafe.d.ts.map +1 -0
- package/build/types/integrations/vercel-ai/vercel-ai-dc-subscriber.d.ts +1 -1
- package/build/types/integrations/vercel-ai/vercel-ai-dc-subscriber.d.ts.map +1 -1
- package/build/types/orchestrion/bundler/bun.d.ts.map +1 -1
- package/build/types/orchestrion/bundler/moduleInjectedTransform.d.ts.map +1 -1
- package/build/types/orchestrion/bundler/rollup.d.ts +21 -0
- package/build/types/orchestrion/bundler/rollup.d.ts.map +1 -1
- package/build/types/orchestrion/channels.d.ts +18 -0
- package/build/types/orchestrion/channels.d.ts.map +1 -1
- package/build/types/orchestrion/config/amqplib.d.ts +4 -4
- package/build/types/orchestrion/config/anthropic-ai.d.ts +2 -14
- package/build/types/orchestrion/config/anthropic-ai.d.ts.map +1 -1
- package/build/types/orchestrion/config/channel-integration-definitions.d.ts +12 -0
- package/build/types/orchestrion/config/channel-integration-definitions.d.ts.map +1 -1
- package/build/types/orchestrion/config/hono.d.ts +8 -0
- package/build/types/orchestrion/config/hono.d.ts.map +1 -0
- package/build/types/orchestrion/config/index.d.ts +1 -0
- package/build/types/orchestrion/config/index.d.ts.map +1 -1
- package/build/types/orchestrion/config/mcp-server.d.ts +8 -0
- package/build/types/orchestrion/config/mcp-server.d.ts.map +1 -0
- package/build/types/orchestrion/config/openai-compatible.d.ts +2 -2
- package/build/types/orchestrion/config/openai.d.ts +1 -1
- package/build/types/orchestrion/config/openai.d.ts.map +1 -1
- package/build/types/orchestrion/config/pg.d.ts +1 -1
- package/build/types/orchestrion/config/prisma.d.ts +21 -0
- package/build/types/orchestrion/config/prisma.d.ts.map +1 -0
- package/build/types/orchestrion/config/remix-v3.d.ts +6 -0
- package/build/types/orchestrion/config/remix-v3.d.ts.map +1 -0
- package/build/types/orchestrion/config/typesafe.d.ts +18 -0
- package/build/types/orchestrion/config/typesafe.d.ts.map +1 -0
- package/build/types/utils/diagnosticsChannel.d.ts +12 -0
- package/build/types/utils/diagnosticsChannel.d.ts.map +1 -0
- package/build/types/utils/sql.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { getClient, hasSpanStreamingEnabled, startSpan, startSpanManual,
|
|
2
|
-
import {
|
|
1
|
+
import { SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, getClient, hasSpanStreamingEnabled, startSpan, startSpanManual, SPAN_STATUS_ERROR } from '@sentry/core';
|
|
2
|
+
import { GEN_AI_RESPONSE_TEXT, GEN_AI_RESPONSE_TOOL_CALLS, GEN_AI_RESPONSE_MODEL, GEN_AI_RESPONSE_ID, GEN_AI_TOOL_DEFINITIONS, GEN_AI_REQUEST_MODEL, GEN_AI_REQUEST_TEMPERATURE, GEN_AI_REQUEST_TOP_P, GEN_AI_REQUEST_TOP_K, GEN_AI_REQUEST_FREQUENCY_PENALTY, GEN_AI_REQUEST_MAX_TOKENS, GEN_AI_OPERATION_NAME, GEN_AI_PROVIDER_NAME } from '@sentry/conventions/attributes';
|
|
3
3
|
import { GEN_AI_REQUEST_STREAM_ATTRIBUTE } from '../core/gen-ai-attributes.js';
|
|
4
|
-
import { resolveAIRecordingOptions, getGenAiSpanOp, wrapPromiseWithMethods
|
|
4
|
+
import { setTokenUsageAttributes, resolveAIRecordingOptions, getGenAiSpanOp, wrapPromiseWithMethods } from '../core/utils.js';
|
|
5
5
|
import { ANTHROPIC_METHOD_REGISTRY } from './constants.js';
|
|
6
6
|
import { instrumentAsyncIterableStream, instrumentMessageStream } from './streaming.js';
|
|
7
|
-
import { messagesFromParams, setMessagesAttribute
|
|
7
|
+
import { handleResponseError, messagesFromParams, setMessagesAttribute } from './utils.js';
|
|
8
8
|
|
|
9
9
|
let suppressDelegatedCreate = false;
|
|
10
10
|
const INSTRUMENTED_METHODS = /* @__PURE__ */ new WeakSet();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SPAN_STATUS_ERROR, captureException, stringify } from '@sentry/core';
|
|
2
2
|
import { GEN_AI_SYSTEM_INSTRUCTIONS, GEN_AI_INPUT_MESSAGES } from '@sentry/conventions/attributes';
|
|
3
3
|
import { extractSystemInstructions } from '../core/utils.js';
|
|
4
4
|
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { isObjectLike } from '@sentry/core';
|
|
2
|
+
|
|
3
|
+
function isApiPromise(value) {
|
|
4
|
+
return isObjectLike(value) && typeof value.parseResponse === "function" && typeof value.asResponse === "function";
|
|
5
|
+
}
|
|
6
|
+
function onApiPromiseResponse(result, onResponse, onError) {
|
|
7
|
+
if (!isApiPromise(result)) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
let parsing = false;
|
|
11
|
+
result.parseResponse = new Proxy(result.parseResponse, {
|
|
12
|
+
async apply(original, thisArg, args) {
|
|
13
|
+
parsing = true;
|
|
14
|
+
try {
|
|
15
|
+
const response = await Reflect.apply(original, thisArg, args);
|
|
16
|
+
onResponse(response);
|
|
17
|
+
return response;
|
|
18
|
+
} catch (error) {
|
|
19
|
+
onError(error);
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
void result.asResponse().then(void 0, onError);
|
|
25
|
+
function wrapRawResponse(apiPromise) {
|
|
26
|
+
apiPromise.asResponse = new Proxy(apiPromise.asResponse, {
|
|
27
|
+
apply(original, thisArg, args) {
|
|
28
|
+
return Reflect.apply(original, thisArg, args).then((response) => {
|
|
29
|
+
if (!parsing) {
|
|
30
|
+
onResponse(void 0);
|
|
31
|
+
}
|
|
32
|
+
return response;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const thenUnwrap = apiPromise._thenUnwrap;
|
|
37
|
+
if (thenUnwrap) {
|
|
38
|
+
apiPromise._thenUnwrap = new Proxy(thenUnwrap, {
|
|
39
|
+
apply(original, thisArg, args) {
|
|
40
|
+
const derivedPromise = Reflect.apply(original, thisArg, args);
|
|
41
|
+
wrapRawResponse(derivedPromise);
|
|
42
|
+
return derivedPromise;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
wrapRawResponse(result);
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { onApiPromiseResponse };
|
|
52
|
+
//# sourceMappingURL=apiPromise.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiPromise.js","sources":["../../../../src/ai/core/apiPromise.ts"],"sourcesContent":["import { isObjectLike } from '@sentry/core';\n\ninterface ApiPromise {\n parseResponse: (...args: unknown[]) => unknown;\n asResponse: () => Promise<Response>;\n _thenUnwrap?: (...args: unknown[]) => ApiPromise;\n}\n\nfunction isApiPromise(value: unknown): value is ApiPromise {\n return isObjectLike(value) && typeof value.parseResponse === 'function' && typeof value.asResponse === 'function';\n}\n\n// OpenAI and Anthropic return an APIPromise that extends the native promise objects and redefines .then() in a way that internally triggers body parsing.\n// This can lead to double parsing if our instrumentation triggers .then on this promise.\n// Instead, we need to avoid triggering .then on the APIPromise and instead observe the internal parsing process to get the response body.\n// APIPromise implementation: https://github.com/openai/openai-node/blob/main/src/core/api-promise.ts\nexport function onApiPromiseResponse(\n result: unknown,\n onResponse: (response: unknown) => void,\n onError: (error: unknown) => void,\n): boolean {\n // e.g. Anthropic's messages.stream() returns an emitter instead of an APIPromise\n if (!isApiPromise(result)) {\n return false;\n }\n\n let parsing = false;\n\n // observe internal parsing method on the APIPromise to read the response body\n result.parseResponse = new Proxy(result.parseResponse, {\n async apply(original, thisArg, args): Promise<unknown> {\n parsing = true;\n try {\n const response = await Reflect.apply(original, thisArg, args);\n onResponse(response);\n return response;\n } catch (error) {\n onError(error);\n throw error;\n }\n },\n });\n\n // end the span in case of request failures before the internal parsing process is triggered\n void result.asResponse().then(undefined, onError);\n\n // asResponse() calls .then() on the native response promise, not on APIPromise so parseResponse never runs\n // therefore we need to handle this path separately\n function wrapRawResponse(apiPromise: ApiPromise): void {\n apiPromise.asResponse = new Proxy(apiPromise.asResponse, {\n apply(original, thisArg, args): Promise<Response> {\n return (Reflect.apply(original, thisArg, args) as Promise<Response>).then(response => {\n if (!parsing) {\n onResponse(undefined);\n }\n return response;\n });\n },\n });\n\n // thenUnwrap internally creates a new APIPromise\n // asResponse() on the derived promise would still be uninstrumented, so we need to recursively wrap the derived promises\n // thenUnwrap is for instance internally used by chat.completions.parse() / responses.parse()\n // so this would cover for instance responses.parse().asResponse() calls\n const thenUnwrap = apiPromise._thenUnwrap;\n if (thenUnwrap) {\n // parse(...).asResponse()\n apiPromise._thenUnwrap = new Proxy(thenUnwrap, {\n apply(original, thisArg, args): ApiPromise {\n const derivedPromise = Reflect.apply(original, thisArg, args);\n wrapRawResponse(derivedPromise);\n return derivedPromise;\n },\n });\n }\n }\n\n wrapRawResponse(result);\n\n return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AI_RESPONSE_TEXT, GEN_AI_RESPONSE_TOOL_CALLS } from '@sentry/conventions/attributes';
|
|
3
3
|
import { FUNCTION } from '@sentry/conventions/op';
|
|
4
4
|
|
|
5
5
|
const NON_INFERENCE_OPERATIONS = /* @__PURE__ */ new Set(["unknown"]);
|
|
@@ -37,14 +37,6 @@ function handleCandidateContent(chunk, state, recordOutputs) {
|
|
|
37
37
|
}
|
|
38
38
|
for (const part of candidate?.content?.parts ?? []) {
|
|
39
39
|
if (recordOutputs && part.text) state.responseTexts.push(part.text);
|
|
40
|
-
if (part.functionCall) {
|
|
41
|
-
state.toolCalls.push({
|
|
42
|
-
type: "function",
|
|
43
|
-
id: part.functionCall.id,
|
|
44
|
-
name: part.functionCall.name,
|
|
45
|
-
arguments: part.functionCall.args
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
40
|
}
|
|
49
41
|
}
|
|
50
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streaming.js","sources":["../../../../src/ai/google-genai/streaming.ts"],"sourcesContent":["import { captureException, SPAN_STATUS_ERROR } from '@sentry/core';\nimport type { Span } from '@sentry/core';\nimport { endStreamSpan } from '../core/utils';\nimport type { GoogleGenAIResponse } from './types';\nimport type { MessagePart } from './utils';\nimport { candidatesToMessageParts, setOutputMessagesAttribute } from './utils';\n\n/**\n * State object used to accumulate information from a stream of Google GenAI events.\n */\ninterface StreamingState {\n /** Collected response text fragments (for output recording). */\n responseTexts: string[];\n /** Reasons for finishing the response, as reported by the API. */\n finishReasons: string[];\n /** The response ID. */\n responseId?: string;\n /** The model name. */\n responseModel?: string;\n /** Number of prompt/input tokens used. */\n promptTokens?: number;\n /** Number of completion/output tokens used. */\n completionTokens?: number;\n /** Number of total tokens used. */\n totalTokens?: number;\n /** Accumulated tool calls (finalized) */\n toolCalls: Array<Record<string, unknown>>;\n /** Accumulated output message parts (for output recording). */\n outputParts: MessagePart[];\n}\n\n/**\n * Checks if a response chunk contains an error\n * @param chunk - The response chunk to check\n * @param span - The span to update if error is found\n * @returns Whether an error occurred\n */\nfunction isErrorChunk(chunk: GoogleGenAIResponse, span: Span): boolean {\n const feedback = chunk?.promptFeedback;\n if (feedback?.blockReason) {\n const message = feedback.blockReasonMessage ?? feedback.blockReason;\n span.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' });\n captureException(`Content blocked: ${message}`, {\n mechanism: { handled: false, type: 'auto.ai.google_genai' },\n });\n return true;\n }\n return false;\n}\n\n/**\n * Processes response metadata from a chunk\n * @param chunk - The response chunk to process\n * @param state - The state of the streaming process\n */\nfunction handleResponseMetadata(chunk: GoogleGenAIResponse, state: StreamingState): void {\n if (typeof chunk.responseId === 'string') state.responseId = chunk.responseId;\n if (typeof chunk.modelVersion === 'string') state.responseModel = chunk.modelVersion;\n\n const usage = chunk.usageMetadata;\n if (usage) {\n if (typeof usage.promptTokenCount === 'number') state.promptTokens = usage.promptTokenCount;\n if (typeof usage.candidatesTokenCount === 'number') state.completionTokens = usage.candidatesTokenCount;\n if (typeof usage.totalTokenCount === 'number') state.totalTokens = usage.totalTokenCount;\n }\n}\n\n/**\n * Processes candidate content from a response chunk\n * @param chunk - The response chunk to process\n * @param state - The state of the streaming process\n * @param recordOutputs - Whether to record outputs\n */\nfunction handleCandidateContent(chunk: GoogleGenAIResponse, state: StreamingState, recordOutputs: boolean): void {\n if (Array.isArray(chunk.functionCalls)) {\n state.toolCalls.push(...chunk.functionCalls);\n }\n\n if (recordOutputs) {\n state.outputParts.push(...candidatesToMessageParts(chunk.candidates));\n }\n\n for (const candidate of chunk.candidates ?? []) {\n if (candidate?.finishReason && !state.finishReasons.includes(candidate.finishReason)) {\n state.finishReasons.push(candidate.finishReason);\n }\n\n for (const part of candidate?.content?.parts ?? []) {\n if (recordOutputs && part.text) state.responseTexts.push(part.text);\n if (part.functionCall) {\n state.toolCalls.push({\n type: 'function',\n id: part.functionCall.id,\n name: part.functionCall.name,\n arguments: part.functionCall.args,\n });\n }\n }\n }\n}\n\n/**\n * Processes a single chunk from the Google GenAI stream\n * @param chunk - The chunk to process\n * @param state - The state of the streaming process\n * @param recordOutputs - Whether to record outputs\n * @param span - The span to update\n */\nfunction processChunk(chunk: GoogleGenAIResponse, state: StreamingState, recordOutputs: boolean, span: Span): void {\n if (!chunk || isErrorChunk(chunk, span)) return;\n handleResponseMetadata(chunk, state);\n handleCandidateContent(chunk, state, recordOutputs);\n}\n\n/**\n * Instruments an async iterable stream of Google GenAI response chunks, updates the span with\n * streaming attributes and (optionally) the aggregated output text, and yields\n * each chunk from the input stream unchanged.\n */\nexport async function* instrumentStream(\n stream: AsyncIterable<GoogleGenAIResponse>,\n span: Span,\n recordOutputs: boolean,\n): AsyncGenerator<GoogleGenAIResponse, void, unknown> {\n const state: StreamingState = {\n responseTexts: [],\n finishReasons: [],\n toolCalls: [],\n outputParts: [],\n };\n\n try {\n for await (const chunk of stream) {\n processChunk(chunk, state, recordOutputs, span);\n yield chunk;\n }\n } finally {\n if (recordOutputs) {\n setOutputMessagesAttribute(span, state.outputParts);\n }\n endStreamSpan(span, state, recordOutputs);\n }\n}\n"],"names":[],"mappings":";;;;AAqCA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAA,CAAA,CAAA,CAAA,GAA4B,IAAA,CAAA,CAAqB;AACrE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,IAAW,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACxB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAU,CAAA,CAAA,CAAA,CAAA,CAA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AAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAE;AACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,aAAA,CAAA,CAAe;AACjB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,0BAAA,CAA2B,CAAA,CAAA,CAAA,CAAA,EAAM,CAAA,CAAA,CAAA,CAAA,EAAM,WAAW,CAAA;AAAA,CAAA,CAAA,CAAA,CACpD;AACA,CAAA,CAAA,CAAA,CAAA,aAAA,CAAc,CAAA,CAAA,CAAA,CAAA,EAAM,CAAA,CAAA,CAAA,CAAA,GAAO,aAAa,CAAA;AAAA,CAAA,CAC1C;AACF;;"}
|
|
1
|
+
{"version":3,"file":"streaming.js","sources":["../../../../src/ai/google-genai/streaming.ts"],"sourcesContent":["import { captureException, SPAN_STATUS_ERROR } from '@sentry/core';\nimport type { Span } from '@sentry/core';\nimport { endStreamSpan } from '../core/utils';\nimport type { GoogleGenAIResponse } from './types';\nimport type { MessagePart } from './utils';\nimport { candidatesToMessageParts, setOutputMessagesAttribute } from './utils';\n\n/**\n * State object used to accumulate information from a stream of Google GenAI events.\n */\ninterface StreamingState {\n /** Collected response text fragments (for output recording). */\n responseTexts: string[];\n /** Reasons for finishing the response, as reported by the API. */\n finishReasons: string[];\n /** The response ID. */\n responseId?: string;\n /** The model name. */\n responseModel?: string;\n /** Number of prompt/input tokens used. */\n promptTokens?: number;\n /** Number of completion/output tokens used. */\n completionTokens?: number;\n /** Number of total tokens used. */\n totalTokens?: number;\n /** Accumulated tool calls (finalized) */\n toolCalls: Array<Record<string, unknown>>;\n /** Accumulated output message parts (for output recording). */\n outputParts: MessagePart[];\n}\n\n/**\n * Checks if a response chunk contains an error\n * @param chunk - The response chunk to check\n * @param span - The span to update if error is found\n * @returns Whether an error occurred\n */\nfunction isErrorChunk(chunk: GoogleGenAIResponse, span: Span): boolean {\n const feedback = chunk?.promptFeedback;\n if (feedback?.blockReason) {\n const message = feedback.blockReasonMessage ?? feedback.blockReason;\n span.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' });\n captureException(`Content blocked: ${message}`, {\n mechanism: { handled: false, type: 'auto.ai.google_genai' },\n });\n return true;\n }\n return false;\n}\n\n/**\n * Processes response metadata from a chunk\n * @param chunk - The response chunk to process\n * @param state - The state of the streaming process\n */\nfunction handleResponseMetadata(chunk: GoogleGenAIResponse, state: StreamingState): void {\n if (typeof chunk.responseId === 'string') state.responseId = chunk.responseId;\n if (typeof chunk.modelVersion === 'string') state.responseModel = chunk.modelVersion;\n\n const usage = chunk.usageMetadata;\n if (usage) {\n if (typeof usage.promptTokenCount === 'number') state.promptTokens = usage.promptTokenCount;\n if (typeof usage.candidatesTokenCount === 'number') state.completionTokens = usage.candidatesTokenCount;\n if (typeof usage.totalTokenCount === 'number') state.totalTokens = usage.totalTokenCount;\n }\n}\n\n/**\n * Processes candidate content from a response chunk\n * @param chunk - The response chunk to process\n * @param state - The state of the streaming process\n * @param recordOutputs - Whether to record outputs\n */\nfunction handleCandidateContent(chunk: GoogleGenAIResponse, state: StreamingState, recordOutputs: boolean): void {\n // The SDK getter already extracts function calls from candidate parts.\n if (Array.isArray(chunk.functionCalls)) {\n state.toolCalls.push(...chunk.functionCalls);\n }\n\n if (recordOutputs) {\n state.outputParts.push(...candidatesToMessageParts(chunk.candidates));\n }\n\n for (const candidate of chunk.candidates ?? []) {\n if (candidate?.finishReason && !state.finishReasons.includes(candidate.finishReason)) {\n state.finishReasons.push(candidate.finishReason);\n }\n\n for (const part of candidate?.content?.parts ?? []) {\n if (recordOutputs && part.text) state.responseTexts.push(part.text);\n }\n }\n}\n\n/**\n * Processes a single chunk from the Google GenAI stream\n * @param chunk - The chunk to process\n * @param state - The state of the streaming process\n * @param recordOutputs - Whether to record outputs\n * @param span - The span to update\n */\nfunction processChunk(chunk: GoogleGenAIResponse, state: StreamingState, recordOutputs: boolean, span: Span): void {\n if (!chunk || isErrorChunk(chunk, span)) return;\n handleResponseMetadata(chunk, state);\n handleCandidateContent(chunk, state, recordOutputs);\n}\n\n/**\n * Instruments an async iterable stream of Google GenAI response chunks, updates the span with\n * streaming attributes and (optionally) the aggregated output text, and yields\n * each chunk from the input stream unchanged.\n */\nexport async function* instrumentStream(\n stream: AsyncIterable<GoogleGenAIResponse>,\n span: Span,\n recordOutputs: boolean,\n): AsyncGenerator<GoogleGenAIResponse, void, unknown> {\n const state: StreamingState = {\n responseTexts: [],\n finishReasons: [],\n toolCalls: [],\n outputParts: [],\n };\n\n try {\n for await (const chunk of stream) {\n processChunk(chunk, state, recordOutputs, span);\n yield chunk;\n }\n } finally {\n if (recordOutputs) {\n setOutputMessagesAttribute(span, state.outputParts);\n }\n endStreamSpan(span, state, recordOutputs);\n }\n}\n"],"names":[],"mappings":";;;;AAqCA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAA,CAAA,CAAA,CAAA,GAA4B,IAAA,CAAA,CAAqB;AACrE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,IAAW,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACxB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa;AACzB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,OAAA,CAAA,CAAA,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAA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,CAAA,CAAA,CAAA,CAAA,EAAM,CAAA,CAAA,CAAA,CAAA,EAAM,WAAW,CAAA;AAAA,CAAA,CAAA,CAAA,CACpD;AACA,CAAA,CAAA,CAAA,CAAA,aAAA,CAAc,CAAA,CAAA,CAAA,CAAA,EAAM,CAAA,CAAA,CAAA,CAAA,GAAO,aAAa,CAAA;AAAA,CAAA,CAC1C;AACF;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../src/ai/typesafe/constants.ts"],"sourcesContent":["export const TYPESAFE_INTEGRATION_NAME = 'TypeSafe' as const;\n\nexport const TYPESAFE_PROVIDER_NAME = 'typesafe' as const;\n\nexport const TYPESAFE_ORIGIN = 'auto.ai.typesafe' as const;\n"],"names":[],"mappings":"AAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,yBAAA,CAAA,CAAA,CAA4B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAElC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,sBAAA,CAAA,CAAA,CAAyB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAE/B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,eAAA,CAAA,CAAA,CAAkB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;;"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { GEN_AI_RESPONSE_MODEL, GEN_AI_USAGE_INPUT_TOKENS, GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_TOTAL_TOKENS, GEN_AI_OUTPUT_MESSAGES, GEN_AI_INPUT_MESSAGES, GEN_AI_REQUEST_MODEL, GEN_AI_PROVIDER_NAME, GEN_AI_OPERATION_NAME } from '@sentry/conventions/attributes';
|
|
2
|
+
import { isObjectLike, stringify, startInactiveSpan, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, withActiveSpan, SPAN_STATUS_ERROR } from '@sentry/core';
|
|
3
|
+
import { getGenAiSpanOp, resolveAIRecordingOptions } from '../core/utils.js';
|
|
4
|
+
import { TYPESAFE_PROVIDER_NAME, TYPESAFE_ORIGIN } from './constants.js';
|
|
5
|
+
|
|
6
|
+
function startEvaluateSpan(request, client, recordInputs) {
|
|
7
|
+
const params = isObjectLike(request) ? request : {};
|
|
8
|
+
const defaultModel = isObjectLike(client) ? client.defaultModel : void 0;
|
|
9
|
+
const model = typeof params.model === "string" ? params.model : typeof defaultModel === "string" ? defaultModel : void 0;
|
|
10
|
+
return startInactiveSpan({
|
|
11
|
+
name: model ? `evaluate ${model}` : "evaluate",
|
|
12
|
+
op: getGenAiSpanOp("evaluate"),
|
|
13
|
+
attributes: getRequestAttributes(params, model, recordInputs)
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function getRequestAttributes(request, model, recordInputs) {
|
|
17
|
+
return {
|
|
18
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: TYPESAFE_ORIGIN,
|
|
19
|
+
[GEN_AI_OPERATION_NAME]: "evaluate",
|
|
20
|
+
[GEN_AI_PROVIDER_NAME]: TYPESAFE_PROVIDER_NAME,
|
|
21
|
+
...model ? { [GEN_AI_REQUEST_MODEL]: model } : {},
|
|
22
|
+
...recordInputs ? {
|
|
23
|
+
[GEN_AI_INPUT_MESSAGES]: stringify([
|
|
24
|
+
{ type: "evaluation", state: request.state, questions: request.questions }
|
|
25
|
+
])
|
|
26
|
+
} : {}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function addResponseAttributes(span, result, recordOutputs) {
|
|
30
|
+
if (!isObjectLike(result)) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (typeof result.model === "string") {
|
|
34
|
+
span.setAttribute(GEN_AI_RESPONSE_MODEL, result.model);
|
|
35
|
+
}
|
|
36
|
+
const usage = isObjectLike(result.usage) ? result.usage : void 0;
|
|
37
|
+
const inputTokens = typeof usage?.input_tokens === "number" ? usage.input_tokens : void 0;
|
|
38
|
+
const outputTokens = typeof usage?.output_tokens === "number" ? usage.output_tokens : void 0;
|
|
39
|
+
if (inputTokens !== void 0) {
|
|
40
|
+
span.setAttribute(GEN_AI_USAGE_INPUT_TOKENS, inputTokens);
|
|
41
|
+
}
|
|
42
|
+
if (outputTokens !== void 0) {
|
|
43
|
+
span.setAttribute(GEN_AI_USAGE_OUTPUT_TOKENS, outputTokens);
|
|
44
|
+
}
|
|
45
|
+
if (inputTokens !== void 0 && outputTokens !== void 0) {
|
|
46
|
+
span.setAttribute(GEN_AI_USAGE_TOTAL_TOKENS, inputTokens + outputTokens);
|
|
47
|
+
}
|
|
48
|
+
if (recordOutputs && result.answers !== void 0) {
|
|
49
|
+
span.setAttribute(GEN_AI_OUTPUT_MESSAGES, stringify([{ type: "evaluation", answers: result.answers }]));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function onSystemOneResponse(result, onBody, onError) {
|
|
53
|
+
if (!isObjectLike(result) || typeof result.asResponse !== "function") {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
result.asResponse().then(
|
|
57
|
+
(response) => response.clone().json().then(
|
|
58
|
+
(body) => onBody(body),
|
|
59
|
+
() => onBody(void 0)
|
|
60
|
+
),
|
|
61
|
+
(error) => onError(error)
|
|
62
|
+
);
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
function instrumentTypeSafeClient(client, options) {
|
|
66
|
+
return new Proxy(client, {
|
|
67
|
+
get(target, prop) {
|
|
68
|
+
const value = Reflect.get(target, prop, target);
|
|
69
|
+
if (typeof value !== "function") {
|
|
70
|
+
return value;
|
|
71
|
+
}
|
|
72
|
+
if (prop === "systemOne") {
|
|
73
|
+
return (...args) => instrumentSystemOne(value, target, args, options);
|
|
74
|
+
}
|
|
75
|
+
return value.bind(target);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function instrumentSystemOne(systemOne, client, args, options) {
|
|
80
|
+
const { recordInputs, recordOutputs } = resolveAIRecordingOptions(options);
|
|
81
|
+
const span = startEvaluateSpan(args[0], client, recordInputs);
|
|
82
|
+
const endWithError = () => {
|
|
83
|
+
span.setStatus({ code: SPAN_STATUS_ERROR, message: "internal_error" });
|
|
84
|
+
span.end();
|
|
85
|
+
};
|
|
86
|
+
let result;
|
|
87
|
+
try {
|
|
88
|
+
result = withActiveSpan(span, () => systemOne.apply(client, args));
|
|
89
|
+
} catch (error) {
|
|
90
|
+
endWithError();
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
93
|
+
const waiting = onSystemOneResponse(
|
|
94
|
+
result,
|
|
95
|
+
(body) => {
|
|
96
|
+
addResponseAttributes(span, body, recordOutputs);
|
|
97
|
+
span.end();
|
|
98
|
+
},
|
|
99
|
+
endWithError
|
|
100
|
+
);
|
|
101
|
+
if (!waiting) {
|
|
102
|
+
span.end();
|
|
103
|
+
}
|
|
104
|
+
return result;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export { addResponseAttributes, instrumentTypeSafeClient, onSystemOneResponse, startEvaluateSpan };
|
|
108
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/ai/typesafe/index.ts"],"sourcesContent":["import {\n GEN_AI_INPUT_MESSAGES,\n GEN_AI_OPERATION_NAME,\n GEN_AI_OUTPUT_MESSAGES,\n GEN_AI_PROVIDER_NAME,\n GEN_AI_REQUEST_MODEL,\n GEN_AI_RESPONSE_MODEL,\n GEN_AI_USAGE_INPUT_TOKENS,\n GEN_AI_USAGE_OUTPUT_TOKENS,\n GEN_AI_USAGE_TOTAL_TOKENS,\n} from '@sentry/conventions/attributes';\nimport type { Span, SpanAttributes } from '@sentry/core';\nimport {\n isObjectLike,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_STATUS_ERROR,\n startInactiveSpan,\n stringify,\n withActiveSpan,\n} from '@sentry/core';\nimport type { GenAiOptions } from '../core/utils';\nimport { getGenAiSpanOp, resolveAIRecordingOptions } from '../core/utils';\nimport { TYPESAFE_ORIGIN, TYPESAFE_PROVIDER_NAME } from './constants';\n\n/**\n * Start the span for a `systemOne(request)` call. The request model falls back to the client's\n * `defaultModel`, the same way the SDK resolves it.\n */\nexport function startEvaluateSpan(request: unknown, client: unknown, recordInputs: boolean): Span {\n const params = isObjectLike(request) ? request : {};\n const defaultModel = isObjectLike(client) ? client.defaultModel : undefined;\n const model =\n typeof params.model === 'string' ? params.model : typeof defaultModel === 'string' ? defaultModel : undefined;\n\n return startInactiveSpan({\n name: model ? `evaluate ${model}` : 'evaluate',\n op: getGenAiSpanOp('evaluate'),\n attributes: getRequestAttributes(params, model, recordInputs),\n });\n}\n\nfunction getRequestAttributes(\n request: Record<string, unknown>,\n model: string | undefined,\n recordInputs: boolean,\n): SpanAttributes {\n return {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: TYPESAFE_ORIGIN,\n [GEN_AI_OPERATION_NAME]: 'evaluate',\n [GEN_AI_PROVIDER_NAME]: TYPESAFE_PROVIDER_NAME,\n ...(model ? { [GEN_AI_REQUEST_MODEL]: model } : {}),\n ...(recordInputs\n ? {\n [GEN_AI_INPUT_MESSAGES]: stringify([\n { type: 'evaluation', state: request.state, questions: request.questions },\n ]),\n }\n : {}),\n };\n}\n\n/** Add the response model, token usage and (optionally) the answers of a `systemOne` result. */\nexport function addResponseAttributes(span: Span, result: unknown, recordOutputs: boolean): void {\n if (!isObjectLike(result)) {\n return;\n }\n\n if (typeof result.model === 'string') {\n span.setAttribute(GEN_AI_RESPONSE_MODEL, result.model);\n }\n\n const usage = isObjectLike(result.usage) ? result.usage : undefined;\n const inputTokens = typeof usage?.input_tokens === 'number' ? usage.input_tokens : undefined;\n const outputTokens = typeof usage?.output_tokens === 'number' ? usage.output_tokens : undefined;\n if (inputTokens !== undefined) {\n span.setAttribute(GEN_AI_USAGE_INPUT_TOKENS, inputTokens);\n }\n if (outputTokens !== undefined) {\n span.setAttribute(GEN_AI_USAGE_OUTPUT_TOKENS, outputTokens);\n }\n if (inputTokens !== undefined && outputTokens !== undefined) {\n span.setAttribute(GEN_AI_USAGE_TOTAL_TOKENS, inputTokens + outputTokens);\n }\n\n if (recordOutputs && result.answers !== undefined) {\n span.setAttribute(GEN_AI_OUTPUT_MESSAGES, stringify([{ type: 'evaluation', answers: result.answers }]));\n }\n}\n\n/**\n * `systemOne` returns a lazy `APIPromise` before the request settles, and parses the body on the first\n * `.then()`. Wait on `asResponse()` (the raw fetch, which does not parse the body) and read a clone of\n * the body, so the caller's own parse is unaffected. Call this before the caller can await the result,\n * so the clone is taken first. Returns `false` when `result` is not an `APIPromise`.\n */\nexport function onSystemOneResponse(\n result: unknown,\n onBody: (body: unknown) => void,\n onError: (error: unknown) => void,\n): boolean {\n if (!isObjectLike(result) || typeof result.asResponse !== 'function') {\n return false;\n }\n\n (result.asResponse() as Promise<Response>).then(\n response =>\n response\n .clone()\n .json()\n .then(\n body => onBody(body),\n () => onBody(undefined),\n ),\n error => onError(error),\n );\n\n return true;\n}\n\n/**\n * Instrument a TypeSafe client (`@typesafe-ai/sdk`) with Sentry tracing.\n */\nexport function instrumentTypeSafeClient<T extends object>(client: T, options?: GenAiOptions): T {\n return new Proxy(client, {\n get(target, prop) {\n // Read with the real client as receiver: the SDK keeps its API key in a private class field.\n const value: unknown = Reflect.get(target, prop, target);\n if (typeof value !== 'function') {\n return value;\n }\n if (prop === 'systemOne') {\n return (...args: unknown[]) =>\n instrumentSystemOne(value as (...args: unknown[]) => unknown, target, args, options);\n }\n return value.bind(target);\n },\n });\n}\n\nfunction instrumentSystemOne(\n systemOne: (...args: unknown[]) => unknown,\n client: object,\n args: unknown[],\n options: GenAiOptions | undefined,\n): unknown {\n const { recordInputs, recordOutputs } = resolveAIRecordingOptions(options);\n const span = startEvaluateSpan(args[0], client, recordInputs);\n const endWithError = (): void => {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' });\n span.end();\n };\n\n let result: unknown;\n try {\n result = withActiveSpan(span, () => systemOne.apply(client, args));\n } catch (error) {\n endWithError();\n throw error;\n }\n\n const waiting = onSystemOneResponse(\n result,\n body => {\n addResponseAttributes(span, body, recordOutputs);\n span.end();\n },\n endWithError,\n );\n if (!waiting) {\n span.end();\n }\n\n return result;\n}\n"],"names":[],"mappings":";;;;;AA4BO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,iBAAA,CAAkB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAkB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAiB,YAAA,CAAA,CAA6B;AAChG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,OAAO,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,IAAU,CAAA,CAAC;AAClD,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAe,CAAA,CAAA,CAAA,CAAA,CAAA,CAA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A,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CAAA,CACF;AACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS;AACZ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAI;AAAA,CAAA,CACX;AAEA,CAAA,CAAA,OAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACT;;"}
|
package/build/esm/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export { instrumentOpenAiClient } from './ai/openai/index.js';
|
|
|
5
5
|
export { instrumentAnthropicAiClient } from './ai/anthropic-ai/index.js';
|
|
6
6
|
export { instrumentGoogleGenAIClient } from './ai/google-genai/index.js';
|
|
7
7
|
export { instrumentMistralAiClient } from './ai/mistral/index.js';
|
|
8
|
+
export { instrumentTypeSafeClient } from './ai/typesafe/index.js';
|
|
8
9
|
export { instrumentWorkersAiClient } from './ai/workers-ai/index.js';
|
|
9
10
|
export { createLangChainCallbackHandler } from './ai/langchain/index.js';
|
|
10
11
|
export { instrumentCreateReactAgent, instrumentStateGraph, instrumentStateGraphCompile } from './ai/langgraph/index.js';
|
|
@@ -12,11 +13,14 @@ export { SentryMastraExporter } from './ai/mastra/index.js';
|
|
|
12
13
|
export { createFlueInstrumentation } from './ai/flue/index.js';
|
|
13
14
|
export { getSqlQuerySummary, sanitizeSqlQuery, sanitizeSqlQueryWithSummary } from './utils/sql.js';
|
|
14
15
|
export { instrumentPostgresJsSql } from './integrations/postgresjs.js';
|
|
16
|
+
export { applyHonoPatches, earlyPatchHono } from './integrations/hono/applyPatches.js';
|
|
17
|
+
export { createHonoRequestMiddleware } from './integrations/hono/createHonoMiddleware.js';
|
|
15
18
|
export { detectOrchestrionSetup } from './orchestrion/detect.js';
|
|
16
19
|
export { attachKoaErrorHandler } from './integrations/koa/koa-error-handler.js';
|
|
17
20
|
import { attachHapiErrorHandler as attachHapiErrorHandler$1 } from './integrations/hapi/hapi-error-handler.js';
|
|
18
21
|
export { bindTracingChannelToSpan } from './tracing-channel.js';
|
|
19
22
|
export { orchestrionModuleInjected } from './utils/moduleInjected.js';
|
|
23
|
+
export { tracingChannel as diagnosticsTracingChannel, subscribe as subscribeDiagnosticsChannel } from './utils/diagnosticsChannel.js';
|
|
20
24
|
export { eveConversationHook, eveIntegration } from './eve.js';
|
|
21
25
|
export { getInstrumentedModuleNames } from './orchestrion/config/index.js';
|
|
22
26
|
export { fastifyIntegration, setupFastifyErrorHandler } from './integrations/fastify/index.js';
|
|
@@ -29,6 +33,7 @@ export { genericPoolIntegration } from './integrations/generic-pool.js';
|
|
|
29
33
|
export { googleGenAIIntegration } from './integrations/google-genai.js';
|
|
30
34
|
export { graphqlIntegration } from './integrations/graphql/index.js';
|
|
31
35
|
export { hapiIntegration } from './integrations/hapi/index.js';
|
|
36
|
+
export { honoIntegration, honoMiddleware } from './integrations/hono/honoIntegration.js';
|
|
32
37
|
export { koaIntegration } from './integrations/koa/index.js';
|
|
33
38
|
export { redisIntegration } from './integrations/redis/index.js';
|
|
34
39
|
export { kafkaIntegration } from './integrations/kafkajs/index.js';
|
|
@@ -37,12 +42,14 @@ export { langChainIntegration } from './integrations/langchain.js';
|
|
|
37
42
|
export { langGraphIntegration } from './integrations/langgraph.js';
|
|
38
43
|
export { flueIntegration } from './integrations/flue.js';
|
|
39
44
|
export { mastraIntegration } from './integrations/mastra.js';
|
|
45
|
+
export { mcpServerIntegration } from './integrations/mcp-server.js';
|
|
40
46
|
export { lruMemoizerIntegration } from './integrations/lru-memoizer.js';
|
|
41
47
|
export { mongoIntegration } from './integrations/mongodb/index.js';
|
|
42
48
|
export { mongooseIntegration } from './integrations/mongoose/index.js';
|
|
43
49
|
export { mistralAIIntegration } from './integrations/mistral.js';
|
|
44
50
|
export { groqIntegration } from './integrations/groq.js';
|
|
45
51
|
export { togetherAIIntegration } from './integrations/together-ai.js';
|
|
52
|
+
export { typesafeIntegration } from './integrations/typesafe.js';
|
|
46
53
|
export { mysqlIntegration } from './integrations/mysql.js';
|
|
47
54
|
export { mysql2Integration } from './integrations/mysql2/index.js';
|
|
48
55
|
export { openAIIntegration } from './integrations/openai.js';
|
package/build/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["export * from './exports';\n\n// Exports using diagnostics channels\nexport { detectOrchestrionSetup } from './orchestrion/detect';\n// oxlint-disable-next-line typescript/no-deprecated -- re-exported so the deprecated `setupKoaErrorHandler` can delegate\nexport { attachKoaErrorHandler } from './integrations/koa/koa-error-handler';\nimport { attachHapiErrorHandler as _attachHapiErrorHandler } from './integrations/hapi/hapi-error-handler';\nexport { bindTracingChannelToSpan } from './tracing-channel';\nexport type { TracingChannelPayloadWithSpan } from './tracing-channel';\nexport type { InstrumentationConfig } from './orchestrion/apmTypes';\n// Runtime target of the bundler-injected module snippet. The snippet imports it\n// from this entry alongside the module's subscriber factory (see\n// `orchestrion/bundler/moduleInjectedTransform.ts`); it is a plain runtime\n// helper with no orchestrion build-time dependency.\nexport { orchestrionModuleInjected } from './utils/moduleInjected';\nexport { eveConversationHook, eveIntegration } from './eve';\nexport { getInstrumentedModuleNames } from './orchestrion/config';\nexport {\n fastifyIntegration,\n // oxlint-disable-next-line typescript/no-deprecated\n setupFastifyErrorHandler,\n} from './integrations/fastify';\n\n/**\n * @deprecated This is a temporary export to avoid breaking changes. It will be removed in the next major version.\n */\nexport const attachHapiErrorHandler = _attachHapiErrorHandler;\n\n// Integrations\nexport { prismaIntegration } from './integrations/prisma';\nexport { amqplibIntegration } from './integrations/amqplib';\nexport { anthropicAIIntegration } from './integrations/anthropic';\nexport { awsIntegration } from './integrations/aws-sdk';\nexport { dataloaderIntegration } from './integrations/dataloader';\nexport { genericPoolIntegration } from './integrations/generic-pool';\nexport { googleGenAIIntegration } from './integrations/google-genai';\nexport { graphqlIntegration } from './integrations/graphql';\nexport { hapiIntegration } from './integrations/hapi';\nexport { koaIntegration } from './integrations/koa';\nexport { redisIntegration } from './integrations/redis';\nexport { kafkaIntegration } from './integrations/kafkajs';\nexport { knexIntegration } from './integrations/knex';\nexport { langChainIntegration } from './integrations/langchain';\nexport { langGraphIntegration } from './integrations/langgraph';\nexport { createFlueInstrumentation } from './ai/flue';\nexport { flueIntegration } from './integrations/flue';\nexport type { FlueOptions } from './ai/flue';\nexport { mastraIntegration } from './integrations/mastra';\nexport { SentryMastraExporter } from './ai/mastra';\nexport { lruMemoizerIntegration } from './integrations/lru-memoizer';\nexport { mongoIntegration } from './integrations/mongodb';\nexport { mongooseIntegration } from './integrations/mongoose';\nexport { mistralAIIntegration } from './integrations/mistral';\nexport { groqIntegration } from './integrations/groq';\nexport { togetherAIIntegration } from './integrations/together-ai';\nexport { mysqlIntegration } from './integrations/mysql';\nexport { mysql2Integration } from './integrations/mysql2';\nexport { openAIIntegration } from './integrations/openai';\nexport { postgresIntegration } from './integrations/postgres';\nexport { postgresJsIntegration } from './integrations/postgres-js';\nexport { tediousIntegration } from './integrations/tedious';\nexport { vercelAIIntegration } from './integrations/vercel-ai';\nexport { expressIntegration } from './integrations/express';\nexport type { ExpressIntegrationOptions } from './integrations/express/types';\n/* oxlint-disable typescript/no-deprecated -- deprecated Express error-handler exports, kept until the next major */\nexport { expressErrorHandler, setupExpressErrorHandler } from './integrations/express/error-handler';\n/* oxlint-enable typescript/no-deprecated */\nexport { firebaseIntegration } from './integrations/firebase';\n\nexport { getTracingIntegrations, getErrorIntegrations } from './integrations';\n"],"names":["_attachHapiErrorHandler"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["export * from './exports';\n\n// Exports using diagnostics channels\nexport { detectOrchestrionSetup } from './orchestrion/detect';\n// oxlint-disable-next-line typescript/no-deprecated -- re-exported so the deprecated `setupKoaErrorHandler` can delegate\nexport { attachKoaErrorHandler } from './integrations/koa/koa-error-handler';\nimport { attachHapiErrorHandler as _attachHapiErrorHandler } from './integrations/hapi/hapi-error-handler';\nexport { bindTracingChannelToSpan } from './tracing-channel';\nexport type { TracingChannelPayloadWithSpan } from './tracing-channel';\nexport type { InstrumentationConfig } from './orchestrion/apmTypes';\n// Runtime target of the bundler-injected module snippet. The snippet imports it\n// from this entry alongside the module's subscriber factory (see\n// `orchestrion/bundler/moduleInjectedTransform.ts`); it is a plain runtime\n// helper with no orchestrion build-time dependency.\nexport { orchestrionModuleInjected } from './utils/moduleInjected';\nexport {\n subscribe as subscribeDiagnosticsChannel,\n tracingChannel as diagnosticsTracingChannel,\n} from './utils/diagnosticsChannel';\nexport { eveConversationHook, eveIntegration } from './eve';\nexport { getInstrumentedModuleNames } from './orchestrion/config';\nexport {\n fastifyIntegration,\n // oxlint-disable-next-line typescript/no-deprecated\n setupFastifyErrorHandler,\n} from './integrations/fastify';\n\n/**\n * @deprecated This is a temporary export to avoid breaking changes. It will be removed in the next major version.\n */\nexport const attachHapiErrorHandler = _attachHapiErrorHandler;\n\n// Integrations\nexport { prismaIntegration } from './integrations/prisma';\nexport { amqplibIntegration } from './integrations/amqplib';\nexport { anthropicAIIntegration } from './integrations/anthropic';\nexport { awsIntegration } from './integrations/aws-sdk';\nexport { dataloaderIntegration } from './integrations/dataloader';\nexport { genericPoolIntegration } from './integrations/generic-pool';\nexport { googleGenAIIntegration } from './integrations/google-genai';\nexport { graphqlIntegration } from './integrations/graphql';\nexport { hapiIntegration } from './integrations/hapi';\nexport { honoIntegration, honoMiddleware } from './integrations/hono';\nexport type { HonoIntegrationOptions } from './integrations/hono';\nexport { koaIntegration } from './integrations/koa';\nexport { redisIntegration } from './integrations/redis';\nexport { kafkaIntegration } from './integrations/kafkajs';\nexport { knexIntegration } from './integrations/knex';\nexport { langChainIntegration } from './integrations/langchain';\nexport { langGraphIntegration } from './integrations/langgraph';\nexport { createFlueInstrumentation } from './ai/flue';\nexport { flueIntegration } from './integrations/flue';\nexport type { FlueOptions } from './ai/flue';\nexport { mastraIntegration } from './integrations/mastra';\nexport { mcpServerIntegration } from './integrations/mcp-server';\nexport { SentryMastraExporter } from './ai/mastra';\nexport { lruMemoizerIntegration } from './integrations/lru-memoizer';\nexport { mongoIntegration } from './integrations/mongodb';\nexport { mongooseIntegration } from './integrations/mongoose';\nexport { mistralAIIntegration } from './integrations/mistral';\nexport { groqIntegration } from './integrations/groq';\nexport { togetherAIIntegration } from './integrations/together-ai';\nexport { typesafeIntegration } from './integrations/typesafe';\nexport { mysqlIntegration } from './integrations/mysql';\nexport { mysql2Integration } from './integrations/mysql2';\nexport { openAIIntegration } from './integrations/openai';\nexport { postgresIntegration } from './integrations/postgres';\nexport { postgresJsIntegration } from './integrations/postgres-js';\nexport { tediousIntegration } from './integrations/tedious';\nexport { vercelAIIntegration } from './integrations/vercel-ai';\nexport { expressIntegration } from './integrations/express';\nexport type { ExpressIntegrationOptions } from './integrations/express/types';\n/* oxlint-disable typescript/no-deprecated -- deprecated Express error-handler exports, kept until the next major */\nexport { expressErrorHandler, setupExpressErrorHandler } from './integrations/express/error-handler';\n/* oxlint-enable typescript/no-deprecated */\nexport { firebaseIntegration } from './integrations/firebase';\n\nexport { getTracingIntegrations, getErrorIntegrations } from './integrations';\n"],"names":["_attachHapiErrorHandler"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,sBAAA,CAAA,CAAA,CAAyBA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA;;"}
|
|
@@ -5,6 +5,7 @@ export { instrumentOpenAiClient } from './ai/openai/index.js';
|
|
|
5
5
|
export { instrumentAnthropicAiClient } from './ai/anthropic-ai/index.js';
|
|
6
6
|
export { instrumentGoogleGenAIClient } from './ai/google-genai/index.js';
|
|
7
7
|
export { instrumentMistralAiClient } from './ai/mistral/index.js';
|
|
8
|
+
export { instrumentTypeSafeClient } from './ai/typesafe/index.js';
|
|
8
9
|
export { instrumentWorkersAiClient } from './ai/workers-ai/index.js';
|
|
9
10
|
export { createLangChainCallbackHandler } from './ai/langchain/index.js';
|
|
10
11
|
export { instrumentCreateReactAgent, instrumentStateGraph, instrumentStateGraphCompile } from './ai/langgraph/index.js';
|
|
@@ -12,5 +13,7 @@ export { SentryMastraExporter } from './ai/mastra/index.js';
|
|
|
12
13
|
export { createFlueInstrumentation } from './ai/flue/index.js';
|
|
13
14
|
export { getSqlQuerySummary, sanitizeSqlQuery, sanitizeSqlQueryWithSummary } from './utils/sql.js';
|
|
14
15
|
export { instrumentPostgresJsSql } from './integrations/postgresjs.js';
|
|
16
|
+
export { applyHonoPatches, earlyPatchHono } from './integrations/hono/applyPatches.js';
|
|
17
|
+
export { createHonoRequestMiddleware } from './integrations/hono/createHonoMiddleware.js';
|
|
15
18
|
export { instrumentLangChainEmbeddings } from './ai/langchain/embeddings.js';
|
|
16
19
|
//# sourceMappingURL=index.no-diagnostic-channels.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.no-diagnostic-channels.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.no-diagnostic-channels.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { defineIntegration, continueTrace, timestampInSeconds,
|
|
3
|
-
import {
|
|
1
|
+
import { tracingChannel } from '../utils/diagnosticsChannel.js';
|
|
2
|
+
import { defineIntegration, continueTrace, timestampInSeconds, getClient, startInactiveSpan, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, hasSpanStreamingEnabled, getTraceData, SPAN_STATUS_ERROR } from '@sentry/core';
|
|
3
|
+
import { MESSAGING_SYSTEM, NETWORK_PROTOCOL_NAME, SERVER_ADDRESS, SERVER_PORT, MESSAGING_MESSAGE_ID, MESSAGING_OPERATION_TYPE, MESSAGING_OPERATION_NAME, MESSAGING_DESTINATION_NAME, SENTRY_KIND, SENTRY_OP, SENTRY_SEGMENT_NAME_SOURCE, NETWORK_PROTOCOL_VERSION, URL_FULL } from '@sentry/conventions/attributes';
|
|
4
4
|
import { QUEUE_PUBLISH, QUEUE_PROCESS } from '@sentry/conventions/op';
|
|
5
5
|
import { amqplibModuleNames } from '../orchestrion/config/amqplib.js';
|
|
6
6
|
import { invokeOrchestrionInstrumentation } from '../orchestrion/instrumentation.js';
|
|
@@ -50,7 +50,7 @@ function instrumentAmqplib() {
|
|
|
50
50
|
subscribeSettle();
|
|
51
51
|
}
|
|
52
52
|
function subscribePublish() {
|
|
53
|
-
bindTracingChannelToSpan(
|
|
53
|
+
bindTracingChannelToSpan(tracingChannel(CHANNELS.AMQPLIB_PUBLISH), (data) => {
|
|
54
54
|
if (data.self?.[CHANNEL_IS_CONFIRM_PUBLISHING]) {
|
|
55
55
|
return void 0;
|
|
56
56
|
}
|
|
@@ -58,7 +58,7 @@ function subscribePublish() {
|
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
function subscribeConfirmPublish() {
|
|
61
|
-
const channel =
|
|
61
|
+
const channel = tracingChannel(CHANNELS.AMQPLIB_CONFIRM_PUBLISH);
|
|
62
62
|
bindTracingChannelToSpan(channel, (data) => {
|
|
63
63
|
if (data.self) {
|
|
64
64
|
data.self[CHANNEL_IS_CONFIRM_PUBLISHING] = true;
|
|
@@ -73,7 +73,7 @@ function subscribeConfirmPublish() {
|
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
function subscribeConsume() {
|
|
76
|
-
const channel =
|
|
76
|
+
const channel = tracingChannel(CHANNELS.AMQPLIB_CONSUME);
|
|
77
77
|
channel.start.subscribe(NOOP);
|
|
78
78
|
channel.asyncEnd.subscribe((message) => {
|
|
79
79
|
const data = message;
|
|
@@ -92,7 +92,7 @@ function subscribeConsume() {
|
|
|
92
92
|
}
|
|
93
93
|
function subscribeDispatch() {
|
|
94
94
|
bindTracingChannelToSpan(
|
|
95
|
-
|
|
95
|
+
tracingChannel(CHANNELS.AMQPLIB_DISPATCH),
|
|
96
96
|
(data) => {
|
|
97
97
|
const channel = data.self;
|
|
98
98
|
const fields = data.arguments[0];
|
|
@@ -126,16 +126,16 @@ function subscribeDispatch() {
|
|
|
126
126
|
);
|
|
127
127
|
}
|
|
128
128
|
function subscribeSettle() {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
tracingChannel(CHANNELS.AMQPLIB_ACK).start.subscribe((message) => handleAck(message, false, END_OP.Ack));
|
|
130
|
+
tracingChannel(CHANNELS.AMQPLIB_NACK).start.subscribe((message) => handleAck(message, true, END_OP.Nack));
|
|
131
|
+
tracingChannel(CHANNELS.AMQPLIB_REJECT).start.subscribe((message) => handleAck(message, true, END_OP.Reject));
|
|
132
|
+
tracingChannel(CHANNELS.AMQPLIB_ACK_ALL).start.subscribe((message) => {
|
|
133
133
|
const data = message;
|
|
134
134
|
if (data.self) {
|
|
135
135
|
endAllSpansOnChannel(data.self, false, END_OP.AckAll, void 0);
|
|
136
136
|
}
|
|
137
137
|
});
|
|
138
|
-
|
|
138
|
+
tracingChannel(CHANNELS.AMQPLIB_NACK_ALL).start.subscribe((message) => {
|
|
139
139
|
const data = message;
|
|
140
140
|
if (data.self) {
|
|
141
141
|
endAllSpansOnChannel(data.self, true, END_OP.NackAll, data.arguments[0]);
|
|
@@ -143,7 +143,7 @@ function subscribeSettle() {
|
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
145
|
function subscribeConnect() {
|
|
146
|
-
const channel =
|
|
146
|
+
const channel = tracingChannel(CHANNELS.AMQPLIB_CONNECT);
|
|
147
147
|
channel.start.subscribe(NOOP);
|
|
148
148
|
channel.asyncEnd.subscribe((message) => {
|
|
149
149
|
const data = message;
|