@sentry/server-utils 10.67.0 → 10.69.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/integrations/tracing-channel/dataloader.js +17 -7
- package/build/cjs/integrations/tracing-channel/dataloader.js.map +1 -1
- package/build/cjs/integrations/tracing-channel/fastify/index.js +2 -4
- package/build/cjs/integrations/tracing-channel/fastify/index.js.map +1 -1
- package/build/cjs/integrations/tracing-channel/fastify/utils.js.map +1 -1
- package/build/cjs/integrations/tracing-channel/firebase/firestore.js +78 -0
- package/build/cjs/integrations/tracing-channel/firebase/firestore.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/firebase/functions.js +67 -0
- package/build/cjs/integrations/tracing-channel/firebase/functions.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/firebase/index.js +24 -0
- package/build/cjs/integrations/tracing-channel/firebase/index.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/firebase/instrumentation.js +66 -0
- package/build/cjs/integrations/tracing-channel/firebase/instrumentation.js.map +1 -0
- package/build/cjs/orchestrion/bundler/esbuild.js +24 -1
- package/build/cjs/orchestrion/bundler/esbuild.js.map +1 -1
- package/build/cjs/orchestrion/bundler/options.js +16 -2
- package/build/cjs/orchestrion/bundler/options.js.map +1 -1
- package/build/cjs/orchestrion/bundler/rollup.js +11 -1
- package/build/cjs/orchestrion/bundler/rollup.js.map +1 -1
- package/build/cjs/orchestrion/bundler/subscribeInjection.js +40 -0
- package/build/cjs/orchestrion/bundler/subscribeInjection.js.map +1 -0
- package/build/cjs/orchestrion/bundler/vite.js +16 -0
- package/build/cjs/orchestrion/bundler/vite.js.map +1 -1
- package/build/cjs/orchestrion/bundler/webpack.js +32 -1
- package/build/cjs/orchestrion/bundler/webpack.js.map +1 -1
- package/build/cjs/orchestrion/channels.js +0 -4
- package/build/cjs/orchestrion/channels.js.map +1 -1
- package/build/cjs/orchestrion/config/amqplib.js +4 -0
- package/build/cjs/orchestrion/config/amqplib.js.map +1 -1
- package/build/cjs/orchestrion/config/anthropic-ai.js +4 -0
- package/build/cjs/orchestrion/config/anthropic-ai.js.map +1 -1
- package/build/cjs/orchestrion/config/aws-sdk.js +4 -0
- package/build/cjs/orchestrion/config/aws-sdk.js.map +1 -1
- package/build/cjs/orchestrion/config/channel-integration-definitions.js +29 -0
- package/build/cjs/orchestrion/config/channel-integration-definitions.js.map +1 -0
- package/build/cjs/orchestrion/config/dataloader.js +4 -0
- package/build/cjs/orchestrion/config/dataloader.js.map +1 -1
- package/build/cjs/orchestrion/config/express.js +4 -0
- package/build/cjs/orchestrion/config/express.js.map +1 -1
- package/build/cjs/orchestrion/config/firebase.js +79 -2
- package/build/cjs/orchestrion/config/firebase.js.map +1 -1
- package/build/cjs/orchestrion/config/generic-pool.js +4 -0
- package/build/cjs/orchestrion/config/generic-pool.js.map +1 -1
- package/build/cjs/orchestrion/config/google-genai.js +4 -0
- package/build/cjs/orchestrion/config/google-genai.js.map +1 -1
- package/build/cjs/orchestrion/config/graphql.js +4 -0
- package/build/cjs/orchestrion/config/graphql.js.map +1 -1
- package/build/cjs/orchestrion/config/hapi.js +4 -0
- package/build/cjs/orchestrion/config/hapi.js.map +1 -1
- package/build/cjs/orchestrion/config/index.js +33 -5
- package/build/cjs/orchestrion/config/index.js.map +1 -1
- package/build/cjs/orchestrion/config/ioredis.js +4 -0
- package/build/cjs/orchestrion/config/ioredis.js.map +1 -1
- package/build/cjs/orchestrion/config/kafkajs.js +4 -0
- package/build/cjs/orchestrion/config/kafkajs.js.map +1 -1
- package/build/cjs/orchestrion/config/knex.js +4 -0
- package/build/cjs/orchestrion/config/knex.js.map +1 -1
- package/build/cjs/orchestrion/config/koa.js +4 -0
- package/build/cjs/orchestrion/config/koa.js.map +1 -1
- package/build/cjs/orchestrion/config/langchain.js +4 -0
- package/build/cjs/orchestrion/config/langchain.js.map +1 -1
- package/build/cjs/orchestrion/config/langgraph.js +4 -0
- package/build/cjs/orchestrion/config/langgraph.js.map +1 -1
- package/build/cjs/orchestrion/config/lru-memoizer.js +4 -0
- package/build/cjs/orchestrion/config/lru-memoizer.js.map +1 -1
- package/build/cjs/orchestrion/config/mongodb.js +4 -0
- package/build/cjs/orchestrion/config/mongodb.js.map +1 -1
- package/build/cjs/orchestrion/config/mongoose.js +4 -0
- package/build/cjs/orchestrion/config/mongoose.js.map +1 -1
- package/build/cjs/orchestrion/config/mysql.js +4 -0
- package/build/cjs/orchestrion/config/mysql.js.map +1 -1
- package/build/cjs/orchestrion/config/mysql2.js +4 -0
- package/build/cjs/orchestrion/config/mysql2.js.map +1 -1
- package/build/cjs/orchestrion/config/nestjs.js +4 -0
- package/build/cjs/orchestrion/config/nestjs.js.map +1 -1
- package/build/cjs/orchestrion/config/openai.js +4 -0
- package/build/cjs/orchestrion/config/openai.js.map +1 -1
- package/build/cjs/orchestrion/config/pg.js +4 -0
- package/build/cjs/orchestrion/config/pg.js.map +1 -1
- package/build/cjs/orchestrion/config/postgres.js +4 -0
- package/build/cjs/orchestrion/config/postgres.js.map +1 -1
- package/build/cjs/orchestrion/config/redis.js +4 -0
- package/build/cjs/orchestrion/config/redis.js.map +1 -1
- package/build/cjs/orchestrion/config/remix.js +4 -0
- package/build/cjs/orchestrion/config/remix.js.map +1 -1
- package/build/cjs/orchestrion/config/subscribe-injection.js +25 -0
- package/build/cjs/orchestrion/config/subscribe-injection.js.map +1 -0
- package/build/cjs/orchestrion/config/tedious.js +4 -0
- package/build/cjs/orchestrion/config/tedious.js.map +1 -1
- package/build/cjs/orchestrion/config/vercel-ai.js +4 -0
- package/build/cjs/orchestrion/config/vercel-ai.js.map +1 -1
- package/build/cjs/orchestrion/index.js +12 -7
- package/build/cjs/orchestrion/index.js.map +1 -1
- package/build/cjs/orchestrion/registerChannelIntegration.js +13 -0
- package/build/cjs/orchestrion/registerChannelIntegration.js.map +1 -0
- package/build/cjs/vercel-ai/index.js.map +1 -1
- package/build/cjs/vercel-ai/vercel-ai-dc-subscriber.js +2 -0
- package/build/cjs/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -1
- package/build/esm/integrations/tracing-channel/dataloader.js +17 -7
- package/build/esm/integrations/tracing-channel/dataloader.js.map +1 -1
- package/build/esm/integrations/tracing-channel/fastify/index.js +2 -4
- package/build/esm/integrations/tracing-channel/fastify/index.js.map +1 -1
- package/build/esm/integrations/tracing-channel/fastify/utils.js.map +1 -1
- package/build/esm/integrations/tracing-channel/firebase/firestore.js +75 -0
- package/build/esm/integrations/tracing-channel/firebase/firestore.js.map +1 -0
- package/build/esm/integrations/tracing-channel/firebase/functions.js +65 -0
- package/build/esm/integrations/tracing-channel/firebase/functions.js.map +1 -0
- package/build/esm/integrations/tracing-channel/firebase/index.js +22 -0
- package/build/esm/integrations/tracing-channel/firebase/index.js.map +1 -0
- package/build/esm/integrations/tracing-channel/firebase/instrumentation.js +64 -0
- package/build/esm/integrations/tracing-channel/firebase/instrumentation.js.map +1 -0
- package/build/esm/orchestrion/bundler/esbuild.js +25 -2
- package/build/esm/orchestrion/bundler/esbuild.js.map +1 -1
- package/build/esm/orchestrion/bundler/options.js +15 -3
- package/build/esm/orchestrion/bundler/options.js.map +1 -1
- package/build/esm/orchestrion/bundler/rollup.js +12 -2
- package/build/esm/orchestrion/bundler/rollup.js.map +1 -1
- package/build/esm/orchestrion/bundler/subscribeInjection.js +38 -0
- package/build/esm/orchestrion/bundler/subscribeInjection.js.map +1 -0
- package/build/esm/orchestrion/bundler/vite.js +17 -1
- package/build/esm/orchestrion/bundler/vite.js.map +1 -1
- package/build/esm/orchestrion/bundler/webpack.js +33 -3
- package/build/esm/orchestrion/bundler/webpack.js.map +1 -1
- package/build/esm/orchestrion/channels.js +0 -4
- package/build/esm/orchestrion/channels.js.map +1 -1
- package/build/esm/orchestrion/config/amqplib.js +4 -1
- package/build/esm/orchestrion/config/amqplib.js.map +1 -1
- package/build/esm/orchestrion/config/anthropic-ai.js +4 -1
- package/build/esm/orchestrion/config/anthropic-ai.js.map +1 -1
- package/build/esm/orchestrion/config/aws-sdk.js +4 -1
- package/build/esm/orchestrion/config/aws-sdk.js.map +1 -1
- package/build/esm/orchestrion/config/channel-integration-definitions.js +26 -0
- package/build/esm/orchestrion/config/channel-integration-definitions.js.map +1 -0
- package/build/esm/orchestrion/config/dataloader.js +4 -1
- package/build/esm/orchestrion/config/dataloader.js.map +1 -1
- package/build/esm/orchestrion/config/express.js +4 -1
- package/build/esm/orchestrion/config/express.js.map +1 -1
- package/build/esm/orchestrion/config/firebase.js +79 -3
- package/build/esm/orchestrion/config/firebase.js.map +1 -1
- package/build/esm/orchestrion/config/generic-pool.js +4 -1
- package/build/esm/orchestrion/config/generic-pool.js.map +1 -1
- package/build/esm/orchestrion/config/google-genai.js +4 -1
- package/build/esm/orchestrion/config/google-genai.js.map +1 -1
- package/build/esm/orchestrion/config/graphql.js +4 -1
- package/build/esm/orchestrion/config/graphql.js.map +1 -1
- package/build/esm/orchestrion/config/hapi.js +4 -1
- package/build/esm/orchestrion/config/hapi.js.map +1 -1
- package/build/esm/orchestrion/config/index.js +61 -34
- package/build/esm/orchestrion/config/index.js.map +1 -1
- package/build/esm/orchestrion/config/ioredis.js +4 -1
- package/build/esm/orchestrion/config/ioredis.js.map +1 -1
- package/build/esm/orchestrion/config/kafkajs.js +4 -1
- package/build/esm/orchestrion/config/kafkajs.js.map +1 -1
- package/build/esm/orchestrion/config/knex.js +4 -1
- package/build/esm/orchestrion/config/knex.js.map +1 -1
- package/build/esm/orchestrion/config/koa.js +4 -1
- package/build/esm/orchestrion/config/koa.js.map +1 -1
- package/build/esm/orchestrion/config/langchain.js +4 -1
- package/build/esm/orchestrion/config/langchain.js.map +1 -1
- package/build/esm/orchestrion/config/langgraph.js +4 -1
- package/build/esm/orchestrion/config/langgraph.js.map +1 -1
- package/build/esm/orchestrion/config/lru-memoizer.js +4 -1
- package/build/esm/orchestrion/config/lru-memoizer.js.map +1 -1
- package/build/esm/orchestrion/config/mongodb.js +4 -1
- package/build/esm/orchestrion/config/mongodb.js.map +1 -1
- package/build/esm/orchestrion/config/mongoose.js +4 -1
- package/build/esm/orchestrion/config/mongoose.js.map +1 -1
- package/build/esm/orchestrion/config/mysql.js +4 -1
- package/build/esm/orchestrion/config/mysql.js.map +1 -1
- package/build/esm/orchestrion/config/mysql2.js +4 -1
- package/build/esm/orchestrion/config/mysql2.js.map +1 -1
- package/build/esm/orchestrion/config/nestjs.js +4 -1
- package/build/esm/orchestrion/config/nestjs.js.map +1 -1
- package/build/esm/orchestrion/config/openai.js +4 -1
- package/build/esm/orchestrion/config/openai.js.map +1 -1
- package/build/esm/orchestrion/config/pg.js +4 -1
- package/build/esm/orchestrion/config/pg.js.map +1 -1
- package/build/esm/orchestrion/config/postgres.js +4 -1
- package/build/esm/orchestrion/config/postgres.js.map +1 -1
- package/build/esm/orchestrion/config/redis.js +4 -1
- package/build/esm/orchestrion/config/redis.js.map +1 -1
- package/build/esm/orchestrion/config/remix.js +4 -1
- package/build/esm/orchestrion/config/remix.js.map +1 -1
- package/build/esm/orchestrion/config/subscribe-injection.js +22 -0
- package/build/esm/orchestrion/config/subscribe-injection.js.map +1 -0
- package/build/esm/orchestrion/config/tedious.js +4 -1
- package/build/esm/orchestrion/config/tedious.js.map +1 -1
- package/build/esm/orchestrion/config/vercel-ai.js +4 -1
- package/build/esm/orchestrion/config/vercel-ai.js.map +1 -1
- package/build/esm/orchestrion/index.js +5 -2
- package/build/esm/orchestrion/index.js.map +1 -1
- package/build/esm/orchestrion/registerChannelIntegration.js +11 -0
- package/build/esm/orchestrion/registerChannelIntegration.js.map +1 -0
- package/build/esm/package.json +1 -1
- package/build/esm/vercel-ai/index.js.map +1 -1
- package/build/esm/vercel-ai/vercel-ai-dc-subscriber.js +3 -1
- package/build/esm/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -1
- package/build/types/index.d.ts +1 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/integrations/tracing-channel/dataloader.d.ts.map +1 -1
- package/build/types/integrations/tracing-channel/fastify/index.d.ts +2 -2
- package/build/types/integrations/tracing-channel/fastify/index.d.ts.map +1 -1
- package/build/types/integrations/tracing-channel/fastify/utils.d.ts +1 -1
- package/build/types/integrations/tracing-channel/fastify/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing-channel/firebase/firestore-types.d.ts +38 -0
- package/build/types/integrations/tracing-channel/firebase/firestore-types.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/firebase/firestore.d.ts +18 -0
- package/build/types/integrations/tracing-channel/firebase/firestore.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/firebase/functions.d.ts +15 -0
- package/build/types/integrations/tracing-channel/firebase/functions.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/firebase/index.d.ts +15 -0
- package/build/types/integrations/tracing-channel/firebase/index.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/firebase/instrumentation.d.ts +2 -0
- package/build/types/integrations/tracing-channel/firebase/instrumentation.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/vercel-ai.d.ts +1 -5
- package/build/types/integrations/tracing-channel/vercel-ai.d.ts.map +1 -1
- package/build/types/orchestrion/bundler/esbuild.d.ts +2 -3
- package/build/types/orchestrion/bundler/esbuild.d.ts.map +1 -1
- package/build/types/orchestrion/bundler/options.d.ts +34 -0
- package/build/types/orchestrion/bundler/options.d.ts.map +1 -1
- package/build/types/orchestrion/bundler/rollup.d.ts.map +1 -1
- package/build/types/orchestrion/bundler/subscribeInjection.d.ts +13 -0
- package/build/types/orchestrion/bundler/subscribeInjection.d.ts.map +1 -0
- package/build/types/orchestrion/bundler/vite.d.ts.map +1 -1
- package/build/types/orchestrion/bundler/webpack.d.ts +6 -1
- package/build/types/orchestrion/bundler/webpack.d.ts.map +1 -1
- package/build/types/orchestrion/channels.d.ts +15 -0
- package/build/types/orchestrion/channels.d.ts.map +1 -1
- package/build/types/orchestrion/config/amqplib.d.ts +2 -0
- package/build/types/orchestrion/config/amqplib.d.ts.map +1 -1
- package/build/types/orchestrion/config/anthropic-ai.d.ts +2 -0
- package/build/types/orchestrion/config/anthropic-ai.d.ts.map +1 -1
- package/build/types/orchestrion/config/aws-sdk.d.ts +2 -0
- package/build/types/orchestrion/config/aws-sdk.d.ts.map +1 -1
- package/build/types/orchestrion/config/channel-integration-definitions.d.ts +81 -0
- package/build/types/orchestrion/config/channel-integration-definitions.d.ts.map +1 -0
- package/build/types/orchestrion/config/dataloader.d.ts +2 -0
- package/build/types/orchestrion/config/dataloader.d.ts.map +1 -1
- package/build/types/orchestrion/config/express.d.ts +2 -0
- package/build/types/orchestrion/config/express.d.ts.map +1 -1
- package/build/types/orchestrion/config/firebase.d.ts +41 -2
- package/build/types/orchestrion/config/firebase.d.ts.map +1 -1
- package/build/types/orchestrion/config/generic-pool.d.ts +2 -0
- package/build/types/orchestrion/config/generic-pool.d.ts.map +1 -1
- package/build/types/orchestrion/config/google-genai.d.ts +2 -0
- package/build/types/orchestrion/config/google-genai.d.ts.map +1 -1
- package/build/types/orchestrion/config/graphql.d.ts +2 -0
- package/build/types/orchestrion/config/graphql.d.ts.map +1 -1
- package/build/types/orchestrion/config/hapi.d.ts +2 -0
- package/build/types/orchestrion/config/hapi.d.ts.map +1 -1
- package/build/types/orchestrion/config/index.d.ts +12 -0
- package/build/types/orchestrion/config/index.d.ts.map +1 -1
- package/build/types/orchestrion/config/ioredis.d.ts +1 -0
- package/build/types/orchestrion/config/ioredis.d.ts.map +1 -1
- package/build/types/orchestrion/config/kafkajs.d.ts +2 -0
- package/build/types/orchestrion/config/kafkajs.d.ts.map +1 -1
- package/build/types/orchestrion/config/knex.d.ts +1 -0
- package/build/types/orchestrion/config/knex.d.ts.map +1 -1
- package/build/types/orchestrion/config/koa.d.ts +2 -0
- package/build/types/orchestrion/config/koa.d.ts.map +1 -1
- package/build/types/orchestrion/config/langchain.d.ts +2 -0
- package/build/types/orchestrion/config/langchain.d.ts.map +1 -1
- package/build/types/orchestrion/config/langgraph.d.ts +2 -0
- package/build/types/orchestrion/config/langgraph.d.ts.map +1 -1
- package/build/types/orchestrion/config/lru-memoizer.d.ts +2 -0
- package/build/types/orchestrion/config/lru-memoizer.d.ts.map +1 -1
- package/build/types/orchestrion/config/mongodb.d.ts +2 -0
- package/build/types/orchestrion/config/mongodb.d.ts.map +1 -1
- package/build/types/orchestrion/config/mongoose.d.ts +2 -0
- package/build/types/orchestrion/config/mongoose.d.ts.map +1 -1
- package/build/types/orchestrion/config/mysql.d.ts +2 -0
- package/build/types/orchestrion/config/mysql.d.ts.map +1 -1
- package/build/types/orchestrion/config/mysql2.d.ts +2 -0
- package/build/types/orchestrion/config/mysql2.d.ts.map +1 -1
- package/build/types/orchestrion/config/nestjs.d.ts +1 -0
- package/build/types/orchestrion/config/nestjs.d.ts.map +1 -1
- package/build/types/orchestrion/config/openai.d.ts +2 -0
- package/build/types/orchestrion/config/openai.d.ts.map +1 -1
- package/build/types/orchestrion/config/pg.d.ts +2 -0
- package/build/types/orchestrion/config/pg.d.ts.map +1 -1
- package/build/types/orchestrion/config/postgres.d.ts +1 -0
- package/build/types/orchestrion/config/postgres.d.ts.map +1 -1
- package/build/types/orchestrion/config/redis.d.ts +2 -0
- package/build/types/orchestrion/config/redis.d.ts.map +1 -1
- package/build/types/orchestrion/config/remix.d.ts +1 -0
- package/build/types/orchestrion/config/remix.d.ts.map +1 -1
- package/build/types/orchestrion/config/subscribe-injection.d.ts +31 -0
- package/build/types/orchestrion/config/subscribe-injection.d.ts.map +1 -0
- package/build/types/orchestrion/config/tedious.d.ts +1 -0
- package/build/types/orchestrion/config/tedious.d.ts.map +1 -1
- package/build/types/orchestrion/config/vercel-ai.d.ts +1 -0
- package/build/types/orchestrion/config/vercel-ai.d.ts.map +1 -1
- package/build/types/orchestrion/index.d.ts +7 -6
- package/build/types/orchestrion/index.d.ts.map +1 -1
- package/build/types/orchestrion/registerChannelIntegration.d.ts +33 -0
- package/build/types/orchestrion/registerChannelIntegration.d.ts.map +1 -0
- package/build/types/vercel-ai/index.d.ts +2 -3
- package/build/types/vercel-ai/index.d.ts.map +1 -1
- package/build/types/vercel-ai/vercel-ai-dc-subscriber.d.ts.map +1 -1
- package/build/types-ts3.8/index.d.ts +1 -1
- package/build/types-ts3.8/integrations/tracing-channel/fastify/index.d.ts +2 -2
- package/build/types-ts3.8/integrations/tracing-channel/fastify/utils.d.ts +1 -1
- package/build/types-ts3.8/integrations/tracing-channel/firebase/firestore-types.d.ts +38 -0
- package/build/types-ts3.8/integrations/tracing-channel/firebase/firestore.d.ts +18 -0
- package/build/types-ts3.8/integrations/tracing-channel/firebase/functions.d.ts +15 -0
- package/build/types-ts3.8/integrations/tracing-channel/firebase/index.d.ts +15 -0
- package/build/types-ts3.8/integrations/tracing-channel/firebase/instrumentation.d.ts +2 -0
- package/build/types-ts3.8/integrations/tracing-channel/vercel-ai.d.ts +1 -5
- package/build/types-ts3.8/orchestrion/bundler/esbuild.d.ts +2 -3
- package/build/types-ts3.8/orchestrion/bundler/options.d.ts +34 -0
- package/build/types-ts3.8/orchestrion/bundler/subscribeInjection.d.ts +13 -0
- package/build/types-ts3.8/orchestrion/bundler/webpack.d.ts +6 -1
- package/build/types-ts3.8/orchestrion/channels.d.ts +15 -0
- package/build/types-ts3.8/orchestrion/config/amqplib.d.ts +2 -0
- package/build/types-ts3.8/orchestrion/config/anthropic-ai.d.ts +2 -0
- package/build/types-ts3.8/orchestrion/config/aws-sdk.d.ts +2 -0
- package/build/types-ts3.8/orchestrion/config/channel-integration-definitions.d.ts +139 -0
- package/build/types-ts3.8/orchestrion/config/dataloader.d.ts +2 -0
- package/build/types-ts3.8/orchestrion/config/express.d.ts +2 -0
- package/build/types-ts3.8/orchestrion/config/firebase.d.ts +41 -2
- package/build/types-ts3.8/orchestrion/config/generic-pool.d.ts +2 -0
- package/build/types-ts3.8/orchestrion/config/google-genai.d.ts +2 -0
- package/build/types-ts3.8/orchestrion/config/graphql.d.ts +2 -0
- package/build/types-ts3.8/orchestrion/config/hapi.d.ts +2 -0
- package/build/types-ts3.8/orchestrion/config/index.d.ts +12 -0
- package/build/types-ts3.8/orchestrion/config/ioredis.d.ts +1 -0
- package/build/types-ts3.8/orchestrion/config/kafkajs.d.ts +2 -0
- package/build/types-ts3.8/orchestrion/config/knex.d.ts +1 -0
- package/build/types-ts3.8/orchestrion/config/koa.d.ts +2 -0
- package/build/types-ts3.8/orchestrion/config/langchain.d.ts +2 -0
- package/build/types-ts3.8/orchestrion/config/langgraph.d.ts +2 -0
- package/build/types-ts3.8/orchestrion/config/lru-memoizer.d.ts +2 -0
- package/build/types-ts3.8/orchestrion/config/mongodb.d.ts +2 -0
- package/build/types-ts3.8/orchestrion/config/mongoose.d.ts +2 -0
- package/build/types-ts3.8/orchestrion/config/mysql.d.ts +2 -0
- package/build/types-ts3.8/orchestrion/config/mysql2.d.ts +2 -0
- package/build/types-ts3.8/orchestrion/config/nestjs.d.ts +1 -0
- package/build/types-ts3.8/orchestrion/config/openai.d.ts +2 -0
- package/build/types-ts3.8/orchestrion/config/pg.d.ts +2 -0
- package/build/types-ts3.8/orchestrion/config/postgres.d.ts +1 -0
- package/build/types-ts3.8/orchestrion/config/redis.d.ts +2 -0
- package/build/types-ts3.8/orchestrion/config/remix.d.ts +1 -0
- package/build/types-ts3.8/orchestrion/config/subscribe-injection.d.ts +31 -0
- package/build/types-ts3.8/orchestrion/config/tedious.d.ts +1 -0
- package/build/types-ts3.8/orchestrion/config/vercel-ai.d.ts +1 -0
- package/build/types-ts3.8/orchestrion/index.d.ts +7 -6
- package/build/types-ts3.8/orchestrion/registerChannelIntegration.d.ts +33 -0
- package/build/types-ts3.8/vercel-ai/index.d.ts +2 -3
- package/package.json +4 -3
- package/build/cjs/orchestrion/config/prisma.js +0 -8
- package/build/cjs/orchestrion/config/prisma.js.map +0 -1
- package/build/cjs/orchestrion/config/react-router.js +0 -8
- package/build/cjs/orchestrion/config/react-router.js.map +0 -1
- package/build/esm/orchestrion/config/prisma.js +0 -5
- package/build/esm/orchestrion/config/prisma.js.map +0 -1
- package/build/esm/orchestrion/config/react-router.js +0 -5
- package/build/esm/orchestrion/config/react-router.js.map +0 -1
- package/build/types/orchestrion/config/prisma.d.ts +0 -4
- package/build/types/orchestrion/config/prisma.d.ts.map +0 -1
- package/build/types/orchestrion/config/react-router.d.ts +0 -4
- package/build/types/orchestrion/config/react-router.d.ts.map +0 -1
- package/build/types-ts3.8/orchestrion/config/prisma.d.ts +0 -4
- package/build/types-ts3.8/orchestrion/config/react-router.d.ts +0 -4
|
@@ -6,11 +6,11 @@ const index = require('../integrations/tracing-channel/aws-sdk/index.js');
|
|
|
6
6
|
const dataloader = require('../integrations/tracing-channel/dataloader.js');
|
|
7
7
|
const genericPool = require('../integrations/tracing-channel/generic-pool.js');
|
|
8
8
|
const googleGenai = require('../integrations/tracing-channel/google-genai.js');
|
|
9
|
-
const index$
|
|
9
|
+
const index$3 = require('../integrations/tracing-channel/graphql/index.js');
|
|
10
10
|
const hapi = require('../integrations/tracing-channel/hapi.js');
|
|
11
11
|
const koa = require('../integrations/tracing-channel/koa.js');
|
|
12
12
|
const ioredis = require('../integrations/tracing-channel/ioredis.js');
|
|
13
|
-
const index$
|
|
13
|
+
const index$4 = require('../integrations/tracing-channel/kafkajs/index.js');
|
|
14
14
|
const knex = require('../integrations/tracing-channel/knex.js');
|
|
15
15
|
const langchain = require('../integrations/tracing-channel/langchain.js');
|
|
16
16
|
const langgraph = require('../integrations/tracing-channel/langgraph.js');
|
|
@@ -25,7 +25,9 @@ const postgresJs = require('../integrations/tracing-channel/postgres-js.js');
|
|
|
25
25
|
const tedious = require('../integrations/tracing-channel/tedious.js');
|
|
26
26
|
const vercelAi = require('../integrations/tracing-channel/vercel-ai.js');
|
|
27
27
|
const index$1 = require('../integrations/tracing-channel/express/index.js');
|
|
28
|
+
const index$2 = require('../integrations/tracing-channel/firebase/index.js');
|
|
28
29
|
const detect = require('./detect.js');
|
|
30
|
+
const registerChannelIntegration = require('./registerChannelIntegration.js');
|
|
29
31
|
const nestjs = require('./config/nestjs.js');
|
|
30
32
|
const remix = require('./config/remix.js');
|
|
31
33
|
const redis = require('../integrations/tracing-channel/redis.js');
|
|
@@ -49,10 +51,11 @@ const channelIntegrations = {
|
|
|
49
51
|
hapiIntegration: hapi.hapiChannelIntegration,
|
|
50
52
|
koaIntegration: koa.koaChannelIntegration,
|
|
51
53
|
expressIntegration: index$1.expressChannelIntegration,
|
|
52
|
-
graphqlIntegration: index$
|
|
53
|
-
kafkajsIntegration: index$
|
|
54
|
+
graphqlIntegration: index$3.graphqlDiagnosticsChannelIntegration,
|
|
55
|
+
kafkajsIntegration: index$4.kafkajsChannelIntegration,
|
|
54
56
|
tediousIntegration: tedious.tediousChannelIntegration,
|
|
55
|
-
awsIntegration: index.awsChannelIntegration
|
|
57
|
+
awsIntegration: index.awsChannelIntegration,
|
|
58
|
+
firebaseIntegration: index$2.firebaseChannelIntegration
|
|
56
59
|
};
|
|
57
60
|
|
|
58
61
|
exports.amqplibChannelIntegration = amqplib.amqplibChannelIntegration;
|
|
@@ -61,11 +64,11 @@ exports.awsChannelIntegration = index.awsChannelIntegration;
|
|
|
61
64
|
exports.dataloaderChannelIntegration = dataloader.dataloaderChannelIntegration;
|
|
62
65
|
exports.genericPoolChannelIntegration = genericPool.genericPoolChannelIntegration;
|
|
63
66
|
exports.googleGenAIChannelIntegration = googleGenai.googleGenAIChannelIntegration;
|
|
64
|
-
exports.graphqlChannelIntegration = index$
|
|
67
|
+
exports.graphqlChannelIntegration = index$3.graphqlChannelIntegration;
|
|
65
68
|
exports.hapiChannelIntegration = hapi.hapiChannelIntegration;
|
|
66
69
|
exports.koaChannelIntegration = koa.koaChannelIntegration;
|
|
67
70
|
exports.ioredisChannelIntegration = ioredis.ioredisChannelIntegration;
|
|
68
|
-
exports.kafkajsChannelIntegration = index$
|
|
71
|
+
exports.kafkajsChannelIntegration = index$4.kafkajsChannelIntegration;
|
|
69
72
|
exports.knexChannelIntegration = knex.knexChannelIntegration;
|
|
70
73
|
exports.langChainChannelIntegration = langchain.langChainChannelIntegration;
|
|
71
74
|
exports.langGraphChannelIntegration = langgraph.langGraphChannelIntegration;
|
|
@@ -80,8 +83,10 @@ exports.postgresJsChannelIntegration = postgresJs.postgresJsChannelIntegration;
|
|
|
80
83
|
exports.tediousChannelIntegration = tedious.tediousChannelIntegration;
|
|
81
84
|
exports.vercelAiChannelIntegration = vercelAi.vercelAiChannelIntegration;
|
|
82
85
|
exports.expressChannelIntegration = index$1.expressChannelIntegration;
|
|
86
|
+
exports.firebaseChannelIntegration = index$2.firebaseChannelIntegration;
|
|
83
87
|
exports.detectOrchestrionSetup = detect.detectOrchestrionSetup;
|
|
84
88
|
exports.isOrchestrionInjected = detect.isOrchestrionInjected;
|
|
89
|
+
exports.registerOrchestrionChannelIntegration = registerChannelIntegration.registerOrchestrionChannelIntegration;
|
|
85
90
|
exports.nestjsChannels = nestjs.nestjsChannels;
|
|
86
91
|
exports.remixChannels = remix.remixChannels;
|
|
87
92
|
exports.redisChannelIntegration = redis.redisChannelIntegration;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/orchestrion/index.ts"],"sourcesContent":["import { amqplibChannelIntegration } from '../integrations/tracing-channel/amqplib';\nimport { anthropicChannelIntegration } from '../integrations/tracing-channel/anthropic';\nimport { awsChannelIntegration } from '../integrations/tracing-channel/aws-sdk';\nimport { dataloaderChannelIntegration } from '../integrations/tracing-channel/dataloader';\nimport { genericPoolChannelIntegration } from '../integrations/tracing-channel/generic-pool';\nimport { googleGenAIChannelIntegration } from '../integrations/tracing-channel/google-genai';\nimport {\n graphqlChannelIntegration,\n graphqlDiagnosticsChannelIntegration,\n} from '../integrations/tracing-channel/graphql';\nimport { hapiChannelIntegration } from '../integrations/tracing-channel/hapi';\nimport { koaChannelIntegration } from '../integrations/tracing-channel/koa';\nimport { ioredisChannelIntegration } from '../integrations/tracing-channel/ioredis';\nimport { kafkajsChannelIntegration } from '../integrations/tracing-channel/kafkajs';\nimport { knexChannelIntegration } from '../integrations/tracing-channel/knex';\nimport { langChainChannelIntegration } from '../integrations/tracing-channel/langchain';\nimport { langGraphChannelIntegration } from '../integrations/tracing-channel/langgraph';\nimport { lruMemoizerChannelIntegration } from '../integrations/tracing-channel/lru-memoizer';\nimport { mongodbChannelIntegration } from '../integrations/tracing-channel/mongodb';\nimport { mongooseChannelIntegration } from '../integrations/tracing-channel/mongoose';\nimport { mysqlChannelIntegration } from '../integrations/tracing-channel/mysql';\nimport { mysql2ChannelIntegration } from '../integrations/tracing-channel/mysql2';\nimport { openaiChannelIntegration } from '../integrations/tracing-channel/openai';\nimport { postgresChannelIntegration } from '../integrations/tracing-channel/postgres';\nimport { postgresJsChannelIntegration } from '../integrations/tracing-channel/postgres-js';\nimport { tediousChannelIntegration } from '../integrations/tracing-channel/tedious';\nimport { vercelAiChannelIntegration } from '../integrations/tracing-channel/vercel-ai';\nimport { expressChannelIntegration } from '../integrations/tracing-channel/express';\n\nexport { detectOrchestrionSetup, isOrchestrionInjected } from './detect';\n// The `@nestjs/*` channel names live here alongside their transform config; the\n// listener that subscribes to them lives in `@sentry/nestjs`, which imports this.\nexport { nestjsChannels } from './config/nestjs';\n// The remix channel names live here alongside their transform config; the\n// listener that subscribes to them lives in `@sentry/remix`, which imports this.\nexport { remixChannels } from './config/remix';\nexport {\n amqplibChannelIntegration,\n anthropicChannelIntegration,\n awsChannelIntegration,\n dataloaderChannelIntegration,\n genericPoolChannelIntegration,\n googleGenAIChannelIntegration,\n graphqlChannelIntegration,\n hapiChannelIntegration,\n koaChannelIntegration,\n ioredisChannelIntegration,\n kafkajsChannelIntegration,\n knexChannelIntegration,\n langChainChannelIntegration,\n langGraphChannelIntegration,\n lruMemoizerChannelIntegration,\n mongodbChannelIntegration,\n mongooseChannelIntegration,\n mysqlChannelIntegration,\n mysql2ChannelIntegration,\n openaiChannelIntegration,\n postgresChannelIntegration,\n postgresJsChannelIntegration,\n tediousChannelIntegration,\n vercelAiChannelIntegration,\n expressChannelIntegration,\n};\nexport type { KoaChannelIntegrationOptions } from '../integrations/tracing-channel/koa';\nexport type { IORedisChannelIntegrationOptions, IORedisResponseHook } from '../integrations/tracing-channel/ioredis';\nexport type { PostgresJsChannelIntegrationOptions } from '../integrations/tracing-channel/postgres-js';\nexport { redisChannelIntegration } from '../integrations/tracing-channel/redis';\nexport type { RedisChannelIntegrationOptions, RedisResponseHook } from '../integrations/tracing-channel/redis';\nexport type { InstrumentationConfig, CustomTransform } from '@apm-js-collab/code-transformer-bundler-plugins/core';\n\n// The structural `graphql` package types are the single source of truth shared with `@sentry/node`'s\n// vendored OTel graphql instrumentation (re-exported from here so the two can't drift).\nexport type * from '../integrations/tracing-channel/graphql/graphql-types';\n\n/**\n * The canonical set of orchestrion diagnostics-channel integrations, keyed by their public\n * (OTel-parity) factory name.\n *\n * Single source of truth: add a new channel integration here and every consumer — the `@sentry/node`\n * opt-in helper (`experimentalUseDiagnosticsChannelInjection`) and its public\n * `diagnosticsChannelInjectionIntegrations()` map — picks it up automatically, so there's no separate\n * list to keep in sync.\n *\n * NOTE: `ioredisChannelIntegration` and `redisChannelIntegration` are intentionally NOT here. They\n * only partially replace the composite OTel `Redis` integration and need the node SDK's redis cache\n * `responseHook` (which can't live in `server-utils`), so `@sentry/node` wires them up separately.\n *\n * Framework SDKs that own their own channel listener (e.g. `@sentry/nestjs`'s `Nest`) are NOT here\n * either: their transform config is still in `SENTRY_INSTRUMENTATIONS`, but the listener lives in\n * their package and picks the channel-vs-OTel path itself at `setupOnce`, so it needs no central swap.\n *\n * NOTE: `dataloaderChannelIntegration` is also NOT here. Everything in this map is auto-appended to\n * the default integrations, but the OTel `Dataloader` integration is opt-in (never a default). Like\n * `@sentry/nestjs`'s `Nest`, its `@sentry/node` factory picks the channel-vs-OTel path itself at\n * `setupOnce` (via `isOrchestrionInjected()`), so there's nothing for the central swap to do.\n */\nexport const channelIntegrations = {\n postgresIntegration: postgresChannelIntegration,\n postgresJsIntegration: postgresJsChannelIntegration,\n mongoIntegration: mongodbChannelIntegration,\n mysqlIntegration: mysqlChannelIntegration,\n mysql2Integration: mysql2ChannelIntegration,\n genericPoolIntegration: genericPoolChannelIntegration,\n mongooseIntegration: mongooseChannelIntegration,\n lruMemoizerIntegration: lruMemoizerChannelIntegration,\n openaiIntegration: openaiChannelIntegration,\n anthropicIntegration: anthropicChannelIntegration,\n googleGenAIIntegration: googleGenAIChannelIntegration,\n langChainIntegration: langChainChannelIntegration,\n langGraphIntegration: langGraphChannelIntegration,\n vercelAiIntegration: vercelAiChannelIntegration,\n amqplibIntegration: amqplibChannelIntegration,\n hapiIntegration: hapiChannelIntegration,\n koaIntegration: koaChannelIntegration,\n expressIntegration: expressChannelIntegration,\n graphqlIntegration: graphqlDiagnosticsChannelIntegration,\n kafkajsIntegration: kafkajsChannelIntegration,\n tediousIntegration: tediousChannelIntegration,\n awsIntegration: awsChannelIntegration,\n} as const;\n"],"names":["postgresChannelIntegration","postgresJsChannelIntegration","mongodbChannelIntegration","mysqlChannelIntegration","mysql2ChannelIntegration","genericPoolChannelIntegration","mongooseChannelIntegration","lruMemoizerChannelIntegration","openaiChannelIntegration","anthropicChannelIntegration","googleGenAIChannelIntegration","langChainChannelIntegration","langGraphChannelIntegration","vercelAiChannelIntegration","amqplibChannelIntegration","hapiChannelIntegration","koaChannelIntegration","expressChannelIntegration","graphqlDiagnosticsChannelIntegration","kafkajsChannelIntegration","tediousChannelIntegration","awsChannelIntegration"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/orchestrion/index.ts"],"sourcesContent":["import { amqplibChannelIntegration } from '../integrations/tracing-channel/amqplib';\nimport { anthropicChannelIntegration } from '../integrations/tracing-channel/anthropic';\nimport { awsChannelIntegration } from '../integrations/tracing-channel/aws-sdk';\nimport { dataloaderChannelIntegration } from '../integrations/tracing-channel/dataloader';\nimport { genericPoolChannelIntegration } from '../integrations/tracing-channel/generic-pool';\nimport { googleGenAIChannelIntegration } from '../integrations/tracing-channel/google-genai';\nimport {\n graphqlChannelIntegration,\n graphqlDiagnosticsChannelIntegration,\n} from '../integrations/tracing-channel/graphql';\nimport { hapiChannelIntegration } from '../integrations/tracing-channel/hapi';\nimport { koaChannelIntegration } from '../integrations/tracing-channel/koa';\nimport { ioredisChannelIntegration } from '../integrations/tracing-channel/ioredis';\nimport { kafkajsChannelIntegration } from '../integrations/tracing-channel/kafkajs';\nimport { knexChannelIntegration } from '../integrations/tracing-channel/knex';\nimport { langChainChannelIntegration } from '../integrations/tracing-channel/langchain';\nimport { langGraphChannelIntegration } from '../integrations/tracing-channel/langgraph';\nimport { lruMemoizerChannelIntegration } from '../integrations/tracing-channel/lru-memoizer';\nimport { mongodbChannelIntegration } from '../integrations/tracing-channel/mongodb';\nimport { mongooseChannelIntegration } from '../integrations/tracing-channel/mongoose';\nimport { mysqlChannelIntegration } from '../integrations/tracing-channel/mysql';\nimport { mysql2ChannelIntegration } from '../integrations/tracing-channel/mysql2';\nimport { openaiChannelIntegration } from '../integrations/tracing-channel/openai';\nimport { postgresChannelIntegration } from '../integrations/tracing-channel/postgres';\nimport { postgresJsChannelIntegration } from '../integrations/tracing-channel/postgres-js';\nimport { tediousChannelIntegration } from '../integrations/tracing-channel/tedious';\nimport { vercelAiChannelIntegration } from '../integrations/tracing-channel/vercel-ai';\nimport { expressChannelIntegration } from '../integrations/tracing-channel/express';\nimport { firebaseChannelIntegration } from '../integrations/tracing-channel/firebase';\n\nexport { detectOrchestrionSetup, isOrchestrionInjected } from './detect';\n// The runtime target of the subscribe-injection snippet: instrumented modules\n// import this to self-register their channel subscriber on the global marker\n// (used by bundler-only SDKs).\nexport { registerOrchestrionChannelIntegration } from './registerChannelIntegration';\n// The `@nestjs/*` channel names live here alongside their transform config; the\n// listener that subscribes to them lives in `@sentry/nestjs`, which imports this.\nexport { nestjsChannels } from './config/nestjs';\n// The remix channel names live here alongside their transform config; the\n// listener that subscribes to them lives in `@sentry/remix`, which imports this.\nexport { remixChannels } from './config/remix';\nexport {\n amqplibChannelIntegration,\n anthropicChannelIntegration,\n awsChannelIntegration,\n dataloaderChannelIntegration,\n genericPoolChannelIntegration,\n googleGenAIChannelIntegration,\n graphqlChannelIntegration,\n hapiChannelIntegration,\n koaChannelIntegration,\n ioredisChannelIntegration,\n kafkajsChannelIntegration,\n knexChannelIntegration,\n langChainChannelIntegration,\n langGraphChannelIntegration,\n lruMemoizerChannelIntegration,\n mongodbChannelIntegration,\n mongooseChannelIntegration,\n mysqlChannelIntegration,\n mysql2ChannelIntegration,\n openaiChannelIntegration,\n postgresChannelIntegration,\n postgresJsChannelIntegration,\n tediousChannelIntegration,\n vercelAiChannelIntegration,\n expressChannelIntegration,\n firebaseChannelIntegration,\n};\nexport type { KoaChannelIntegrationOptions } from '../integrations/tracing-channel/koa';\nexport type { IORedisChannelIntegrationOptions, IORedisResponseHook } from '../integrations/tracing-channel/ioredis';\nexport type { PostgresJsChannelIntegrationOptions } from '../integrations/tracing-channel/postgres-js';\nexport { redisChannelIntegration } from '../integrations/tracing-channel/redis';\nexport type { RedisChannelIntegrationOptions, RedisResponseHook } from '../integrations/tracing-channel/redis';\nexport type { InstrumentationConfig, CustomTransform } from '@apm-js-collab/code-transformer-bundler-plugins/core';\n\n// The structural `graphql` package types are the single source of truth shared with `@sentry/node`'s\n// vendored OTel graphql instrumentation (re-exported from here so the two can't drift).\nexport type * from '../integrations/tracing-channel/graphql/graphql-types';\n\n/**\n * The canonical set of orchestrion diagnostics-channel integrations, keyed by their public\n * (OTel-parity) factory name.\n *\n * Single source of truth: add a new channel integration here and every consumer — the `@sentry/node`\n * opt-in helper (`experimentalUseDiagnosticsChannelInjection`) and its public\n * `diagnosticsChannelInjectionIntegrations()` map — picks it up automatically, so there's no separate\n * list to keep in sync.\n *\n * NOTE: `ioredisChannelIntegration` and `redisChannelIntegration` are intentionally NOT here. They\n * only partially replace the composite OTel `Redis` integration and need the node SDK's redis cache\n * `responseHook` (which can't live in `server-utils`), so `@sentry/node` wires them up separately.\n *\n * Framework SDKs that own their own channel listener (e.g. `@sentry/nestjs`'s `Nest`) are NOT here\n * either: their transform config is still in `SENTRY_INSTRUMENTATIONS`, but the listener lives in\n * their package and picks the channel-vs-OTel path itself at `setupOnce`, so it needs no central swap.\n *\n * NOTE: `dataloaderChannelIntegration` is also NOT here. Everything in this map is auto-appended to\n * the default integrations, but the OTel `Dataloader` integration is opt-in (never a default). Like\n * `@sentry/nestjs`'s `Nest`, its `@sentry/node` factory picks the channel-vs-OTel path itself at\n * `setupOnce` (via `isOrchestrionInjected()`), so there's nothing for the central swap to do.\n */\nexport const channelIntegrations = {\n postgresIntegration: postgresChannelIntegration,\n postgresJsIntegration: postgresJsChannelIntegration,\n mongoIntegration: mongodbChannelIntegration,\n mysqlIntegration: mysqlChannelIntegration,\n mysql2Integration: mysql2ChannelIntegration,\n genericPoolIntegration: genericPoolChannelIntegration,\n mongooseIntegration: mongooseChannelIntegration,\n lruMemoizerIntegration: lruMemoizerChannelIntegration,\n openaiIntegration: openaiChannelIntegration,\n anthropicIntegration: anthropicChannelIntegration,\n googleGenAIIntegration: googleGenAIChannelIntegration,\n langChainIntegration: langChainChannelIntegration,\n langGraphIntegration: langGraphChannelIntegration,\n vercelAiIntegration: vercelAiChannelIntegration,\n amqplibIntegration: amqplibChannelIntegration,\n hapiIntegration: hapiChannelIntegration,\n koaIntegration: koaChannelIntegration,\n expressIntegration: expressChannelIntegration,\n graphqlIntegration: graphqlDiagnosticsChannelIntegration,\n kafkajsIntegration: kafkajsChannelIntegration,\n tediousIntegration: tediousChannelIntegration,\n awsIntegration: awsChannelIntegration,\n firebaseIntegration: firebaseChannelIntegration,\n} as const;\n"],"names":["postgresChannelIntegration","postgresJsChannelIntegration","mongodbChannelIntegration","mysqlChannelIntegration","mysql2ChannelIntegration","genericPoolChannelIntegration","mongooseChannelIntegration","lruMemoizerChannelIntegration","openaiChannelIntegration","anthropicChannelIntegration","googleGenAIChannelIntegration","langChainChannelIntegration","langGraphChannelIntegration","vercelAiChannelIntegration","amqplibChannelIntegration","hapiChannelIntegration","koaChannelIntegration","expressChannelIntegration","graphqlDiagnosticsChannelIntegration","kafkajsChannelIntegration","tediousChannelIntegration","awsChannelIntegration","firebaseChannelIntegration"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsGO,MAAM,mBAAA,GAAsB;AAAA,EACjC,mBAAA,EAAqBA,mCAAA;AAAA,EACrB,qBAAA,EAAuBC,uCAAA;AAAA,EACvB,gBAAA,EAAkBC,iCAAA;AAAA,EAClB,gBAAA,EAAkBC,6BAAA;AAAA,EAClB,iBAAA,EAAmBC,+BAAA;AAAA,EACnB,sBAAA,EAAwBC,yCAAA;AAAA,EACxB,mBAAA,EAAqBC,mCAAA;AAAA,EACrB,sBAAA,EAAwBC,yCAAA;AAAA,EACxB,iBAAA,EAAmBC,+BAAA;AAAA,EACnB,oBAAA,EAAsBC,qCAAA;AAAA,EACtB,sBAAA,EAAwBC,yCAAA;AAAA,EACxB,oBAAA,EAAsBC,qCAAA;AAAA,EACtB,oBAAA,EAAsBC,qCAAA;AAAA,EACtB,mBAAA,EAAqBC,mCAAA;AAAA,EACrB,kBAAA,EAAoBC,iCAAA;AAAA,EACpB,eAAA,EAAiBC,2BAAA;AAAA,EACjB,cAAA,EAAgBC,yBAAA;AAAA,EAChB,kBAAA,EAAoBC,iCAAA;AAAA,EACpB,kBAAA,EAAoBC,4CAAA;AAAA,EACpB,kBAAA,EAAoBC,iCAAA;AAAA,EACpB,kBAAA,EAAoBC,iCAAA;AAAA,EACpB,cAAA,EAAgBC,2BAAA;AAAA,EAChB,mBAAA,EAAqBC;AACvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const core = require('@sentry/core');
|
|
4
|
+
|
|
5
|
+
function registerOrchestrionChannelIntegration(name, integrationFn) {
|
|
6
|
+
var _a;
|
|
7
|
+
const marker = (_a = core.GLOBAL_OBJ).__SENTRY_ORCHESTRION__ ?? (_a.__SENTRY_ORCHESTRION__ = {});
|
|
8
|
+
(marker.integrations ?? (marker.integrations = /* @__PURE__ */ new Map())).set(name, integrationFn);
|
|
9
|
+
core.getClient()?.addIntegration(integrationFn());
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
exports.registerOrchestrionChannelIntegration = registerOrchestrionChannelIntegration;
|
|
13
|
+
//# sourceMappingURL=registerChannelIntegration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerChannelIntegration.js","sources":["../../../src/orchestrion/registerChannelIntegration.ts"],"sourcesContent":["import type { Integration } from '@sentry/core';\nimport { getClient, GLOBAL_OBJ } from '@sentry/core';\n\n/**\n * Register an orchestrion channel-subscriber integration from an instrumented\n * module. This is the runtime target of the snippet the subscribe-injection\n * transform splices into each transformed package (see\n * `bundler/subscribeInjection.ts`), so a bundler-only SDK (e.g.\n * `@sentry/cloudflare`, running in workerd where requires can't be\n * monkey-patched) wires up subscribers with no runtime module hook.\n *\n * It does two things, covering the two disjoint timing cases:\n *\n * 1. Stores the factory on the global orchestrion marker under `name`, so a\n * later `init()` (a fresh isolate, or a client created after this module\n * loads) picks it up via `getDefaultIntegrations()`.\n * 2. If a client already exists, registers the integration on it right away.\n * This is what makes the mechanism robust against module load order:\n * bundler-only SDKs call `init()` per request, but a package like `mysql`\n * loads its instrumented file lazily on first use, i.e. AFTER that request's\n * `init()` already snapshotted the marker. Without the live add, the first\n * request that touches such a package would publish to a channel nobody\n * subscribed to yet.\n *\n * `addIntegration` dedupes by integration name and only runs `setupOnce` once,\n * so storing AND live-adding never double-subscribes.\n *\n * The marker is a `Map` keyed by `name` (the factory's export name) so a package\n * split across several instrumented files (e.g. `pg`'s JS and native clients, or\n * openai's per-resource `.js`/`.mjs` files) registers its one subscriber once,\n * no matter how many of its files land in the bundle. `.set` on the shared key\n * is idempotent.\n */\nexport function registerOrchestrionChannelIntegration(name: string, integrationFn: () => Integration): void {\n const marker = (GLOBAL_OBJ.__SENTRY_ORCHESTRION__ ??= {});\n (marker.integrations ??= new Map()).set(name, integrationFn);\n getClient()?.addIntegration(integrationFn());\n}\n"],"names":["GLOBAL_OBJ","getClient"],"mappings":";;;;AAiCO,SAAS,qCAAA,CAAsC,MAAc,aAAA,EAAwC;AAjC5G,EAAA,IAAA,EAAA;AAkCE,EAAA,MAAM,MAAA,GAAA,CAAU,EAAA,GAAAA,eAAA,EAAW,sBAAA,KAAX,EAAA,CAAW,yBAA2B,EAAC,CAAA;AACvD,EAAA,CAAC,MAAA,CAAO,iBAAP,MAAA,CAAO,YAAA,uBAAqB,GAAA,EAAI,CAAA,EAAG,GAAA,CAAI,IAAA,EAAM,aAAa,CAAA;AAC3D,EAAAC,cAAA,EAAU,EAAG,cAAA,CAAe,aAAA,EAAe,CAAA;AAC7C;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/vercel-ai/index.ts"],"sourcesContent":["import { defineIntegration, waitForTracingChannelBinding, type IntegrationFn } from '@sentry/core';\nimport { subscribeVercelAiTracingChannel } from './vercel-ai-dc-subscriber';\nimport * as dc from 'node:diagnostics_channel';\n\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/vercel-ai/index.ts"],"sourcesContent":["import { defineIntegration, waitForTracingChannelBinding, type IntegrationFn } from '@sentry/core';\nimport { subscribeVercelAiTracingChannel } from './vercel-ai-dc-subscriber';\nimport * as dc from 'node:diagnostics_channel';\n\nexport interface VercelAiOptions {\n /**\n * Enable or disable input recording. Enabled if `dataCollection.genAI.inputs` (or the deprecated `sendDefaultPii` option) is `true`\n * or if you set `isEnabled` to `true` in your ai SDK method telemetry settings.\n * Integration-level options take precedence over global `dataCollection` config.\n */\n recordInputs?: boolean;\n\n /**\n * Enable or disable output recording. Enabled if `dataCollection.genAI.outputs` (or the deprecated `sendDefaultPii` option) is `true`\n * or if you set `isEnabled` to `true` in your ai SDK method telemetry settings.\n * Integration-level options take precedence over global `dataCollection` config.\n */\n recordOutputs?: boolean;\n\n /**\n * Enable or disable truncation of recorded input messages.\n * Defaults to `true`.\n */\n enableTruncation?: boolean;\n}\n\nconst _vercelAiIntegration = ((options: VercelAiOptions = {}) => {\n return {\n name: 'VercelAI' as const,\n setupOnce() {\n // Bail if this is not available\n if (!dc.tracingChannel) {\n return;\n }\n\n // Subscribe to the `ai` SDK's native telemetry tracing channel (ai >= 7).\n // This is a no-op on versions that don't publish to the channel, so it is always safe to call.\n waitForTracingChannelBinding(() => {\n subscribeVercelAiTracingChannel(dc.tracingChannel, options);\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Auto-instrument the `ai` SDK's native telemetry tracing channel (ai >= 7).\n */\nexport const vercelAiIntegration = defineIntegration(_vercelAiIntegration);\n"],"names":["dc","waitForTracingChannelBinding","subscribeVercelAiTracingChannel","defineIntegration"],"mappings":";;;;;;AA0BA,MAAM,oBAAA,IAAwB,CAAC,OAAA,GAA2B,EAAC,KAAM;AAC/D,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,UAAA;AAAA,IACN,SAAA,GAAY;AAEV,MAAA,IAAI,CAACA,mBAAG,cAAA,EAAgB;AACtB,QAAA;AAAA,MACF;AAIA,MAAAC,iCAAA,CAA6B,MAAM;AACjC,QAAAC,oDAAA,CAAgCF,kBAAA,CAAG,gBAAgB,OAAO,CAAA;AAAA,MAC5D,CAAC,CAAA;AAAA,IACH;AAAA,GACF;AACF,CAAA,CAAA;AAKO,MAAM,mBAAA,GAAsBG,uBAAkB,oBAAoB;;;;"}
|
|
@@ -13,6 +13,7 @@ const GEN_AI_TOOL_DESCRIPTION_ATTRIBUTE = "gen_ai.tool.description";
|
|
|
13
13
|
const GEN_AI_EMBEDDINGS_OPERATION = "embeddings";
|
|
14
14
|
const GEN_AI_RERANK_OPERATION = "rerank";
|
|
15
15
|
const GEN_AI_GENERATE_CONTENT_OPERATION = "generate_content";
|
|
16
|
+
const WORKERS_AI_INTEGRATION_NAME = "WorkersAI";
|
|
16
17
|
const VERCEL_AI_OPERATION_ID_ATTRIBUTE = "vercel.ai.operationId";
|
|
17
18
|
const VERCEL_AI_MODEL_PROVIDER_ATTRIBUTE = "vercel.ai.model.provider";
|
|
18
19
|
const VERCEL_AI_SETTINGS_MAX_RETRIES_ATTRIBUTE = "vercel.ai.settings.maxRetries";
|
|
@@ -186,6 +187,7 @@ function createSpanFromMessage(data, channelOptions) {
|
|
|
186
187
|
case "generateObject":
|
|
187
188
|
return buildInvokeAgentSpan(event, baseAttributes, recordInputs, enableTruncation, callId, type === "streamText");
|
|
188
189
|
case "languageModelCall":
|
|
190
|
+
core._INTERNAL_skipAiProviderWrapping([WORKERS_AI_INTEGRATION_NAME]);
|
|
189
191
|
return buildModelCallSpan(event, baseAttributes, recordInputs, enableTruncation, callId, modelId);
|
|
190
192
|
case "executeTool":
|
|
191
193
|
return buildToolSpan(event, recordInputs);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vercel-ai-dc-subscriber.js","sources":["../../../src/vercel-ai/vercel-ai-dc-subscriber.ts"],"sourcesContent":["/* eslint-disable max-lines */\n// `@sentry/conventions` marks several gen_ai attributes (e.g. `GEN_AI_SYSTEM`, `GEN_AI_TOOL_*`,\n// `GEN_AI_REQUEST_AVAILABLE_TOOLS`) as deprecated in favour of newer semconv names. We intentionally\n// keep emitting the current names so these spans match the OTel-based (v6) integration and what the\n// Sentry product consumes today; migrating to the new names is a separate, coordinated change.\n/* eslint-disable typescript-eslint/no-deprecated */\nimport {\n GEN_AI_EMBEDDINGS_INPUT,\n GEN_AI_FUNCTION_ID,\n GEN_AI_INPUT_MESSAGES,\n GEN_AI_OPERATION_NAME,\n GEN_AI_OUTPUT_MESSAGES,\n GEN_AI_REQUEST_AVAILABLE_TOOLS,\n GEN_AI_REQUEST_MODEL,\n GEN_AI_RESPONSE_FINISH_REASONS,\n GEN_AI_RESPONSE_ID,\n GEN_AI_RESPONSE_MODEL,\n GEN_AI_RESPONSE_STREAMING,\n GEN_AI_SYSTEM,\n GEN_AI_TOOL_INPUT,\n GEN_AI_TOOL_NAME,\n GEN_AI_TOOL_OUTPUT,\n GEN_AI_TOOL_TYPE,\n GEN_AI_USAGE_INPUT_TOKENS,\n GEN_AI_USAGE_OUTPUT_TOKENS,\n GEN_AI_USAGE_TOTAL_TOKENS,\n} from '@sentry/conventions/attributes';\nimport { GEN_AI_EXECUTE_TOOL_SPAN_OP, GEN_AI_INVOKE_AGENT_SPAN_OP } from '@sentry/conventions/op';\nimport type { Span, SpanAttributes } from '@sentry/core';\nimport {\n captureException,\n GEN_AI_CONVERSATION_ID_ATTRIBUTE,\n GEN_AI_INPUT_MESSAGES_ORIGINAL_LENGTH_ATTRIBUTE,\n GEN_AI_SYSTEM_INSTRUCTIONS_ATTRIBUTE,\n getClient,\n getProviderMetadataAttributes,\n getTruncatedJsonString,\n isObjectLike,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n shouldEnableTruncation,\n SPAN_STATUS_ERROR,\n spanToJSON,\n spanToTraceContext,\n startInactiveSpan,\n stringify,\n withScope,\n} from '@sentry/core';\nimport type { TracingChannel } from 'node:diagnostics_channel';\nimport { bindTracingChannelToSpan } from '../tracing-channel';\nimport { asNumber, asString, isReadableStream, type StreamedModelCallResult, sum, tapModelCallStream } from './util';\n\n/**\n * The single tracing channel the `ai` package (>= 7) publishes all telemetry lifecycle events to\n * via `node:diagnostics_channel`. Events are discriminated by their `type` field.\n * @see https://github.com/vercel/ai/pull/15660\n */\nconst AI_SDK_TELEMETRY_TRACING_CHANNEL = 'ai:telemetry';\n\nconst ORIGIN = 'auto.vercelai.channel';\n\n// `@sentry/conventions` does not expose these yet, so we keep the literals here.\nconst GEN_AI_TOOL_CALL_ID_ATTRIBUTE = 'gen_ai.tool.call.id';\nconst GEN_AI_TOOL_DESCRIPTION_ATTRIBUTE = 'gen_ai.tool.description';\nconst GEN_AI_EMBEDDINGS_OPERATION = 'embeddings';\nconst GEN_AI_RERANK_OPERATION = 'rerank';\n// The model-call op matches the Vercel AI OTel integration (`gen_ai.generate_content`) rather than\n// the generic `gen_ai.chat`, so v6 (OTel) and v7 (channel) produce the same spans.\nconst GEN_AI_GENERATE_CONTENT_OPERATION = 'generate_content';\n\n// Subset of the `vercel.ai.*` passthrough attributes the OTel integration emits that we reproduce.\nconst VERCEL_AI_OPERATION_ID_ATTRIBUTE = 'vercel.ai.operationId';\nconst VERCEL_AI_MODEL_PROVIDER_ATTRIBUTE = 'vercel.ai.model.provider';\nconst VERCEL_AI_SETTINGS_MAX_RETRIES_ATTRIBUTE = 'vercel.ai.settings.maxRetries';\n\n// Tracks the top-level operationId (and whether it streams) per `callId` so a model-call span can\n// name its `doGenerate`/`doStream` operation the same way the OTel integration does. `isStream` is\n// the authoritative event-type signal rather than a substring check on the (possibly custom)\n// operationId. Cleared when the top-level span ends.\nconst operationIdByCallId = new Map<string, { operationId: string; isStream: boolean }>();\n\n// Per-operation map of tool name → description, harvested from a model-call /\n// top-level event's `tools` (keyed by the shared `callId`). The AI SDK's\n// `executeTool` event doesn't carry the tool's description, so we backfill it\n// onto the tool span here — without relying on the OTel `vercelAiEventProcessor`\n// (which isn't registered in channel/orchestrion mode). Cleared with the\n// operation. Only populated when inputs are recorded, matching the OTel path\n// (which sources descriptions from the recorded `available_tools`).\nconst toolDescriptionsByCallId = new Map<string, Map<string, string>>();\n\n// A streamed `streamText` operation's own channel result is always `undefined` (the SDK exposes the\n// stream only on the model call), so its `invoke_agent` span can't be enriched from the channel. We\n// key the span by `callId` and enrich it as each streamed model call drains — the model calls flush\n// before the operation's own span ends. The running token sum lives on the span's own attributes.\nconst invokeAgentSpanByCallId = new Map<string, Span>();\n\n// Only top-level operations own the `callId` → operationId mapping; `step`/`languageModelCall`/\n// `executeTool` share the parent's `callId`, so they must not clear it.\nconst ROOT_OPERATION_TYPES = new Set<ChannelEventType>([\n 'generateText',\n 'streamText',\n 'generateObject',\n 'embed',\n 'embedMany',\n 'rerank',\n]);\n\n/** Drop the per-operation `callId` maps once the owning top-level operation settles (success or error). */\nexport function clearOperationId(data: VercelAiChannelMessage): void {\n if (!ROOT_OPERATION_TYPES.has(data.type)) {\n return;\n }\n const callId = asString(data.event.callId);\n if (callId) {\n clearOperationCallId(callId);\n }\n}\n\n/**\n * Drop the per-operation `callId` maps for a single id. The v6 orchestrion adapter uses this to clear a\n * `streamText` operation only after its lazily-run model call settles — the operation's own span ends\n * synchronously (when `streamText` returns) but the model call runs later as the stream is consumed, and\n * it still needs the operation's `operationId`/`isStream` entry to name itself `ai.streamText.doStream`.\n */\nexport function clearOperationCallId(callId: string): void {\n operationIdByCallId.delete(callId);\n toolDescriptionsByCallId.delete(callId);\n invokeAgentSpanByCallId.delete(callId);\n}\n\n/** Record tool name → description from an event's `tools`, so tool spans can backfill the description. */\nfunction recordToolDescriptions(callId: string | undefined, tools: unknown): void {\n if (!callId || !Array.isArray(tools)) {\n return;\n }\n let descriptions = toolDescriptionsByCallId.get(callId);\n for (const tool of tools) {\n if (isObjectLike(tool) && typeof tool.name === 'string' && typeof tool.description === 'string') {\n descriptions = descriptions ?? new Map();\n if (!descriptions.has(tool.name)) {\n descriptions.set(tool.name, tool.description);\n }\n }\n }\n if (descriptions) {\n toolDescriptionsByCallId.set(callId, descriptions);\n }\n}\n\n/**\n * Resolve a tool's description, preferring the per-operation map (populated from the model-call /\n * top-level event's `tools`, v7) and falling back to a `tools` collection on the event itself —\n * which may be an array of `{ name, description }` or a record keyed by tool name (v6).\n */\nfunction resolveToolDescription(callId: string | undefined, toolName: string, tools: unknown): string | undefined {\n const fromMap = callId ? toolDescriptionsByCallId.get(callId)?.get(toolName) : undefined;\n if (fromMap) {\n return fromMap;\n }\n if (Array.isArray(tools)) {\n const match = tools.find(tool => isObjectLike(tool) && tool.name === toolName);\n return isObjectLike(match) ? asString(match.description) : undefined;\n }\n if (isObjectLike(tools)) {\n const tool = tools[toolName];\n return isObjectLike(tool) ? asString(tool.description) : undefined;\n }\n return undefined;\n}\n\n/** The lifecycle event types the `ai:telemetry` channel can carry. */\nexport type ChannelEventType =\n | 'generateText'\n | 'streamText'\n | 'generateObject'\n | 'step'\n | 'languageModelCall'\n | 'executeTool'\n | 'embed'\n | 'embedMany'\n | 'rerank';\n\n/**\n * The context object the AI SDK passes through one tracing-channel call. It is the same object\n * identity across `start`/`end`/`asyncEnd`/`error`, and Node's `tracingChannel` attaches\n * `result`/`error` to it as the traced promise settles.\n */\nexport interface VercelAiChannelMessage {\n type: ChannelEventType;\n event: Record<string, unknown>;\n result?: unknown;\n error?: unknown;\n}\n\n/**\n * Platform-provided factory that returns a tracing channel for the given channel name. The factory\n * is responsible for, when `start` fires, calling `transformStart(data)` and storing the returned\n * span on `data._sentrySpan` so the subscriber's `asyncEnd`/`error` handlers can read it.\n *\n * Node passes `@sentry/opentelemetry/tracing-channel`, which uses `bindStore` to additionally make\n * the span the active OTel context for the duration of the traced operation. That is what makes\n * nested AI SDK operations (model calls, tool calls) become children of the enclosing span without\n * any manual parent bookkeeping here.\n */\nexport type VercelAiTracingChannelFactory = <T extends object>(name: string) => TracingChannel<T, T>;\n\n/** Integration-level recording options, pinned at subscribe time so we never look the integration up per event. */\nexport interface VercelAiChannelOptions {\n recordInputs?: boolean;\n recordOutputs?: boolean;\n enableTruncation?: boolean;\n}\n\n/**\n * Subscribe Sentry span handlers to the `ai` SDK's native telemetry tracing channel (`ai:telemetry`,\n * available in `ai` >= 7) and emit fully-formed `gen_ai.*` spans directly — no OpenTelemetry span\n * post-processing involved.\n *\n * The integration passes its options in directly (rather than us looking the integration up on every\n * event); the global `dataCollection.genAI` default is still read from the client per event.\n *\n * Safe to always call: on `ai` versions that don't publish to the channel (e.g. < 7) nothing is\n * ever emitted and this is inert, so there is no double-instrumentation against the OTel-based\n * patcher. The integration's `setupOnce` guarantees this runs a single time.\n */\nexport function subscribeVercelAiTracingChannel(\n tracingChannel: VercelAiTracingChannelFactory,\n options: VercelAiChannelOptions = {},\n): void {\n bindTracingChannelToSpan(\n tracingChannel<VercelAiChannelMessage>(AI_SDK_TELEMETRY_TRACING_CHANNEL),\n data => createSpanFromMessage(data, options),\n {\n // The helper ends the span; we enrich it from the settled result first (tokens, output messages,\n // finish reasons, response model/id, provider metadata) and drop the per-operation `callId` maps.\n beforeSpanEnd: (span, data) => {\n enrichSpanOnEnd(span, data, options);\n clearOperationId(data);\n },\n // A streamed model call resolves before its stream is drained, so we tap the stream, keep the\n // span open, and end it (via `end`) once the final usage/finish/output chunks arrive.\n deferSpanEnd: ({ data, end }) => deferStreamedModelCallEnd(data, options, end),\n },\n );\n}\n\n/**\n * When a `languageModelCall` resolves to a live `ReadableStream`, defer ending its span: swap in a\n * passthrough that forwards chunks to the SDK untouched while aggregating usage/finish/output, then\n * enrich and end the span once the stream settles. Returns `false` for anything that isn't a streamed\n * model call so the helper ends the span as usual.\n */\nfunction deferStreamedModelCallEnd(\n data: VercelAiChannelMessage,\n options: VercelAiChannelOptions,\n end: (error?: unknown) => void,\n): boolean {\n if (data.type !== 'languageModelCall' || !isObjectLike(data.result)) {\n return false;\n }\n const result = data.result;\n const stream = result.stream;\n if (!isReadableStream(stream)) {\n return false;\n }\n\n const callId = asString(data.event.callId);\n const { recordOutputs } = getRecordingOptions(data.event, options);\n result.stream = tapModelCallStream(\n stream,\n final => {\n // Reshape the aggregate into the result `enrichSpanOnEnd` expects, then let `end` run it (it calls\n // `beforeSpanEnd`). Enriching the model-call span and the parent from the same aggregate keeps\n // streamed and non-streamed spans identical.\n data.result = { ...result, ...streamedResultToChannelResult(final) };\n end();\n enrichInvokeAgentFromStream(callId, final, recordOutputs);\n },\n error => end(error),\n );\n\n return true;\n}\n\n/** Map the tapped stream aggregate onto the `languageModelCall` result shape `enrichSpanOnEnd` reads. */\nexport function streamedResultToChannelResult(final: StreamedModelCallResult): Record<string, unknown> {\n const content: Array<Record<string, unknown>> = [];\n if (final.text) {\n content.push({ type: 'text', text: final.text });\n }\n for (const toolCall of final.toolCalls) {\n content.push({ type: 'tool-call', ...toolCall });\n }\n\n return {\n content,\n ...(final.usage !== undefined ? { usage: final.usage } : {}),\n ...(final.finishReason !== undefined ? { finishReason: final.finishReason } : {}),\n ...(final.providerMetadata !== undefined ? { providerMetadata: final.providerMetadata } : {}),\n ...(final.responseId || final.responseModel\n ? {\n response: {\n ...(final.responseId ? { id: final.responseId } : {}),\n ...(final.responseModel ? { modelId: final.responseModel } : {}),\n },\n }\n : {}),\n };\n}\n\n/**\n * Propagate a streamed model call's usage (summed across the operation's model calls) and output onto\n * the enclosing `invoke_agent` span, which has no channel result of its own. Runs before that span ends\n * because the operation's completion promise settles only after every model-call stream has drained.\n */\nfunction enrichInvokeAgentFromStream(\n callId: string | undefined,\n final: StreamedModelCallResult,\n recordOutputs: boolean,\n): void {\n const span = callId ? invokeAgentSpanByCallId.get(callId) : undefined;\n if (!span) {\n return;\n }\n\n const usage = isObjectLike(final.usage) ? final.usage : undefined;\n if (usage) {\n const input = tokenCount(usage.inputTokens) ?? tokenCount(usage.promptTokens) ?? tokenCount(usage.tokens);\n const output = tokenCount(usage.outputTokens) ?? tokenCount(usage.completionTokens);\n addTokensToSpan(span, GEN_AI_USAGE_INPUT_TOKENS, input);\n addTokensToSpan(span, GEN_AI_USAGE_OUTPUT_TOKENS, output);\n addTokensToSpan(span, GEN_AI_USAGE_TOTAL_TOKENS, tokenCount(usage.totalTokens) ?? sum(input, output));\n }\n\n if (recordOutputs) {\n const parts = partsFromTextAndToolCalls(final.text, final.toolCalls);\n const outputMessages = buildOutputMessages(parts, getFinishReason({ finishReason: final.finishReason }));\n if (outputMessages) {\n span.setAttribute(GEN_AI_OUTPUT_MESSAGES, outputMessages);\n }\n }\n}\n\n/** Add `value` into a span's numeric token attribute, using the span itself as the running sum. */\nfunction addTokensToSpan(span: Span, attribute: string, value: number | undefined): void {\n if (value === undefined) {\n return;\n }\n const current = spanToJSON(span).data[attribute];\n span.setAttribute(attribute, (typeof current === 'number' ? current : 0) + value);\n}\n\n/**\n * Transform a channel `start` payload into the span that should be active for the operation. For\n * `step` we deliberately don't open a span (model calls and tool calls are siblings under the\n * invoke_agent span, matching the OTel-based output), so we reuse the active span and mark the\n * payload to skip ending it.\n */\nexport function createSpanFromMessage(\n data: VercelAiChannelMessage,\n channelOptions: VercelAiChannelOptions,\n): Span | undefined {\n const { type, event } = data;\n\n if (type === 'step' || !event || typeof event !== 'object') {\n // Opt out: returning `undefined` leaves the enclosing `invoke_agent` span as the active context\n // (model-call and tool-call events nest under it) without opening — or ending — a span of its own.\n return undefined;\n }\n\n const { recordInputs, enableTruncation } = getRecordingOptions(event, channelOptions);\n const provider = asString(event.provider);\n const modelId = asString(event.modelId);\n const callId = asString(event.callId);\n const maxRetries = asNumber(event.maxRetries);\n\n // Harvest tool descriptions from the operation/model-call `tools` so tool spans can backfill them.\n // Gated on `recordInputs` to match the OTel path, which only records `available_tools` then.\n if (recordInputs) {\n recordToolDescriptions(callId, event.tools);\n }\n\n const baseAttributes: Record<string, string | number | boolean> = {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n ...(provider ? { [GEN_AI_SYSTEM]: provider, [VERCEL_AI_MODEL_PROVIDER_ATTRIBUTE]: provider } : {}),\n ...(modelId ? { [GEN_AI_REQUEST_MODEL]: modelId } : {}),\n ...(maxRetries !== undefined ? { [VERCEL_AI_SETTINGS_MAX_RETRIES_ATTRIBUTE]: maxRetries } : {}),\n };\n\n switch (type) {\n case 'generateText':\n case 'streamText':\n case 'generateObject':\n // `generateObject` builds the same `invoke_agent` span as `generateText` (non-streaming); its\n // distinct `ai.generateObject` operationId rides on `event.operationId`. The JSON-schema attribute\n // the OTel path derives from the SDK's Zod schema is not reconstructed on the channel path.\n return buildInvokeAgentSpan(event, baseAttributes, recordInputs, enableTruncation, callId, type === 'streamText');\n case 'languageModelCall':\n return buildModelCallSpan(event, baseAttributes, recordInputs, enableTruncation, callId, modelId);\n case 'executeTool':\n return buildToolSpan(event, recordInputs);\n case 'embed':\n case 'embedMany': {\n // `embed` carries a single `value`; `embedMany` a `values` array — both map to the embeddings input.\n const input = type === 'embedMany' ? event.values : event.value;\n return startGenAiSpan(GEN_AI_EMBEDDINGS_OPERATION, modelId, {\n ...baseAttributes,\n ...(recordInputs && input !== undefined ? { [GEN_AI_EMBEDDINGS_INPUT]: stringify(input) } : {}),\n });\n }\n case 'rerank':\n return startGenAiSpan(GEN_AI_RERANK_OPERATION, modelId, baseAttributes);\n default:\n // Unknown event type: opt out rather than open a span we can't shape correctly.\n return undefined;\n }\n}\n\n/** Start a `gen_ai.<operation>` span named `<operation> <suffix>` (or just `<operation>` when no suffix). */\nfunction startGenAiSpan(operation: string, suffix: string | undefined, attributes: SpanAttributes): Span {\n return startInactiveSpan({\n name: suffix ? `${operation} ${suffix}` : operation,\n op: `gen_ai.${operation}`,\n attributes: { [GEN_AI_OPERATION_NAME]: operation, ...attributes },\n });\n}\n\nfunction buildInvokeAgentSpan(\n event: Record<string, unknown>,\n baseAttributes: SpanAttributes,\n recordInputs: boolean,\n enableTruncation: boolean,\n callId: string | undefined,\n isStream: boolean,\n): Span {\n const functionId = asString(event.functionId);\n const operationId = asString(event.operationId) ?? (isStream ? 'ai.streamText' : 'ai.generateText');\n if (callId) {\n operationIdByCallId.set(callId, { operationId, isStream });\n }\n const span = startGenAiSpan(GEN_AI_INVOKE_AGENT_SPAN_OP, functionId, {\n ...baseAttributes,\n [VERCEL_AI_OPERATION_ID_ATTRIBUTE]: operationId,\n [GEN_AI_RESPONSE_STREAMING]: isStream,\n ...(functionId ? { [GEN_AI_FUNCTION_ID]: functionId } : {}),\n ...(recordInputs ? buildInputMessageAttributes(event, enableTruncation) : {}),\n });\n if (isStream && callId) {\n invokeAgentSpanByCallId.set(callId, span);\n }\n\n return span;\n}\n\nfunction buildModelCallSpan(\n event: Record<string, unknown>,\n baseAttributes: SpanAttributes,\n recordInputs: boolean,\n enableTruncation: boolean,\n callId: string | undefined,\n modelId: string | undefined,\n): Span {\n const parent = callId ? operationIdByCallId.get(callId) : undefined;\n const operationId = parent\n ? `${parent.operationId}.${parent.isStream ? 'doStream' : 'doGenerate'}`\n : 'ai.generateText.doGenerate';\n return startGenAiSpan(GEN_AI_GENERATE_CONTENT_OPERATION, modelId, {\n ...baseAttributes,\n [VERCEL_AI_OPERATION_ID_ATTRIBUTE]: operationId,\n ...(recordInputs ? buildInputMessageAttributes(event, enableTruncation) : {}),\n ...(recordInputs && Array.isArray(event.tools) ? { [GEN_AI_REQUEST_AVAILABLE_TOOLS]: stringify(event.tools) } : {}),\n });\n}\n\nfunction buildToolSpan(event: Record<string, unknown>, recordInputs: boolean): Span {\n const toolCall = isObjectLike(event.toolCall) ? event.toolCall : {};\n const toolName = asString(toolCall.toolName);\n const toolCallId = asString(event.toolCallId) ?? asString(toolCall.toolCallId);\n const toolInput = toolCall.input ?? toolCall.args;\n // The `executeTool` event has no description; backfill it from the operation's recorded tools.\n // Gated on `recordInputs` to match the OTel path (descriptions come from the recorded tools list).\n const description =\n recordInputs && toolName ? resolveToolDescription(asString(event.callId), toolName, event.tools) : undefined;\n return startGenAiSpan(GEN_AI_EXECUTE_TOOL_SPAN_OP, toolName, {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [GEN_AI_TOOL_TYPE]: 'function',\n ...(toolName ? { [GEN_AI_TOOL_NAME]: toolName } : {}),\n ...(toolCallId ? { [GEN_AI_TOOL_CALL_ID_ATTRIBUTE]: toolCallId } : {}),\n ...(description ? { [GEN_AI_TOOL_DESCRIPTION_ATTRIBUTE]: description } : {}),\n ...(recordInputs && toolInput !== undefined ? { [GEN_AI_TOOL_INPUT]: stringify(toolInput) } : {}),\n });\n}\n\n/**\n * Best-effort enrichment from the resolved value the AI SDK attaches to the channel context.\n * Everything here is guarded: when a field is missing or the shape differs across `ai` versions,\n * we simply don't set the attribute rather than emit a malformed span.\n */\nexport function enrichSpanOnEnd(\n span: Span,\n data: VercelAiChannelMessage,\n channelOptions: VercelAiChannelOptions,\n): void {\n const { type, result } = data;\n if (!isObjectLike(result)) {\n return;\n }\n\n const { recordOutputs } = getRecordingOptions(data.event, channelOptions);\n\n if (type === 'executeTool') {\n if (recordOutputs) {\n span.setAttribute(GEN_AI_TOOL_OUTPUT, stringify(result.output ?? result));\n }\n // From V5 on, tool errors are not rejected (so the `error` channel verb never fires) — they\n // surface as `tool-error` content on the resolved result. Mirror the OTel path by marking the\n // span and capturing the error.\n const output = isObjectLike(result.output) ? result.output : undefined;\n if (output?.type === 'tool-error') {\n captureToolError(span, data, output.error);\n }\n return;\n }\n\n // `languageModelCall` results report usage as `{ total }` objects; top-level/step results report\n // flat numbers. `tokenCount` handles both. v4 names tokens `promptTokens`/`completionTokens`\n // (v5+ uses `inputTokens`/`outputTokens`); the fallbacks are `undefined`-inert on v5+.\n const usage = isObjectLike(result.usage) ? result.usage : undefined;\n if (usage) {\n const inputTokens = tokenCount(usage.inputTokens) ?? tokenCount(usage.promptTokens) ?? tokenCount(usage.tokens);\n const outputTokens = tokenCount(usage.outputTokens) ?? tokenCount(usage.completionTokens);\n const totalTokens = tokenCount(usage.totalTokens) ?? sum(inputTokens, outputTokens);\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 (totalTokens !== undefined) {\n span.setAttribute(GEN_AI_USAGE_TOTAL_TOKENS, totalTokens);\n }\n }\n\n // Match the OTel integration: finish reasons live on the model-call (`generate_content`) span, not\n // on the top-level `invoke_agent` span.\n const finishReason = getFinishReason(result);\n if (finishReason && type === 'languageModelCall') {\n span.setAttribute(GEN_AI_RESPONSE_FINISH_REASONS, stringify([finishReason]));\n }\n\n const response = isObjectLike(result.response) ? result.response : undefined;\n const responseId = asString(response?.id) ?? asString(result.responseId);\n if (responseId) {\n span.setAttribute(GEN_AI_RESPONSE_ID, responseId);\n }\n const responseModel = asString(response?.modelId) ?? asString(data.event.modelId);\n if (responseModel) {\n span.setAttribute(GEN_AI_RESPONSE_MODEL, responseModel);\n }\n\n // Provider-specific cache/reasoning/prediction token breakdowns and `gen_ai.conversation.id`.\n // The channel exposes `providerMetadata` as an object (the OTel path parses it from a string);\n // both share `getProviderMetadataAttributes` so the emitted shape is identical.\n const providerMetadata = (result as { providerMetadata?: unknown }).providerMetadata;\n const providerAttributes = getProviderMetadataAttributes(providerMetadata);\n // Don't overwrite a conversation id already set on span start (e.g. by `conversationIdIntegration`\n // from a user-set scope value); the provider-derived id is only a fallback. Matches the OTel path.\n if (\n GEN_AI_CONVERSATION_ID_ATTRIBUTE in providerAttributes &&\n spanToJSON(span).data[GEN_AI_CONVERSATION_ID_ATTRIBUTE]\n ) {\n // oxlint-disable-next-line typescript/no-dynamic-delete\n delete providerAttributes[GEN_AI_CONVERSATION_ID_ATTRIBUTE];\n }\n span.setAttributes(providerAttributes);\n\n if (recordOutputs) {\n // `languageModelCall` exposes the response as a `content` parts array; top-level results expose\n // `text` + `toolCalls`. Both normalize into the OTel `gen_ai.output.messages` assistant message.\n const parts =\n type === 'languageModelCall' && Array.isArray(result.content)\n ? partsFromContent(result.content)\n : partsFromTextAndToolCalls(result.text, result.toolCalls);\n const outputMessages = buildOutputMessages(parts, finishReason);\n if (outputMessages) {\n span.setAttribute(GEN_AI_OUTPUT_MESSAGES, outputMessages);\n }\n }\n}\n\n/** Maps a Vercel AI finish reason to the OTel `gen_ai.output.messages` form (`tool-calls` → `tool_call`). */\nfunction normalizeFinishReason(finishReason: string | undefined): string {\n return finishReason === 'tool-calls' ? 'tool_call' : (finishReason ?? 'stop');\n}\n\n/** Reads the finish reason from a result — a string on top-level results, `{ unified }` on model calls. */\nfunction getFinishReason(result: Record<string, unknown>): string | undefined {\n const finishReason = result.finishReason;\n if (typeof finishReason === 'string') {\n return finishReason;\n }\n return isObjectLike(finishReason) ? asString(finishReason.unified) : undefined;\n}\n\n/** Reads a token count that may be a plain number or a `{ total }` object (model-call usage). */\nfunction tokenCount(value: unknown): number | undefined {\n return asNumber(value) ?? (isObjectLike(value) ? asNumber(value.total) : undefined);\n}\n\nfunction buildOutputMessages(\n parts: Array<Record<string, unknown>>,\n finishReason: string | undefined,\n): string | undefined {\n if (!parts.length) {\n return undefined;\n }\n return stringify([{ role: 'assistant', parts, finish_reason: normalizeFinishReason(finishReason) }]);\n}\n\nfunction toolCallPart(toolCall: Record<string, unknown>): Record<string, unknown> {\n const args = toolCall.input ?? toolCall.args;\n return {\n type: 'tool_call',\n id: asString(toolCall.toolCallId),\n name: asString(toolCall.toolName),\n arguments: typeof args === 'string' ? args : stringify(args ?? {}),\n };\n}\n\nfunction partsFromContent(content: unknown[]): Array<Record<string, unknown>> {\n const parts: Array<Record<string, unknown>> = [];\n for (const item of content) {\n if (!isObjectLike(item)) {\n continue;\n }\n if (item.type === 'text' && typeof item.text === 'string') {\n parts.push({ type: 'text', content: item.text });\n } else if (item.type === 'tool-call') {\n parts.push(toolCallPart(item));\n }\n }\n return parts;\n}\n\nfunction partsFromTextAndToolCalls(text: unknown, toolCalls: unknown): Array<Record<string, unknown>> {\n const parts: Array<Record<string, unknown>> = [];\n if (typeof text === 'string' && text.length) {\n parts.push({ type: 'text', content: text });\n }\n if (Array.isArray(toolCalls)) {\n for (const toolCall of toolCalls) {\n if (isObjectLike(toolCall)) {\n parts.push(toolCallPart(toolCall));\n }\n }\n }\n return parts;\n}\n\nexport function captureToolError(span: Span, data: VercelAiChannelMessage, error: unknown): void {\n span.setStatus({\n code: SPAN_STATUS_ERROR,\n message: error instanceof Error ? error.message : 'tool_error',\n });\n\n const toolCall = isObjectLike(data.event.toolCall) ? data.event.toolCall : {};\n const toolName = asString(toolCall.toolName);\n const toolCallId = asString(data.event.toolCallId) ?? asString(toolCall.toolCallId);\n\n withScope(scope => {\n scope.setContext('trace', spanToTraceContext(span));\n if (toolName) {\n scope.setTag('vercel.ai.tool.name', toolName);\n }\n if (toolCallId) {\n scope.setTag('vercel.ai.tool.callId', toolCallId);\n }\n scope.setLevel('error');\n captureException(\n error instanceof Error ? error : new Error(typeof error === 'string' ? error : 'Tool execution failed'),\n {\n mechanism: { type: 'auto.vercelai.channel', handled: false },\n },\n );\n });\n}\n\nfunction getRecordingOptions(\n event: Record<string, unknown>,\n channelOptions: VercelAiChannelOptions,\n): {\n recordInputs: boolean;\n recordOutputs: boolean;\n enableTruncation: boolean;\n} {\n const genAI = getClient()?.getDataCollectionOptions().genAI;\n\n return {\n recordInputs: resolveRecording(channelOptions.recordInputs, event.recordInputs, genAI?.inputs),\n recordOutputs: resolveRecording(channelOptions.recordOutputs, event.recordOutputs, genAI?.outputs),\n enableTruncation: shouldEnableTruncation(channelOptions.enableTruncation),\n };\n}\n\n/**\n * Mirrors the OTel integration's `determineRecordingSettings` precedence: an integration-level option\n * wins, then the per-call `experimental_telemetry.recordInputs/recordOutputs` flag the AI SDK forwards\n * on the channel event, then the global `dataCollection.genAI` default.\n *\n * NOTE: the OTel integration also defaults recording to `true` for a call with\n * `experimental_telemetry: { isEnabled: true }`. The `ai:telemetry` channel does not expose `isEnabled`\n * (nor a resolved recording flag), so that per-call default cannot be reproduced here — v7 users who\n * want inputs/outputs recorded must enable `dataCollection.genAI` or set `recordInputs`/`recordOutputs`.\n */\nfunction resolveRecording(integrationOption: unknown, perCallOption: unknown, globalDefault: unknown): boolean {\n if (typeof integrationOption === 'boolean') {\n return integrationOption;\n }\n if (typeof perCallOption === 'boolean') {\n return perCallOption;\n }\n return globalDefault === true;\n}\n\nfunction buildInputMessageAttributes(\n event: Record<string, unknown>,\n enableTruncation: boolean,\n): Record<string, string | number | undefined> {\n const attributes: Record<string, string | number | undefined> = {};\n\n // `ai` >= 7 forbids system messages in `messages`/`prompt` and exposes the system prompt as a\n // separate `instructions` field. The OTel path lifts the system message out of the prompt into\n // `gen_ai.system_instructions` as `[{ type: 'text', content }]`; mirror that shape here.\n const instructions = asString(event.instructions);\n if (instructions) {\n attributes[GEN_AI_SYSTEM_INSTRUCTIONS_ATTRIBUTE] = stringify([{ type: 'text', content: instructions }]);\n }\n\n // The AI SDK start events extend `StandardizedPrompt`; messages live on `messages`, otherwise the\n // simpler `prompt` field is used.\n const messages = event.messages ?? event.prompt;\n if (messages !== undefined) {\n attributes[GEN_AI_INPUT_MESSAGES] = enableTruncation ? getTruncatedJsonString(messages) : stringify(messages);\n // The original (pre-truncation) message count, so the product can show how many were dropped.\n attributes[GEN_AI_INPUT_MESSAGES_ORIGINAL_LENGTH_ATTRIBUTE] = Array.isArray(messages) ? messages.length : 1;\n }\n\n return attributes;\n}\n"],"names":["asString","isObjectLike","tracingChannel","bindTracingChannelToSpan","isReadableStream","tapModelCallStream","GEN_AI_USAGE_INPUT_TOKENS","GEN_AI_USAGE_OUTPUT_TOKENS","GEN_AI_USAGE_TOTAL_TOKENS","sum","GEN_AI_OUTPUT_MESSAGES","spanToJSON","asNumber","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","GEN_AI_SYSTEM","GEN_AI_REQUEST_MODEL","GEN_AI_EMBEDDINGS_INPUT","stringify","attributes","startInactiveSpan","GEN_AI_OPERATION_NAME","GEN_AI_INVOKE_AGENT_SPAN_OP","GEN_AI_RESPONSE_STREAMING","GEN_AI_FUNCTION_ID","GEN_AI_REQUEST_AVAILABLE_TOOLS","GEN_AI_EXECUTE_TOOL_SPAN_OP","GEN_AI_TOOL_TYPE","GEN_AI_TOOL_NAME","GEN_AI_TOOL_INPUT","GEN_AI_TOOL_OUTPUT","GEN_AI_RESPONSE_FINISH_REASONS","GEN_AI_RESPONSE_ID","GEN_AI_RESPONSE_MODEL","getProviderMetadataAttributes","GEN_AI_CONVERSATION_ID_ATTRIBUTE","SPAN_STATUS_ERROR","withScope","spanToTraceContext","captureException","getClient","shouldEnableTruncation","GEN_AI_SYSTEM_INSTRUCTIONS_ATTRIBUTE","GEN_AI_INPUT_MESSAGES","getTruncatedJsonString","GEN_AI_INPUT_MESSAGES_ORIGINAL_LENGTH_ATTRIBUTE"],"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eAA0D,EAAC;AAKjE,EAAA,MAAM,YAAA,GAAelB,aAAA,CAAS,KAAA,CAAM,YAAY,CAAA;AAChD,EAAA,IAAI,YAAA,EAAc;AAChB,IAAAkB,YAAA,CAAWuB,yCAAoC,CAAA,GAAIxB,cAAA,CAAU,CAAC,EAAE,MAAM,MAAA,EAAQ,OAAA,EAAS,YAAA,EAAc,CAAC,CAAA;AAAA,EACxG;AAIA,EAAA,MAAM,QAAA,GAAW,KAAA,CAAM,QAAA,IAAY,KAAA,CAAM,MAAA;AACzC,EAAA,IAAI,aAAa,MAAA,EAAW;AAC1B,IAAAC,YAAA,CAAWwB,gCAAqB,CAAA,GAAI,gBAAA,GAAmBC,4BAAuB,QAAQ,CAAA,GAAI1B,eAAU,QAAQ,CAAA;AAE5G,IAAAC,YAAA,CAAW0B,oDAA+C,CAAA,GAAI,KAAA,CAAM,QAAQ,QAAQ,CAAA,GAAI,SAAS,MAAA,GAAS,CAAA;AAAA,EAC5G;AAEA,EAAA,OAAO1B,YAAA;AACT;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"vercel-ai-dc-subscriber.js","sources":["../../../src/vercel-ai/vercel-ai-dc-subscriber.ts"],"sourcesContent":["/* eslint-disable max-lines */\n// `@sentry/conventions` marks several gen_ai attributes (e.g. `GEN_AI_SYSTEM`, `GEN_AI_TOOL_*`,\n// `GEN_AI_REQUEST_AVAILABLE_TOOLS`) as deprecated in favour of newer semconv names. We intentionally\n// keep emitting the current names so these spans match the OTel-based (v6) integration and what the\n// Sentry product consumes today; migrating to the new names is a separate, coordinated change.\n/* eslint-disable typescript-eslint/no-deprecated */\nimport {\n GEN_AI_EMBEDDINGS_INPUT,\n GEN_AI_FUNCTION_ID,\n GEN_AI_INPUT_MESSAGES,\n GEN_AI_OPERATION_NAME,\n GEN_AI_OUTPUT_MESSAGES,\n GEN_AI_REQUEST_AVAILABLE_TOOLS,\n GEN_AI_REQUEST_MODEL,\n GEN_AI_RESPONSE_FINISH_REASONS,\n GEN_AI_RESPONSE_ID,\n GEN_AI_RESPONSE_MODEL,\n GEN_AI_RESPONSE_STREAMING,\n GEN_AI_SYSTEM,\n GEN_AI_TOOL_INPUT,\n GEN_AI_TOOL_NAME,\n GEN_AI_TOOL_OUTPUT,\n GEN_AI_TOOL_TYPE,\n GEN_AI_USAGE_INPUT_TOKENS,\n GEN_AI_USAGE_OUTPUT_TOKENS,\n GEN_AI_USAGE_TOTAL_TOKENS,\n} from '@sentry/conventions/attributes';\nimport { GEN_AI_EXECUTE_TOOL_SPAN_OP, GEN_AI_INVOKE_AGENT_SPAN_OP } from '@sentry/conventions/op';\nimport type { Span, SpanAttributes } from '@sentry/core';\nimport {\n _INTERNAL_skipAiProviderWrapping,\n captureException,\n GEN_AI_CONVERSATION_ID_ATTRIBUTE,\n GEN_AI_INPUT_MESSAGES_ORIGINAL_LENGTH_ATTRIBUTE,\n GEN_AI_SYSTEM_INSTRUCTIONS_ATTRIBUTE,\n getClient,\n getProviderMetadataAttributes,\n getTruncatedJsonString,\n isObjectLike,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n shouldEnableTruncation,\n SPAN_STATUS_ERROR,\n spanToJSON,\n spanToTraceContext,\n startInactiveSpan,\n stringify,\n withScope,\n} from '@sentry/core';\nimport type { TracingChannel } from 'node:diagnostics_channel';\nimport { bindTracingChannelToSpan } from '../tracing-channel';\nimport { asNumber, asString, isReadableStream, type StreamedModelCallResult, sum, tapModelCallStream } from './util';\n\n/**\n * The single tracing channel the `ai` package (>= 7) publishes all telemetry lifecycle events to\n * via `node:diagnostics_channel`. Events are discriminated by their `type` field.\n * @see https://github.com/vercel/ai/pull/15660\n */\nconst AI_SDK_TELEMETRY_TRACING_CHANNEL = 'ai:telemetry';\n\nconst ORIGIN = 'auto.vercelai.channel';\n\n// `@sentry/conventions` does not expose these yet, so we keep the literals here.\nconst GEN_AI_TOOL_CALL_ID_ATTRIBUTE = 'gen_ai.tool.call.id';\nconst GEN_AI_TOOL_DESCRIPTION_ATTRIBUTE = 'gen_ai.tool.description';\nconst GEN_AI_EMBEDDINGS_OPERATION = 'embeddings';\nconst GEN_AI_RERANK_OPERATION = 'rerank';\n// The model-call op matches the Vercel AI OTel integration (`gen_ai.generate_content`) rather than\n// the generic `gen_ai.chat`, so v6 (OTel) and v7 (channel) produce the same spans.\nconst GEN_AI_GENERATE_CONTENT_OPERATION = 'generate_content';\n// TODO(v11): export the constant from server-utils and import it here instead.\nconst WORKERS_AI_INTEGRATION_NAME = 'WorkersAI';\n\n// Subset of the `vercel.ai.*` passthrough attributes the OTel integration emits that we reproduce.\nconst VERCEL_AI_OPERATION_ID_ATTRIBUTE = 'vercel.ai.operationId';\nconst VERCEL_AI_MODEL_PROVIDER_ATTRIBUTE = 'vercel.ai.model.provider';\nconst VERCEL_AI_SETTINGS_MAX_RETRIES_ATTRIBUTE = 'vercel.ai.settings.maxRetries';\n\n// Tracks the top-level operationId (and whether it streams) per `callId` so a model-call span can\n// name its `doGenerate`/`doStream` operation the same way the OTel integration does. `isStream` is\n// the authoritative event-type signal rather than a substring check on the (possibly custom)\n// operationId. Cleared when the top-level span ends.\nconst operationIdByCallId = new Map<string, { operationId: string; isStream: boolean }>();\n\n// Per-operation map of tool name → description, harvested from a model-call /\n// top-level event's `tools` (keyed by the shared `callId`). The AI SDK's\n// `executeTool` event doesn't carry the tool's description, so we backfill it\n// onto the tool span here — without relying on the OTel `vercelAiEventProcessor`\n// (which isn't registered in channel/orchestrion mode). Cleared with the\n// operation. Only populated when inputs are recorded, matching the OTel path\n// (which sources descriptions from the recorded `available_tools`).\nconst toolDescriptionsByCallId = new Map<string, Map<string, string>>();\n\n// A streamed `streamText` operation's own channel result is always `undefined` (the SDK exposes the\n// stream only on the model call), so its `invoke_agent` span can't be enriched from the channel. We\n// key the span by `callId` and enrich it as each streamed model call drains — the model calls flush\n// before the operation's own span ends. The running token sum lives on the span's own attributes.\nconst invokeAgentSpanByCallId = new Map<string, Span>();\n\n// Only top-level operations own the `callId` → operationId mapping; `step`/`languageModelCall`/\n// `executeTool` share the parent's `callId`, so they must not clear it.\nconst ROOT_OPERATION_TYPES = new Set<ChannelEventType>([\n 'generateText',\n 'streamText',\n 'generateObject',\n 'embed',\n 'embedMany',\n 'rerank',\n]);\n\n/** Drop the per-operation `callId` maps once the owning top-level operation settles (success or error). */\nexport function clearOperationId(data: VercelAiChannelMessage): void {\n if (!ROOT_OPERATION_TYPES.has(data.type)) {\n return;\n }\n const callId = asString(data.event.callId);\n if (callId) {\n clearOperationCallId(callId);\n }\n}\n\n/**\n * Drop the per-operation `callId` maps for a single id. The v6 orchestrion adapter uses this to clear a\n * `streamText` operation only after its lazily-run model call settles — the operation's own span ends\n * synchronously (when `streamText` returns) but the model call runs later as the stream is consumed, and\n * it still needs the operation's `operationId`/`isStream` entry to name itself `ai.streamText.doStream`.\n */\nexport function clearOperationCallId(callId: string): void {\n operationIdByCallId.delete(callId);\n toolDescriptionsByCallId.delete(callId);\n invokeAgentSpanByCallId.delete(callId);\n}\n\n/** Record tool name → description from an event's `tools`, so tool spans can backfill the description. */\nfunction recordToolDescriptions(callId: string | undefined, tools: unknown): void {\n if (!callId || !Array.isArray(tools)) {\n return;\n }\n let descriptions = toolDescriptionsByCallId.get(callId);\n for (const tool of tools) {\n if (isObjectLike(tool) && typeof tool.name === 'string' && typeof tool.description === 'string') {\n descriptions = descriptions ?? new Map();\n if (!descriptions.has(tool.name)) {\n descriptions.set(tool.name, tool.description);\n }\n }\n }\n if (descriptions) {\n toolDescriptionsByCallId.set(callId, descriptions);\n }\n}\n\n/**\n * Resolve a tool's description, preferring the per-operation map (populated from the model-call /\n * top-level event's `tools`, v7) and falling back to a `tools` collection on the event itself —\n * which may be an array of `{ name, description }` or a record keyed by tool name (v6).\n */\nfunction resolveToolDescription(callId: string | undefined, toolName: string, tools: unknown): string | undefined {\n const fromMap = callId ? toolDescriptionsByCallId.get(callId)?.get(toolName) : undefined;\n if (fromMap) {\n return fromMap;\n }\n if (Array.isArray(tools)) {\n const match = tools.find(tool => isObjectLike(tool) && tool.name === toolName);\n return isObjectLike(match) ? asString(match.description) : undefined;\n }\n if (isObjectLike(tools)) {\n const tool = tools[toolName];\n return isObjectLike(tool) ? asString(tool.description) : undefined;\n }\n return undefined;\n}\n\n/** The lifecycle event types the `ai:telemetry` channel can carry. */\nexport type ChannelEventType =\n | 'generateText'\n | 'streamText'\n | 'generateObject'\n | 'step'\n | 'languageModelCall'\n | 'executeTool'\n | 'embed'\n | 'embedMany'\n | 'rerank';\n\n/**\n * The context object the AI SDK passes through one tracing-channel call. It is the same object\n * identity across `start`/`end`/`asyncEnd`/`error`, and Node's `tracingChannel` attaches\n * `result`/`error` to it as the traced promise settles.\n */\nexport interface VercelAiChannelMessage {\n type: ChannelEventType;\n event: Record<string, unknown>;\n result?: unknown;\n error?: unknown;\n}\n\n/**\n * Platform-provided factory that returns a tracing channel for the given channel name. The factory\n * is responsible for, when `start` fires, calling `transformStart(data)` and storing the returned\n * span on `data._sentrySpan` so the subscriber's `asyncEnd`/`error` handlers can read it.\n *\n * Node passes `@sentry/opentelemetry/tracing-channel`, which uses `bindStore` to additionally make\n * the span the active OTel context for the duration of the traced operation. That is what makes\n * nested AI SDK operations (model calls, tool calls) become children of the enclosing span without\n * any manual parent bookkeeping here.\n */\nexport type VercelAiTracingChannelFactory = <T extends object>(name: string) => TracingChannel<T, T>;\n\n/** Integration-level recording options, pinned at subscribe time so we never look the integration up per event. */\nexport interface VercelAiChannelOptions {\n recordInputs?: boolean;\n recordOutputs?: boolean;\n enableTruncation?: boolean;\n}\n\n/**\n * Subscribe Sentry span handlers to the `ai` SDK's native telemetry tracing channel (`ai:telemetry`,\n * available in `ai` >= 7) and emit fully-formed `gen_ai.*` spans directly — no OpenTelemetry span\n * post-processing involved.\n *\n * The integration passes its options in directly (rather than us looking the integration up on every\n * event); the global `dataCollection.genAI` default is still read from the client per event.\n *\n * Safe to always call: on `ai` versions that don't publish to the channel (e.g. < 7) nothing is\n * ever emitted and this is inert, so there is no double-instrumentation against the OTel-based\n * patcher. The integration's `setupOnce` guarantees this runs a single time.\n */\nexport function subscribeVercelAiTracingChannel(\n tracingChannel: VercelAiTracingChannelFactory,\n options: VercelAiChannelOptions = {},\n): void {\n bindTracingChannelToSpan(\n tracingChannel<VercelAiChannelMessage>(AI_SDK_TELEMETRY_TRACING_CHANNEL),\n data => createSpanFromMessage(data, options),\n {\n // The helper ends the span; we enrich it from the settled result first (tokens, output messages,\n // finish reasons, response model/id, provider metadata) and drop the per-operation `callId` maps.\n beforeSpanEnd: (span, data) => {\n enrichSpanOnEnd(span, data, options);\n clearOperationId(data);\n },\n // A streamed model call resolves before its stream is drained, so we tap the stream, keep the\n // span open, and end it (via `end`) once the final usage/finish/output chunks arrive.\n deferSpanEnd: ({ data, end }) => deferStreamedModelCallEnd(data, options, end),\n },\n );\n}\n\n/**\n * When a `languageModelCall` resolves to a live `ReadableStream`, defer ending its span: swap in a\n * passthrough that forwards chunks to the SDK untouched while aggregating usage/finish/output, then\n * enrich and end the span once the stream settles. Returns `false` for anything that isn't a streamed\n * model call so the helper ends the span as usual.\n */\nfunction deferStreamedModelCallEnd(\n data: VercelAiChannelMessage,\n options: VercelAiChannelOptions,\n end: (error?: unknown) => void,\n): boolean {\n if (data.type !== 'languageModelCall' || !isObjectLike(data.result)) {\n return false;\n }\n const result = data.result;\n const stream = result.stream;\n if (!isReadableStream(stream)) {\n return false;\n }\n\n const callId = asString(data.event.callId);\n const { recordOutputs } = getRecordingOptions(data.event, options);\n result.stream = tapModelCallStream(\n stream,\n final => {\n // Reshape the aggregate into the result `enrichSpanOnEnd` expects, then let `end` run it (it calls\n // `beforeSpanEnd`). Enriching the model-call span and the parent from the same aggregate keeps\n // streamed and non-streamed spans identical.\n data.result = { ...result, ...streamedResultToChannelResult(final) };\n end();\n enrichInvokeAgentFromStream(callId, final, recordOutputs);\n },\n error => end(error),\n );\n\n return true;\n}\n\n/** Map the tapped stream aggregate onto the `languageModelCall` result shape `enrichSpanOnEnd` reads. */\nexport function streamedResultToChannelResult(final: StreamedModelCallResult): Record<string, unknown> {\n const content: Array<Record<string, unknown>> = [];\n if (final.text) {\n content.push({ type: 'text', text: final.text });\n }\n for (const toolCall of final.toolCalls) {\n content.push({ type: 'tool-call', ...toolCall });\n }\n\n return {\n content,\n ...(final.usage !== undefined ? { usage: final.usage } : {}),\n ...(final.finishReason !== undefined ? { finishReason: final.finishReason } : {}),\n ...(final.providerMetadata !== undefined ? { providerMetadata: final.providerMetadata } : {}),\n ...(final.responseId || final.responseModel\n ? {\n response: {\n ...(final.responseId ? { id: final.responseId } : {}),\n ...(final.responseModel ? { modelId: final.responseModel } : {}),\n },\n }\n : {}),\n };\n}\n\n/**\n * Propagate a streamed model call's usage (summed across the operation's model calls) and output onto\n * the enclosing `invoke_agent` span, which has no channel result of its own. Runs before that span ends\n * because the operation's completion promise settles only after every model-call stream has drained.\n */\nfunction enrichInvokeAgentFromStream(\n callId: string | undefined,\n final: StreamedModelCallResult,\n recordOutputs: boolean,\n): void {\n const span = callId ? invokeAgentSpanByCallId.get(callId) : undefined;\n if (!span) {\n return;\n }\n\n const usage = isObjectLike(final.usage) ? final.usage : undefined;\n if (usage) {\n const input = tokenCount(usage.inputTokens) ?? tokenCount(usage.promptTokens) ?? tokenCount(usage.tokens);\n const output = tokenCount(usage.outputTokens) ?? tokenCount(usage.completionTokens);\n addTokensToSpan(span, GEN_AI_USAGE_INPUT_TOKENS, input);\n addTokensToSpan(span, GEN_AI_USAGE_OUTPUT_TOKENS, output);\n addTokensToSpan(span, GEN_AI_USAGE_TOTAL_TOKENS, tokenCount(usage.totalTokens) ?? sum(input, output));\n }\n\n if (recordOutputs) {\n const parts = partsFromTextAndToolCalls(final.text, final.toolCalls);\n const outputMessages = buildOutputMessages(parts, getFinishReason({ finishReason: final.finishReason }));\n if (outputMessages) {\n span.setAttribute(GEN_AI_OUTPUT_MESSAGES, outputMessages);\n }\n }\n}\n\n/** Add `value` into a span's numeric token attribute, using the span itself as the running sum. */\nfunction addTokensToSpan(span: Span, attribute: string, value: number | undefined): void {\n if (value === undefined) {\n return;\n }\n const current = spanToJSON(span).data[attribute];\n span.setAttribute(attribute, (typeof current === 'number' ? current : 0) + value);\n}\n\n/**\n * Transform a channel `start` payload into the span that should be active for the operation. For\n * `step` we deliberately don't open a span (model calls and tool calls are siblings under the\n * invoke_agent span, matching the OTel-based output), so we reuse the active span and mark the\n * payload to skip ending it.\n */\nexport function createSpanFromMessage(\n data: VercelAiChannelMessage,\n channelOptions: VercelAiChannelOptions,\n): Span | undefined {\n const { type, event } = data;\n\n if (type === 'step' || !event || typeof event !== 'object') {\n // Opt out: returning `undefined` leaves the enclosing `invoke_agent` span as the active context\n // (model-call and tool-call events nest under it) without opening — or ending — a span of its own.\n return undefined;\n }\n\n const { recordInputs, enableTruncation } = getRecordingOptions(event, channelOptions);\n const provider = asString(event.provider);\n const modelId = asString(event.modelId);\n const callId = asString(event.callId);\n const maxRetries = asNumber(event.maxRetries);\n\n // Harvest tool descriptions from the operation/model-call `tools` so tool spans can backfill them.\n // Gated on `recordInputs` to match the OTel path, which only records `available_tools` then.\n if (recordInputs) {\n recordToolDescriptions(callId, event.tools);\n }\n\n const baseAttributes: Record<string, string | number | boolean> = {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n ...(provider ? { [GEN_AI_SYSTEM]: provider, [VERCEL_AI_MODEL_PROVIDER_ATTRIBUTE]: provider } : {}),\n ...(modelId ? { [GEN_AI_REQUEST_MODEL]: modelId } : {}),\n ...(maxRetries !== undefined ? { [VERCEL_AI_SETTINGS_MAX_RETRIES_ATTRIBUTE]: maxRetries } : {}),\n };\n\n switch (type) {\n case 'generateText':\n case 'streamText':\n case 'generateObject':\n // `generateObject` builds the same `invoke_agent` span as `generateText` (non-streaming); its\n // distinct `ai.generateObject` operationId rides on `event.operationId`. The JSON-schema attribute\n // the OTel path derives from the SDK's Zod schema is not reconstructed on the channel path.\n return buildInvokeAgentSpan(event, baseAttributes, recordInputs, enableTruncation, callId, type === 'streamText');\n case 'languageModelCall':\n _INTERNAL_skipAiProviderWrapping([WORKERS_AI_INTEGRATION_NAME]);\n\n return buildModelCallSpan(event, baseAttributes, recordInputs, enableTruncation, callId, modelId);\n case 'executeTool':\n return buildToolSpan(event, recordInputs);\n case 'embed':\n case 'embedMany': {\n // `embed` carries a single `value`; `embedMany` a `values` array — both map to the embeddings input.\n const input = type === 'embedMany' ? event.values : event.value;\n return startGenAiSpan(GEN_AI_EMBEDDINGS_OPERATION, modelId, {\n ...baseAttributes,\n ...(recordInputs && input !== undefined ? { [GEN_AI_EMBEDDINGS_INPUT]: stringify(input) } : {}),\n });\n }\n case 'rerank':\n return startGenAiSpan(GEN_AI_RERANK_OPERATION, modelId, baseAttributes);\n default:\n // Unknown event type: opt out rather than open a span we can't shape correctly.\n return undefined;\n }\n}\n\n/** Start a `gen_ai.<operation>` span named `<operation> <suffix>` (or just `<operation>` when no suffix). */\nfunction startGenAiSpan(operation: string, suffix: string | undefined, attributes: SpanAttributes): Span {\n return startInactiveSpan({\n name: suffix ? `${operation} ${suffix}` : operation,\n op: `gen_ai.${operation}`,\n attributes: { [GEN_AI_OPERATION_NAME]: operation, ...attributes },\n });\n}\n\nfunction buildInvokeAgentSpan(\n event: Record<string, unknown>,\n baseAttributes: SpanAttributes,\n recordInputs: boolean,\n enableTruncation: boolean,\n callId: string | undefined,\n isStream: boolean,\n): Span {\n const functionId = asString(event.functionId);\n const operationId = asString(event.operationId) ?? (isStream ? 'ai.streamText' : 'ai.generateText');\n if (callId) {\n operationIdByCallId.set(callId, { operationId, isStream });\n }\n const span = startGenAiSpan(GEN_AI_INVOKE_AGENT_SPAN_OP, functionId, {\n ...baseAttributes,\n [VERCEL_AI_OPERATION_ID_ATTRIBUTE]: operationId,\n [GEN_AI_RESPONSE_STREAMING]: isStream,\n ...(functionId ? { [GEN_AI_FUNCTION_ID]: functionId } : {}),\n ...(recordInputs ? buildInputMessageAttributes(event, enableTruncation) : {}),\n });\n if (isStream && callId) {\n invokeAgentSpanByCallId.set(callId, span);\n }\n\n return span;\n}\n\nfunction buildModelCallSpan(\n event: Record<string, unknown>,\n baseAttributes: SpanAttributes,\n recordInputs: boolean,\n enableTruncation: boolean,\n callId: string | undefined,\n modelId: string | undefined,\n): Span {\n const parent = callId ? operationIdByCallId.get(callId) : undefined;\n const operationId = parent\n ? `${parent.operationId}.${parent.isStream ? 'doStream' : 'doGenerate'}`\n : 'ai.generateText.doGenerate';\n return startGenAiSpan(GEN_AI_GENERATE_CONTENT_OPERATION, modelId, {\n ...baseAttributes,\n [VERCEL_AI_OPERATION_ID_ATTRIBUTE]: operationId,\n ...(recordInputs ? buildInputMessageAttributes(event, enableTruncation) : {}),\n ...(recordInputs && Array.isArray(event.tools) ? { [GEN_AI_REQUEST_AVAILABLE_TOOLS]: stringify(event.tools) } : {}),\n });\n}\n\nfunction buildToolSpan(event: Record<string, unknown>, recordInputs: boolean): Span {\n const toolCall = isObjectLike(event.toolCall) ? event.toolCall : {};\n const toolName = asString(toolCall.toolName);\n const toolCallId = asString(event.toolCallId) ?? asString(toolCall.toolCallId);\n const toolInput = toolCall.input ?? toolCall.args;\n // The `executeTool` event has no description; backfill it from the operation's recorded tools.\n // Gated on `recordInputs` to match the OTel path (descriptions come from the recorded tools list).\n const description =\n recordInputs && toolName ? resolveToolDescription(asString(event.callId), toolName, event.tools) : undefined;\n return startGenAiSpan(GEN_AI_EXECUTE_TOOL_SPAN_OP, toolName, {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [GEN_AI_TOOL_TYPE]: 'function',\n ...(toolName ? { [GEN_AI_TOOL_NAME]: toolName } : {}),\n ...(toolCallId ? { [GEN_AI_TOOL_CALL_ID_ATTRIBUTE]: toolCallId } : {}),\n ...(description ? { [GEN_AI_TOOL_DESCRIPTION_ATTRIBUTE]: description } : {}),\n ...(recordInputs && toolInput !== undefined ? { [GEN_AI_TOOL_INPUT]: stringify(toolInput) } : {}),\n });\n}\n\n/**\n * Best-effort enrichment from the resolved value the AI SDK attaches to the channel context.\n * Everything here is guarded: when a field is missing or the shape differs across `ai` versions,\n * we simply don't set the attribute rather than emit a malformed span.\n */\nexport function enrichSpanOnEnd(\n span: Span,\n data: VercelAiChannelMessage,\n channelOptions: VercelAiChannelOptions,\n): void {\n const { type, result } = data;\n if (!isObjectLike(result)) {\n return;\n }\n\n const { recordOutputs } = getRecordingOptions(data.event, channelOptions);\n\n if (type === 'executeTool') {\n if (recordOutputs) {\n span.setAttribute(GEN_AI_TOOL_OUTPUT, stringify(result.output ?? result));\n }\n // From V5 on, tool errors are not rejected (so the `error` channel verb never fires) — they\n // surface as `tool-error` content on the resolved result. Mirror the OTel path by marking the\n // span and capturing the error.\n const output = isObjectLike(result.output) ? result.output : undefined;\n if (output?.type === 'tool-error') {\n captureToolError(span, data, output.error);\n }\n return;\n }\n\n // `languageModelCall` results report usage as `{ total }` objects; top-level/step results report\n // flat numbers. `tokenCount` handles both. v4 names tokens `promptTokens`/`completionTokens`\n // (v5+ uses `inputTokens`/`outputTokens`); the fallbacks are `undefined`-inert on v5+.\n const usage = isObjectLike(result.usage) ? result.usage : undefined;\n if (usage) {\n const inputTokens = tokenCount(usage.inputTokens) ?? tokenCount(usage.promptTokens) ?? tokenCount(usage.tokens);\n const outputTokens = tokenCount(usage.outputTokens) ?? tokenCount(usage.completionTokens);\n const totalTokens = tokenCount(usage.totalTokens) ?? sum(inputTokens, outputTokens);\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 (totalTokens !== undefined) {\n span.setAttribute(GEN_AI_USAGE_TOTAL_TOKENS, totalTokens);\n }\n }\n\n // Match the OTel integration: finish reasons live on the model-call (`generate_content`) span, not\n // on the top-level `invoke_agent` span.\n const finishReason = getFinishReason(result);\n if (finishReason && type === 'languageModelCall') {\n span.setAttribute(GEN_AI_RESPONSE_FINISH_REASONS, stringify([finishReason]));\n }\n\n const response = isObjectLike(result.response) ? result.response : undefined;\n const responseId = asString(response?.id) ?? asString(result.responseId);\n if (responseId) {\n span.setAttribute(GEN_AI_RESPONSE_ID, responseId);\n }\n const responseModel = asString(response?.modelId) ?? asString(data.event.modelId);\n if (responseModel) {\n span.setAttribute(GEN_AI_RESPONSE_MODEL, responseModel);\n }\n\n // Provider-specific cache/reasoning/prediction token breakdowns and `gen_ai.conversation.id`.\n // The channel exposes `providerMetadata` as an object (the OTel path parses it from a string);\n // both share `getProviderMetadataAttributes` so the emitted shape is identical.\n const providerMetadata = (result as { providerMetadata?: unknown }).providerMetadata;\n const providerAttributes = getProviderMetadataAttributes(providerMetadata);\n // Don't overwrite a conversation id already set on span start (e.g. by `conversationIdIntegration`\n // from a user-set scope value); the provider-derived id is only a fallback. Matches the OTel path.\n if (\n GEN_AI_CONVERSATION_ID_ATTRIBUTE in providerAttributes &&\n spanToJSON(span).data[GEN_AI_CONVERSATION_ID_ATTRIBUTE]\n ) {\n // oxlint-disable-next-line typescript/no-dynamic-delete\n delete providerAttributes[GEN_AI_CONVERSATION_ID_ATTRIBUTE];\n }\n span.setAttributes(providerAttributes);\n\n if (recordOutputs) {\n // `languageModelCall` exposes the response as a `content` parts array; top-level results expose\n // `text` + `toolCalls`. Both normalize into the OTel `gen_ai.output.messages` assistant message.\n const parts =\n type === 'languageModelCall' && Array.isArray(result.content)\n ? partsFromContent(result.content)\n : partsFromTextAndToolCalls(result.text, result.toolCalls);\n const outputMessages = buildOutputMessages(parts, finishReason);\n if (outputMessages) {\n span.setAttribute(GEN_AI_OUTPUT_MESSAGES, outputMessages);\n }\n }\n}\n\n/** Maps a Vercel AI finish reason to the OTel `gen_ai.output.messages` form (`tool-calls` → `tool_call`). */\nfunction normalizeFinishReason(finishReason: string | undefined): string {\n return finishReason === 'tool-calls' ? 'tool_call' : (finishReason ?? 'stop');\n}\n\n/** Reads the finish reason from a result — a string on top-level results, `{ unified }` on model calls. */\nfunction getFinishReason(result: Record<string, unknown>): string | undefined {\n const finishReason = result.finishReason;\n if (typeof finishReason === 'string') {\n return finishReason;\n }\n return isObjectLike(finishReason) ? asString(finishReason.unified) : undefined;\n}\n\n/** Reads a token count that may be a plain number or a `{ total }` object (model-call usage). */\nfunction tokenCount(value: unknown): number | undefined {\n return asNumber(value) ?? (isObjectLike(value) ? asNumber(value.total) : undefined);\n}\n\nfunction buildOutputMessages(\n parts: Array<Record<string, unknown>>,\n finishReason: string | undefined,\n): string | undefined {\n if (!parts.length) {\n return undefined;\n }\n return stringify([{ role: 'assistant', parts, finish_reason: normalizeFinishReason(finishReason) }]);\n}\n\nfunction toolCallPart(toolCall: Record<string, unknown>): Record<string, unknown> {\n const args = toolCall.input ?? toolCall.args;\n return {\n type: 'tool_call',\n id: asString(toolCall.toolCallId),\n name: asString(toolCall.toolName),\n arguments: typeof args === 'string' ? args : stringify(args ?? {}),\n };\n}\n\nfunction partsFromContent(content: unknown[]): Array<Record<string, unknown>> {\n const parts: Array<Record<string, unknown>> = [];\n for (const item of content) {\n if (!isObjectLike(item)) {\n continue;\n }\n if (item.type === 'text' && typeof item.text === 'string') {\n parts.push({ type: 'text', content: item.text });\n } else if (item.type === 'tool-call') {\n parts.push(toolCallPart(item));\n }\n }\n return parts;\n}\n\nfunction partsFromTextAndToolCalls(text: unknown, toolCalls: unknown): Array<Record<string, unknown>> {\n const parts: Array<Record<string, unknown>> = [];\n if (typeof text === 'string' && text.length) {\n parts.push({ type: 'text', content: text });\n }\n if (Array.isArray(toolCalls)) {\n for (const toolCall of toolCalls) {\n if (isObjectLike(toolCall)) {\n parts.push(toolCallPart(toolCall));\n }\n }\n }\n return parts;\n}\n\nexport function captureToolError(span: Span, data: VercelAiChannelMessage, error: unknown): void {\n span.setStatus({\n code: SPAN_STATUS_ERROR,\n message: error instanceof Error ? error.message : 'tool_error',\n });\n\n const toolCall = isObjectLike(data.event.toolCall) ? data.event.toolCall : {};\n const toolName = asString(toolCall.toolName);\n const toolCallId = asString(data.event.toolCallId) ?? asString(toolCall.toolCallId);\n\n withScope(scope => {\n scope.setContext('trace', spanToTraceContext(span));\n if (toolName) {\n scope.setTag('vercel.ai.tool.name', toolName);\n }\n if (toolCallId) {\n scope.setTag('vercel.ai.tool.callId', toolCallId);\n }\n scope.setLevel('error');\n captureException(\n error instanceof Error ? error : new Error(typeof error === 'string' ? error : 'Tool execution failed'),\n {\n mechanism: { type: 'auto.vercelai.channel', handled: false },\n },\n );\n });\n}\n\nfunction getRecordingOptions(\n event: Record<string, unknown>,\n channelOptions: VercelAiChannelOptions,\n): {\n recordInputs: boolean;\n recordOutputs: boolean;\n enableTruncation: boolean;\n} {\n const genAI = getClient()?.getDataCollectionOptions().genAI;\n\n return {\n recordInputs: resolveRecording(channelOptions.recordInputs, event.recordInputs, genAI?.inputs),\n recordOutputs: resolveRecording(channelOptions.recordOutputs, event.recordOutputs, genAI?.outputs),\n enableTruncation: shouldEnableTruncation(channelOptions.enableTruncation),\n };\n}\n\n/**\n * Mirrors the OTel integration's `determineRecordingSettings` precedence: an integration-level option\n * wins, then the per-call `experimental_telemetry.recordInputs/recordOutputs` flag the AI SDK forwards\n * on the channel event, then the global `dataCollection.genAI` default.\n *\n * NOTE: the OTel integration also defaults recording to `true` for a call with\n * `experimental_telemetry: { isEnabled: true }`. The `ai:telemetry` channel does not expose `isEnabled`\n * (nor a resolved recording flag), so that per-call default cannot be reproduced here — v7 users who\n * want inputs/outputs recorded must enable `dataCollection.genAI` or set `recordInputs`/`recordOutputs`.\n */\nfunction resolveRecording(integrationOption: unknown, perCallOption: unknown, globalDefault: unknown): boolean {\n if (typeof integrationOption === 'boolean') {\n return integrationOption;\n }\n if (typeof perCallOption === 'boolean') {\n return perCallOption;\n }\n return globalDefault === true;\n}\n\nfunction buildInputMessageAttributes(\n event: Record<string, unknown>,\n enableTruncation: boolean,\n): Record<string, string | number | undefined> {\n const attributes: Record<string, string | number | undefined> = {};\n\n // `ai` >= 7 forbids system messages in `messages`/`prompt` and exposes the system prompt as a\n // separate `instructions` field. The OTel path lifts the system message out of the prompt into\n // `gen_ai.system_instructions` as `[{ type: 'text', content }]`; mirror that shape here.\n const instructions = asString(event.instructions);\n if (instructions) {\n attributes[GEN_AI_SYSTEM_INSTRUCTIONS_ATTRIBUTE] = stringify([{ type: 'text', content: instructions }]);\n }\n\n // The AI SDK start events extend `StandardizedPrompt`; messages live on `messages`, otherwise the\n // simpler `prompt` field is used.\n const messages = event.messages ?? event.prompt;\n if (messages !== undefined) {\n attributes[GEN_AI_INPUT_MESSAGES] = enableTruncation ? getTruncatedJsonString(messages) : stringify(messages);\n // The original (pre-truncation) message count, so the product can show how many were dropped.\n attributes[GEN_AI_INPUT_MESSAGES_ORIGINAL_LENGTH_ATTRIBUTE] = Array.isArray(messages) ? messages.length : 1;\n }\n\n return attributes;\n}\n"],"names":["asString","isObjectLike","tracingChannel","bindTracingChannelToSpan","isReadableStream","tapModelCallStream","GEN_AI_USAGE_INPUT_TOKENS","GEN_AI_USAGE_OUTPUT_TOKENS","GEN_AI_USAGE_TOTAL_TOKENS","sum","GEN_AI_OUTPUT_MESSAGES","spanToJSON","asNumber","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","GEN_AI_SYSTEM","GEN_AI_REQUEST_MODEL","_INTERNAL_skipAiProviderWrapping","GEN_AI_EMBEDDINGS_INPUT","stringify","attributes","startInactiveSpan","GEN_AI_OPERATION_NAME","GEN_AI_INVOKE_AGENT_SPAN_OP","GEN_AI_RESPONSE_STREAMING","GEN_AI_FUNCTION_ID","GEN_AI_REQUEST_AVAILABLE_TOOLS","GEN_AI_EXECUTE_TOOL_SPAN_OP","GEN_AI_TOOL_TYPE","GEN_AI_TOOL_NAME","GEN_AI_TOOL_INPUT","GEN_AI_TOOL_OUTPUT","GEN_AI_RESPONSE_FINISH_REASONS","GEN_AI_RESPONSE_ID","GEN_AI_RESPONSE_MODEL","getProviderMetadataAttributes","GEN_AI_CONVERSATION_ID_ATTRIBUTE","SPAN_STATUS_ERROR","withScope","spanToTraceContext","captureException","getClient","shouldEnableTruncation","GEN_AI_SYSTEM_INSTRUCTIONS_ATTRIBUTE","GEN_AI_INPUT_MESSAGES","getTruncatedJsonString","GEN_AI_INPUT_MESSAGES_ORIGINAL_LENGTH_ATTRIBUTE"],"mappings":";;;;;;;;AAyDA,MAAM,gCAAA,GAAmC,cAAA;AAEzC,MAAM,MAAA,GAAS,uBAAA;AAGf,MAAM,6BAAA,GAAgC,qBAAA;AACtC,MAAM,iCAAA,GAAoC,yBAAA;AAC1C,MAAM,2BAAA,GAA8B,YAAA;AACpC,MAAM,uBAAA,GAA0B,QAAA;AAGhC,MAAM,iCAAA,GAAoC,kBAAA;AAE1C,MAAM,2BAAA,GAA8B,WAAA;AAGpC,MAAM,gCAAA,GAAmC,uBAAA;AACzC,MAAM,kCAAA,GAAqC,0BAAA;AAC3C,MAAM,wCAAA,GAA2C,+BAAA;AAMjD,MAAM,mBAAA,uBAA0B,GAAA,EAAwD;AASxF,MAAM,wBAAA,uBAA+B,GAAA,EAAiC;AAMtE,MAAM,uBAAA,uBAA8B,GAAA,EAAkB;AAItD,MAAM,oBAAA,uBAA2B,GAAA,CAAsB;AAAA,EACrD,cAAA;AAAA,EACA,YAAA;AAAA,EACA,gBAAA;AAAA,EACA,OAAA;AAAA,EACA,WAAA;AAAA,EACA;AACF,CAAC,CAAA;AAGM,SAAS,iBAAiB,IAAA,EAAoC;AACnE,EAAA,IAAI,CAAC,oBAAA,CAAqB,GAAA,CAAI,IAAA,CAAK,IAAI,CAAA,EAAG;AACxC,IAAA;AAAA,EACF;AACA,EAAA,MAAM,MAAA,GAASA,aAAA,CAAS,IAAA,CAAK,KAAA,CAAM,MAAM,CAAA;AACzC,EAAA,IAAI,MAAA,EAAQ;AACV,IAAA,oBAAA,CAAqB,MAAM,CAAA;AAAA,EAC7B;AACF;AAQO,SAAS,qBAAqB,MAAA,EAAsB;AACzD,EA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AAA,EAA4B,aAAA,EAAwB,aAAA,EAAiC;AAC7G,EAAA,IAAI,OAAO,sBAAsB,SAAA,EAAW;AAC1C,IAAA,OAAO,iBAAA;AAAA,EACT;AACA,EAAA,IAAI,OAAO,kBAAkB,SAAA,EAAW;AACtC,IAAA,OAAO,aAAA;AAAA,EACT;AACA,EAAA,OAAO,aAAA,KAAkB,IAAA;AAC3B;AAEA,SAAS,2BAAA,CACP,OACA,gBAAA,EAC6C;AAC7C,EAAA,MAAMtB,eAA0D,EAAC;AAKjE,EAAA,MAAM,YAAA,GAAenB,aAAA,CAAS,KAAA,CAAM,YAAY,CAAA;AAChD,EAAA,IAAI,YAAA,EAAc;AAChB,IAAAmB,YAAA,CAAWuB,yCAAoC,CAAA,GAAIxB,cAAA,CAAU,CAAC,EAAE,MAAM,MAAA,EAAQ,OAAA,EAAS,YAAA,EAAc,CAAC,CAAA;AAAA,EACxG;AAIA,EAAA,MAAM,QAAA,GAAW,KAAA,CAAM,QAAA,IAAY,KAAA,CAAM,MAAA;AACzC,EAAA,IAAI,aAAa,MAAA,EAAW;AAC1B,IAAAC,YAAA,CAAWwB,gCAAqB,CAAA,GAAI,gBAAA,GAAmBC,4BAAuB,QAAQ,CAAA,GAAI1B,eAAU,QAAQ,CAAA;AAE5G,IAAAC,YAAA,CAAW0B,oDAA+C,CAAA,GAAI,KAAA,CAAM,QAAQ,QAAQ,CAAA,GAAI,SAAS,MAAA,GAAS,CAAA;AAAA,EAC5G;AAEA,EAAA,OAAO1B,YAAA;AACT;;;;;;;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as diagnosticsChannel from 'node:diagnostics_channel';
|
|
2
|
+
import { CACHE_KEY } from '@sentry/conventions/attributes';
|
|
2
3
|
import { defineIntegration, debug, waitForTracingChannelBinding, startSpan, startInactiveSpan, SPAN_KIND, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
|
|
3
4
|
import { DEBUG_BUILD } from '../../debug-build.js';
|
|
4
5
|
import { CHANNELS } from '../../orchestrion/channels.js';
|
|
@@ -13,7 +14,13 @@ function getSpanName(loader, operation) {
|
|
|
13
14
|
const name = loader?.name;
|
|
14
15
|
return name ? `${MODULE_NAME}.${operation} ${name}` : `${MODULE_NAME}.${operation}`;
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
+
function getCacheKey(keyArg) {
|
|
18
|
+
if (Array.isArray(keyArg)) {
|
|
19
|
+
return keyArg.map((key) => String(key));
|
|
20
|
+
}
|
|
21
|
+
return keyArg == null ? void 0 : [String(keyArg)];
|
|
22
|
+
}
|
|
23
|
+
function makeSpanOptions(loader, operation, keyArg) {
|
|
17
24
|
const isCacheGet = operation === "load" || operation === "loadMany" || operation === "batch";
|
|
18
25
|
return {
|
|
19
26
|
name: getSpanName(loader, operation),
|
|
@@ -24,7 +31,8 @@ function makeSpanOptions(loader, operation) {
|
|
|
24
31
|
op: isCacheGet ? CACHE_GET_OP : void 0,
|
|
25
32
|
onlyIfParent: true,
|
|
26
33
|
attributes: {
|
|
27
|
-
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN
|
|
34
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
|
|
35
|
+
[CACHE_KEY]: isCacheGet ? getCacheKey(keyArg) : void 0
|
|
28
36
|
}
|
|
29
37
|
};
|
|
30
38
|
}
|
|
@@ -57,7 +65,7 @@ function subscribeConstruct() {
|
|
|
57
65
|
const original = batchLoadFn;
|
|
58
66
|
const wrapped = function(...args) {
|
|
59
67
|
return startSpan(
|
|
60
|
-
{ ...makeSpanOptions(this, "batch"), links: this._batch?.spanLinks },
|
|
68
|
+
{ ...makeSpanOptions(this, "batch", args[0]), links: this._batch?.spanLinks },
|
|
61
69
|
() => original.apply(this, args)
|
|
62
70
|
);
|
|
63
71
|
};
|
|
@@ -67,7 +75,9 @@ function subscribeConstruct() {
|
|
|
67
75
|
}
|
|
68
76
|
function subscribeLoad() {
|
|
69
77
|
const channel = diagnosticsChannel.tracingChannel(CHANNELS.DATALOADER_LOAD);
|
|
70
|
-
bindTracingChannelToSpan(channel, (data) => startInactiveSpanFor(data.self, "load"), {
|
|
78
|
+
bindTracingChannelToSpan(channel, (data) => startInactiveSpanFor(data.self, "load", data.arguments[0]), {
|
|
79
|
+
requiresParentSpan: true
|
|
80
|
+
});
|
|
71
81
|
channel.end.subscribe((message) => {
|
|
72
82
|
const data = message;
|
|
73
83
|
const span = data._sentrySpan;
|
|
@@ -80,12 +90,12 @@ function subscribeLoad() {
|
|
|
80
90
|
function subscribeSimpleOperation(channelName, operation) {
|
|
81
91
|
bindTracingChannelToSpan(
|
|
82
92
|
diagnosticsChannel.tracingChannel(channelName),
|
|
83
|
-
(data) => startInactiveSpanFor(data.self, operation),
|
|
93
|
+
(data) => startInactiveSpanFor(data.self, operation, data.arguments[0]),
|
|
84
94
|
{ requiresParentSpan: true }
|
|
85
95
|
);
|
|
86
96
|
}
|
|
87
|
-
function startInactiveSpanFor(loader, operation) {
|
|
88
|
-
return startInactiveSpan(makeSpanOptions(loader, operation));
|
|
97
|
+
function startInactiveSpanFor(loader, operation, keyArg) {
|
|
98
|
+
return startInactiveSpan(makeSpanOptions(loader, operation, keyArg));
|
|
89
99
|
}
|
|
90
100
|
const dataloaderChannelIntegration = defineIntegration(_dataloaderChannelIntegration);
|
|
91
101
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataloader.js","sources":["../../../../src/integrations/tracing-channel/dataloader.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { IntegrationFn, Span, StartSpanOptions } from '@sentry/core';\nimport {\n debug,\n defineIntegration,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_KIND,\n startInactiveSpan,\n startSpan,\n waitForTracingChannelBinding,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport type { ChannelName } from '../../orchestrion/channels';\nimport { CHANNELS } from '../../orchestrion/channels';\nimport type { TracingChannelPayloadWithSpan } from '../../tracing-channel';\nimport { bindTracingChannelToSpan } from '../../tracing-channel';\n\n// NOTE: this uses the same name as the OTel integration by design.\n// When enabled, the OTel 'Dataloader' integration is omitted from the default set.\nconst INTEGRATION_NAME = 'Dataloader' as const;\n\nconst MODULE_NAME = 'dataloader';\nconst ORIGIN = 'auto.db.orchestrion.dataloader';\n\n// `load`, `loadMany` and `batch` are cache reads; the rest are cache mutations that get no `op`.\nconst CACHE_GET_OP = 'cache.get';\n\ntype Operation = 'load' | 'loadMany' | 'batch' | 'prime' | 'clear' | 'clearAll';\n\n// The link shape shared between a `load` span and the `batch` span it triggers.\ntype DataLoaderSpanLink = { context: ReturnType<Span['spanContext']> };\n\n// The private batch object `dataloader` stores on the loader. We stash the pending `load` span links\n// here (matching the vendored OTel instrumentation) so the batch span can link back to them.\ninterface DataLoaderBatch {\n spanLinks?: DataLoaderSpanLink[];\n}\n\ninterface DataLoaderInstance {\n name?: string | null;\n _batch?: DataLoaderBatch | null;\n}\n\n/**\n * The shape orchestrion's transform attaches to the tracing-channel `context`. Documented here rather\n * than imported because orchestrion's runtime doesn't export it.\n */\ninterface DataLoaderChannelContext {\n arguments: unknown[];\n self?: DataLoaderInstance;\n result?: unknown;\n error?: unknown;\n}\n\n// Marks a wrapped `batchLoadFn` so a re-used loader (or a double construct) isn't wrapped twice.\nconst WRAPPED = Symbol('sentry.dataloader.wrapped');\n\nfunction getSpanName(loader: DataLoaderInstance | undefined, operation: Operation): string {\n const name = loader?.name;\n\n return name ? `${MODULE_NAME}.${operation} ${name}` : `${MODULE_NAME}.${operation}`;\n}\n\nfunction makeSpanOptions(loader: DataLoaderInstance | undefined, operation: Operation): StartSpanOptions {\n const isCacheGet = operation === 'load' || operation === 'loadMany' || operation === 'batch';\n\n return {\n name: getSpanName(loader, operation),\n // Every direct operation (`load`/`loadMany`/`prime`/`clear`/`clearAll`) is a client call, matching\n // the vendored OTel instrumentation. The `batch` runs off a deferred tick with no obvious network\n // peer, so it gets no kind.\n kind: operation === 'batch' ? undefined : SPAN_KIND.CLIENT,\n op: isCacheGet ? CACHE_GET_OP : undefined,\n onlyIfParent: true,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n },\n };\n}\n\nconst _dataloaderChannelIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n // `tracingChannel` is unavailable before Node 18.19 so do nothing in that case.\n if (!diagnosticsChannel.tracingChannel) {\n return;\n }\n\n DEBUG_BUILD && debug.log('[orchestrion:dataloader] subscribing to dataloader tracing channels');\n\n waitForTracingChannelBinding(() => {\n subscribeConstruct();\n subscribeLoad();\n subscribeSimpleOperation(CHANNELS.DATALOADER_LOAD_MANY, 'loadMany');\n subscribeSimpleOperation(CHANNELS.DATALOADER_PRIME, 'prime');\n subscribeSimpleOperation(CHANNELS.DATALOADER_CLEAR, 'clear');\n subscribeSimpleOperation(CHANNELS.DATALOADER_CLEAR_ALL, 'clearAll');\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Wraps the user's `batchLoadFn` (constructor arg 0) so the batch span opens when it runs on the\n * deferred dispatch tick. The span links back to the `load` calls that populated the batch.\n */\nfunction subscribeConstruct(): void {\n diagnosticsChannel\n .tracingChannel<DataLoaderChannelContext>(CHANNELS.DATALOADER_CONSTRUCT)\n .start.subscribe(message => {\n const data = message as DataLoaderChannelContext;\n const batchLoadFn = data.arguments[0];\n if (typeof batchLoadFn !== 'function' || (batchLoadFn as { [WRAPPED]?: boolean })[WRAPPED]) {\n return;\n }\n\n const original = batchLoadFn as (...args: unknown[]) => unknown;\n const wrapped = function (this: DataLoaderInstance, ...args: unknown[]): unknown {\n return startSpan({ ...makeSpanOptions(this, 'batch'), links: this._batch?.spanLinks }, () =>\n original.apply(this, args),\n );\n };\n (wrapped as { [WRAPPED]?: boolean })[WRAPPED] = true;\n data.arguments[0] = wrapped;\n });\n}\n\n/**\n * `load` is a cache read that additionally records its span so the batch it feeds into can link back.\n *\n * The span itself is `Async` (ends on `asyncEnd`, so its duration covers the awaited load). But the\n * link has to be recorded earlier, on the synchronous `end` (fired when `load` returns): the batch\n * dispatches on a deferred tick and reads `spanLinks` at batch-span creation, which happens BEFORE\n * `load`'s promise resolves (`asyncEnd`) — so recording at span end would be too late and drop the\n * link. The sync `end` runs after `dataloader` has assigned `this._batch` in `load`'s body and before\n * the deferred dispatch, so the link lands in time.\n */\nfunction subscribeLoad(): void {\n const channel = diagnosticsChannel.tracingChannel<DataLoaderChannelContext>(CHANNELS.DATALOADER_LOAD);\n\n bindTracingChannelToSpan(channel, data => startInactiveSpanFor(data.self, 'load'), { requiresParentSpan: true });\n\n channel.end.subscribe(message => {\n const data = message as TracingChannelPayloadWithSpan<DataLoaderChannelContext>;\n const span = data._sentrySpan;\n const batch = data.self?._batch;\n if (span && batch && span.isRecording()) {\n (batch.spanLinks ??= []).push({ context: span.spanContext() });\n }\n });\n}\n\nfunction subscribeSimpleOperation(channelName: ChannelName, operation: Operation): void {\n bindTracingChannelToSpan(\n diagnosticsChannel.tracingChannel<DataLoaderChannelContext>(channelName),\n data => startInactiveSpanFor(data.self, operation),\n { requiresParentSpan: true },\n );\n}\n\nfunction startInactiveSpanFor(loader: DataLoaderInstance | undefined, operation: Operation): Span {\n return startInactiveSpan(makeSpanOptions(loader, operation));\n}\n\n/**\n * EXPERIMENTAL: orchestrion-driven `dataloader` integration.\n *\n * Subscribes to the `orchestrion:dataloader:*` diagnostics_channels that the orchestrion code\n * transform injects into `dataloader`'s constructor and prototype methods. Requires the orchestrion\n * runtime hook or bundler plugin to be active.\n */\nexport const dataloaderChannelIntegration = defineIntegration(_dataloaderChannelIntegration);\n"],"names":[],"mappings":";;;;;;AAmBA,MAAM,gBAAA,GAAmB,YAAA;AAEzB,MAAM,WAAA,GAAc,YAAA;AACpB,MAAM,MAAA,GAAS,gCAAA;AAGf,MAAM,YAAA,GAAe,WAAA;AA8BrB,MAAM,OAAA,0B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AAW;AAC/B,IAAA,MAAM,IAAA,GAAO,OAAA;AACb,IAAA,MAAM,OAAO,IAAA,CAAK,WAAA;AAClB,IAAA,MAAM,KAAA,GAAQ,KAAK,IAAA,EAAM,MAAA;AACzB,IAAA,IAAI,IAAA,IAAQ,KAAA,IAAS,IAAA,CAAK,WAAA,EAAY,EAAG;AACvC,MAAA,CAAC,KAAA,CAAM,SAAA,KAAN,KAAA,CAAM,SAAA,GAAc,EAAC,CAAA,EAAG,IAAA,CAAK,EAAE,OAAA,EAAS,IAAA,CAAK,WAAA,EAAY,EAAG,CAAA;AAAA,IAC/D;AAAA,EACF,CAAC,CAAA;AACH;AAEA,SAAS,wBAAA,CAAyB,aAA0B,SAAA,EAA4B;AACtF,EAAA,wBAAA;AAAA,IACE,kBAAA,CAAmB,eAAyC,WAAW,CAAA;AAAA,IACvE,CAAA,IAAA,KAAQ,oBAAA,CAAqB,IAAA,CAAK,IAAA,EAAM,SAAS,CAAA;AAAA,IACjD,EAAE,oBAAoB,IAAA;AAAK,GAC7B;AACF;AAEA,SAAS,oBAAA,CAAqB,QAAwC,SAAA,EAA4B;AAChG,EAAA,OAAO,iBAAA,CAAkB,eAAA,CAAgB,MAAA,EAAQ,SAAS,CAAC,CAAA;AAC7D;AASO,MAAM,4BAAA,GAA+B,kBAAkB,6BAA6B;;;;"}
|
|
1
|
+
{"version":3,"file":"dataloader.js","sources":["../../../../src/integrations/tracing-channel/dataloader.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport { CACHE_KEY } from '@sentry/conventions/attributes';\nimport type { IntegrationFn, Span, StartSpanOptions } from '@sentry/core';\nimport {\n debug,\n defineIntegration,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_KIND,\n startInactiveSpan,\n startSpan,\n waitForTracingChannelBinding,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport type { ChannelName } from '../../orchestrion/channels';\nimport { CHANNELS } from '../../orchestrion/channels';\nimport type { TracingChannelPayloadWithSpan } from '../../tracing-channel';\nimport { bindTracingChannelToSpan } from '../../tracing-channel';\n\n// NOTE: this uses the same name as the OTel integration by design.\n// When enabled, the OTel 'Dataloader' integration is omitted from the default set.\nconst INTEGRATION_NAME = 'Dataloader' as const;\n\nconst MODULE_NAME = 'dataloader';\nconst ORIGIN = 'auto.db.orchestrion.dataloader';\n\n// `load`, `loadMany` and `batch` are cache reads; the rest are cache mutations that get no `op`.\nconst CACHE_GET_OP = 'cache.get';\n\ntype Operation = 'load' | 'loadMany' | 'batch' | 'prime' | 'clear' | 'clearAll';\n\n// The link shape shared between a `load` span and the `batch` span it triggers.\ntype DataLoaderSpanLink = { context: ReturnType<Span['spanContext']> };\n\n// The private batch object `dataloader` stores on the loader. We stash the pending `load` span links\n// here (matching the vendored OTel instrumentation) so the batch span can link back to them.\ninterface DataLoaderBatch {\n spanLinks?: DataLoaderSpanLink[];\n}\n\ninterface DataLoaderInstance {\n name?: string | null;\n _batch?: DataLoaderBatch | null;\n}\n\n/**\n * The shape orchestrion's transform attaches to the tracing-channel `context`. Documented here rather\n * than imported because orchestrion's runtime doesn't export it.\n */\ninterface DataLoaderChannelContext {\n arguments: unknown[];\n self?: DataLoaderInstance;\n result?: unknown;\n error?: unknown;\n}\n\n// Marks a wrapped `batchLoadFn` so a re-used loader (or a double construct) isn't wrapped twice.\nconst WRAPPED = Symbol('sentry.dataloader.wrapped');\n\nfunction getSpanName(loader: DataLoaderInstance | undefined, operation: Operation): string {\n const name = loader?.name;\n\n return name ? `${MODULE_NAME}.${operation} ${name}` : `${MODULE_NAME}.${operation}`;\n}\n\n// `load` receives a single key, `loadMany`/`batch` receive a key array. Normalize both to the\n// `string[]` shape `cache.key` expects.\nfunction getCacheKey(keyArg: unknown): string[] | undefined {\n if (Array.isArray(keyArg)) {\n return keyArg.map(key => String(key));\n }\n\n return keyArg == null ? undefined : [String(keyArg)];\n}\n\nfunction makeSpanOptions(\n loader: DataLoaderInstance | undefined,\n operation: Operation,\n keyArg?: unknown,\n): StartSpanOptions {\n const isCacheGet = operation === 'load' || operation === 'loadMany' || operation === 'batch';\n\n return {\n name: getSpanName(loader, operation),\n // Every direct operation (`load`/`loadMany`/`prime`/`clear`/`clearAll`) is a client call, matching\n // the vendored OTel instrumentation. The `batch` runs off a deferred tick with no obvious network\n // peer, so it gets no kind.\n kind: operation === 'batch' ? undefined : SPAN_KIND.CLIENT,\n op: isCacheGet ? CACHE_GET_OP : undefined,\n onlyIfParent: true,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [CACHE_KEY]: isCacheGet ? getCacheKey(keyArg) : undefined,\n },\n };\n}\n\nconst _dataloaderChannelIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n // `tracingChannel` is unavailable before Node 18.19 so do nothing in that case.\n if (!diagnosticsChannel.tracingChannel) {\n return;\n }\n\n DEBUG_BUILD && debug.log('[orchestrion:dataloader] subscribing to dataloader tracing channels');\n\n waitForTracingChannelBinding(() => {\n subscribeConstruct();\n subscribeLoad();\n subscribeSimpleOperation(CHANNELS.DATALOADER_LOAD_MANY, 'loadMany');\n subscribeSimpleOperation(CHANNELS.DATALOADER_PRIME, 'prime');\n subscribeSimpleOperation(CHANNELS.DATALOADER_CLEAR, 'clear');\n subscribeSimpleOperation(CHANNELS.DATALOADER_CLEAR_ALL, 'clearAll');\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Wraps the user's `batchLoadFn` (constructor arg 0) so the batch span opens when it runs on the\n * deferred dispatch tick. The span links back to the `load` calls that populated the batch.\n */\nfunction subscribeConstruct(): void {\n diagnosticsChannel\n .tracingChannel<DataLoaderChannelContext>(CHANNELS.DATALOADER_CONSTRUCT)\n .start.subscribe(message => {\n const data = message as DataLoaderChannelContext;\n const batchLoadFn = data.arguments[0];\n if (typeof batchLoadFn !== 'function' || (batchLoadFn as { [WRAPPED]?: boolean })[WRAPPED]) {\n return;\n }\n\n const original = batchLoadFn as (...args: unknown[]) => unknown;\n const wrapped = function (this: DataLoaderInstance, ...args: unknown[]): unknown {\n // `batchLoadFn` receives the batched keys as its first argument.\n return startSpan({ ...makeSpanOptions(this, 'batch', args[0]), links: this._batch?.spanLinks }, () =>\n original.apply(this, args),\n );\n };\n (wrapped as { [WRAPPED]?: boolean })[WRAPPED] = true;\n data.arguments[0] = wrapped;\n });\n}\n\n/**\n * `load` is a cache read that additionally records its span so the batch it feeds into can link back.\n *\n * The span itself is `Async` (ends on `asyncEnd`, so its duration covers the awaited load). But the\n * link has to be recorded earlier, on the synchronous `end` (fired when `load` returns): the batch\n * dispatches on a deferred tick and reads `spanLinks` at batch-span creation, which happens BEFORE\n * `load`'s promise resolves (`asyncEnd`) — so recording at span end would be too late and drop the\n * link. The sync `end` runs after `dataloader` has assigned `this._batch` in `load`'s body and before\n * the deferred dispatch, so the link lands in time.\n */\nfunction subscribeLoad(): void {\n const channel = diagnosticsChannel.tracingChannel<DataLoaderChannelContext>(CHANNELS.DATALOADER_LOAD);\n\n bindTracingChannelToSpan(channel, data => startInactiveSpanFor(data.self, 'load', data.arguments[0]), {\n requiresParentSpan: true,\n });\n\n channel.end.subscribe(message => {\n const data = message as TracingChannelPayloadWithSpan<DataLoaderChannelContext>;\n const span = data._sentrySpan;\n const batch = data.self?._batch;\n if (span && batch && span.isRecording()) {\n (batch.spanLinks ??= []).push({ context: span.spanContext() });\n }\n });\n}\n\nfunction subscribeSimpleOperation(channelName: ChannelName, operation: Operation): void {\n bindTracingChannelToSpan(\n diagnosticsChannel.tracingChannel<DataLoaderChannelContext>(channelName),\n data => startInactiveSpanFor(data.self, operation, data.arguments[0]),\n { requiresParentSpan: true },\n );\n}\n\nfunction startInactiveSpanFor(loader: DataLoaderInstance | undefined, operation: Operation, keyArg?: unknown): Span {\n return startInactiveSpan(makeSpanOptions(loader, operation, keyArg));\n}\n\n/**\n * EXPERIMENTAL: orchestrion-driven `dataloader` integration.\n *\n * Subscribes to the `orchestrion:dataloader:*` diagnostics_channels that the orchestrion code\n * transform injects into `dataloader`'s constructor and prototype methods. Requires the orchestrion\n * runtime hook or bundler plugin to be active.\n */\nexport const dataloaderChannelIntegration = defineIntegration(_dataloaderChannelIntegration);\n"],"names":[],"mappings":";;;;;;;AAoBA,MAAM,gBAAA,GAAmB,YAAA;AAEzB,MAAM,WAAA,GAAc,YAAA;AACpB,MAAM,MAAA,GAAS,gCAAA;AAGf,MAAM,YAAA,GAAe,WAAA;AA8BrB,MAAM,OAAA,0BAAiB,2BAA2B,CAAA;AAElD,SAAS,WAAA,CAAY,QAAwC,SAAA,EAA8B;AACzF,EAAA,MAAM,OAAO,MAAA,EAAQ,IAAA;AAErB,EAAA,OAAO,IAAA,GAAO,CAAA,EAAG,WAAW,CAAA,CAAA,EAAI,SAAS,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA,GAAK,CAAA,EAAG,WAAW,CAAA,CAAA,EAAI,SAAS,CAAA,CAAA;AACnF;AAIA,SAAS,YAAY,MAAA,EAAuC;AAC1D,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,MAAM,CAAA,EAAG;AACzB,IAAA,OAAO,MAAA,CAAO,GAAA,CAAI,CAAA,GAAA,KAAO,MAAA,CAAO,GAAG,CAAC,CAAA;AAAA,EACtC;AAEA,EAAA,OAAO,UAAU,IAAA,GAAO,MAAA,GAAY,CAAC,MAAA,CAAO,MAAM,CAAC,CAAA;AACrD;AAEA,SAAS,eAAA,CACP,MAAA,EACA,SAAA,EACA,MAAA,EACkB;AAClB,EAAA,MAAM,UAAA,GAAa,SAAA,KAAc,MAAA,IAAU,SAAA,KAAc,cAAc,SAAA,KAAc,OAAA;AAErF,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,WAAA,CAAY,MAAA,EAAQ,SAAS,CAAA;AAAA;AAAA;AAAA;AAAA,IAInC,IAAA,EAAM,SAAA,KAAc,OAAA,GAAU,MAAA,GAAY,SAAA,CAAU,MAAA;AAAA,IACpD,EAAA,EAAI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AA;AAAA,IACE,kBAAA,CAAmB,eAAyC,WAAW,CAAA;AAAA,IACvE,CAAA,IAAA,KAAQ,qBAAqB,IAAA,CAAK,IAAA,EAAM,WAAW,IAAA,CAAK,SAAA,CAAU,CAAC,CAAC,CAAA;AAAA,IACpE,EAAE,oBAAoB,IAAA;AAAK,GAC7B;AACF;AAEA,SAAS,oBAAA,CAAqB,MAAA,EAAwC,SAAA,EAAsB,MAAA,EAAwB;AAClH,EAAA,OAAO,iBAAA,CAAkB,eAAA,CAAgB,MAAA,EAAQ,SAAA,EAAW,MAAM,CAAC,CAAA;AACrE;AASO,MAAM,4BAAA,GAA+B,kBAAkB,6BAA6B;;;;"}
|
|
@@ -3,7 +3,7 @@ import { instrumentFastify as instrumentFastify$1 } from './instrumentation.js';
|
|
|
3
3
|
import { INTEGRATION_NAME, defaultShouldHandleError } from './utils.js';
|
|
4
4
|
import { subscribeToFastifyErrorChannel, handleFastifyError as handleFastifyError$1 } from './errors.js';
|
|
5
5
|
|
|
6
|
-
const _fastifyIntegration = (({ shouldHandleError }) => {
|
|
6
|
+
const _fastifyIntegration = (({ shouldHandleError } = {}) => {
|
|
7
7
|
let _shouldHandleError;
|
|
8
8
|
return {
|
|
9
9
|
name: INTEGRATION_NAME,
|
|
@@ -20,9 +20,7 @@ const _fastifyIntegration = (({ shouldHandleError }) => {
|
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
});
|
|
23
|
-
const fastifyIntegration = defineIntegration(
|
|
24
|
-
(options = {}) => _fastifyIntegration(options)
|
|
25
|
-
);
|
|
23
|
+
const fastifyIntegration = defineIntegration(_fastifyIntegration);
|
|
26
24
|
const instrumentFastify = instrumentFastify$1;
|
|
27
25
|
const handleFastifyError = handleFastifyError$1;
|
|
28
26
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing-channel/fastify/index.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport type { FastifyIntegration, FastifyReply, FastifyRequest } from './types';\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing-channel/fastify/index.ts"],"sourcesContent":["import type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration } from '@sentry/core';\nimport type { FastifyIntegration, FastifyReply, FastifyRequest } from './types';\nimport { instrumentFastify as _instrumentFastify } from './instrumentation';\nimport { defaultShouldHandleError, INTEGRATION_NAME } from './utils';\nimport { subscribeToFastifyErrorChannel, handleFastifyError as _handleFastifyError } from './errors';\n\n/**\n * Options for the Fastify integration.\n *\n * `shouldHandleError` - Callback method deciding whether error should be captured and sent to Sentry\n * This is used on Fastify v5 where Sentry handles errors in the diagnostics channel.\n * Fastify v3 and v4 use `setupFastifyErrorHandler` instead.\n *\n * @example\n *\n * ```javascript\n * Sentry.init({\n * integrations: [\n * Sentry.fastifyIntegration({\n * shouldHandleError(_error, _request, reply) {\n * return reply.statusCode >= 500;\n * },\n * });\n * },\n * });\n * ```\n *\n */\ninterface FastifyIntegrationOptions {\n /**\n * Callback method deciding whether error should be captured and sent to Sentry\n * This is used on Fastify v5 where Sentry handles errors in the diagnostics channel.\n * Fastify v3 and v4 use `setupFastifyErrorHandler` instead.\n *\n * @param error Captured Fastify error\n * @param request Fastify request (or any object containing at least method, routeOptions.url, and routerPath)\n * @param reply Fastify reply (or any object containing at least statusCode)\n */\n shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n}\n\nconst _fastifyIntegration = (({ shouldHandleError }: Partial<FastifyIntegrationOptions> = {}) => {\n let _shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean;\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n _shouldHandleError = shouldHandleError || defaultShouldHandleError;\n\n subscribeToFastifyErrorChannel();\n _instrumentFastify();\n },\n getShouldHandleError() {\n return _shouldHandleError;\n },\n setShouldHandleError(shouldHandleError: (error: Error, request: FastifyRequest, reply: FastifyReply) => boolean) {\n _shouldHandleError = shouldHandleError;\n },\n } satisfies FastifyIntegration;\n}) satisfies IntegrationFn;\n\n/**\n * Adds Sentry tracing instrumentation for [Fastify](https://fastify.dev/).\n * This integration supports Fastify v5 only.\n *\n * For more information, see the [fastify documentation](https://docs.sentry.io/platforms/javascript/guides/fastify/).\n *\n * @example\n * ```javascript\n * const Sentry = require('@sentry/node');\n *\n * Sentry.init({\n * integrations: [Sentry.fastifyIntegration()],\n * })\n * ```\n */\nexport const fastifyIntegration = defineIntegration(_fastifyIntegration);\n\n/**\n * @deprecated This export is deprecated and will not longer be exposed in the next major version.\n */\nexport const instrumentFastify = _instrumentFastify;\n\n/**\n * @deprecated This export is deprecated and will not longer be exposed in the next major version.\n */\nexport const handleFastifyError = _handleFastifyError;\n"],"names":["_instrumentFastify","shouldHandleError","_handleFastifyError"],"mappings":";;;;;AA0CA,MAAM,uBAAuB,CAAC,EAAE,iBAAA,EAAkB,GAAwC,EAAC,KAAM;AAC/F,EAAA,IAAI,kBAAA;AAEJ,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,kBAAA,GAAqB,iBAAA,IAAqB,wBAAA;AAE1C,MAAA,8BAAA,EAA+B;AAC/B,MAAAA,mBAAA,EAAmB;AAAA,IACrB,CAAA;AAAA,IACA,oBAAA,GAAuB;AACrB,MAAA,OAAO,kBAAA;AAAA,IACT,CAAA;AAAA,IACA,qBAAqBC,kBAAAA,EAA4F;AAC/G,MAAA,kBAAA,GAAqBA,kBAAAA;AAAA,IACvB;AAAA,GACF;AACF,CAAA,CAAA;AAiBO,MAAM,kBAAA,GAAqB,kBAAkB,mBAAmB;AAKhE,MAAM,iBAAA,GAAoBD;AAK1B,MAAM,kBAAA,GAAqBE;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../../src/integrations/tracing-channel/fastify/utils.ts"],"sourcesContent":["import type { FastifyReply, FastifyRequest } from './types';\n\nexport const INTEGRATION_NAME = 'Fastify';\n\n/**\n * Default function to determine if an error should be sent to Sentry\n *\n * 3xx and 4xx errors are not sent by default.\n */\nexport function defaultShouldHandleError(_error: Error, _request: FastifyRequest, reply: FastifyReply): boolean {\n const statusCode = reply.statusCode;\n // 3xx and 4xx errors are not sent by default.\n return statusCode >= 500 || statusCode <= 299;\n}\n"],"names":[],"mappings":"AAEO,MAAM,gBAAA,GAAmB;AAOzB,SAAS,wBAAA,CAAyB,MAAA,EAAe,QAAA,EAA0B,KAAA,EAA8B;AAC9G,EAAA,MAAM,aAAa,KAAA,CAAM,UAAA;AAEzB,EAAA,OAAO,UAAA,IAAc,OAAO,UAAA,IAAc,GAAA;AAC5C;;;;"}
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../src/integrations/tracing-channel/fastify/utils.ts"],"sourcesContent":["import type { FastifyReply, FastifyRequest } from './types';\n\nexport const INTEGRATION_NAME = 'Fastify' as const;\n\n/**\n * Default function to determine if an error should be sent to Sentry\n *\n * 3xx and 4xx errors are not sent by default.\n */\nexport function defaultShouldHandleError(_error: Error, _request: FastifyRequest, reply: FastifyReply): boolean {\n const statusCode = reply.statusCode;\n // 3xx and 4xx errors are not sent by default.\n return statusCode >= 500 || statusCode <= 299;\n}\n"],"names":[],"mappings":"AAEO,MAAM,gBAAA,GAAmB;AAOzB,SAAS,wBAAA,CAAyB,MAAA,EAAe,QAAA,EAA0B,KAAA,EAA8B;AAC9G,EAAA,MAAM,aAAa,KAAA,CAAM,UAAA;AAEzB,EAAA,OAAO,UAAA,IAAc,OAAO,UAAA,IAAc,GAAA;AAC5C;;;;"}
|