@sentry/server-utils 10.64.0 → 10.66.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/graphql/graphql-dc-subscriber.js +123 -0
- package/build/cjs/graphql/graphql-dc-subscriber.js.map +1 -0
- package/build/cjs/graphql/index.js +23 -0
- package/build/cjs/graphql/index.js.map +1 -0
- package/build/cjs/graphql/utils.js +92 -0
- package/build/cjs/graphql/utils.js.map +1 -0
- package/build/cjs/index.js +13 -11
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/integrations/tracing-channel/amqplib.js +420 -0
- package/build/cjs/integrations/tracing-channel/amqplib.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/dataloader.js +95 -0
- package/build/cjs/integrations/tracing-channel/dataloader.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/express/index.js +24 -0
- package/build/cjs/integrations/tracing-channel/express/index.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/express/instrumentation.js +173 -0
- package/build/cjs/integrations/tracing-channel/express/instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/express/route.js +76 -0
- package/build/cjs/integrations/tracing-channel/express/route.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/fastify/instrumentation.js +1 -1
- package/build/cjs/integrations/tracing-channel/fastify/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing-channel/generic-pool.js +34 -0
- package/build/cjs/integrations/tracing-channel/generic-pool.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/google-genai.js +96 -0
- package/build/cjs/integrations/tracing-channel/google-genai.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/graphql/constants.js +26 -0
- package/build/cjs/integrations/tracing-channel/graphql/constants.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/graphql/index.js +66 -0
- package/build/cjs/integrations/tracing-channel/graphql/index.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/graphql/resolvers.js +168 -0
- package/build/cjs/integrations/tracing-channel/graphql/resolvers.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/graphql/spans.js +102 -0
- package/build/cjs/integrations/tracing-channel/graphql/spans.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/ioredis.js +35 -32
- package/build/cjs/integrations/tracing-channel/ioredis.js.map +1 -1
- package/build/cjs/integrations/tracing-channel/kafkajs/consumer.js +71 -0
- package/build/cjs/integrations/tracing-channel/kafkajs/consumer.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/kafkajs/index.js +70 -0
- package/build/cjs/integrations/tracing-channel/kafkajs/index.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/kafkajs/semconv.js +22 -0
- package/build/cjs/integrations/tracing-channel/kafkajs/semconv.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/kafkajs/spans.js +119 -0
- package/build/cjs/integrations/tracing-channel/kafkajs/spans.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/knex.js +188 -0
- package/build/cjs/integrations/tracing-channel/knex.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/mysql.js +1 -1
- package/build/cjs/integrations/tracing-channel/mysql.js.map +1 -1
- package/build/cjs/integrations/tracing-channel/mysql2.js +83 -0
- package/build/cjs/integrations/tracing-channel/mysql2.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/openai.js.map +1 -1
- package/build/cjs/integrations/tracing-channel/postgres-js.js +191 -0
- package/build/cjs/integrations/tracing-channel/postgres-js.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/postgres.js +5 -5
- package/build/cjs/integrations/tracing-channel/postgres.js.map +1 -1
- package/build/cjs/integrations/tracing-channel/redis.js +227 -0
- package/build/cjs/integrations/tracing-channel/redis.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/vercel-ai.js +2 -2
- package/build/cjs/integrations/tracing-channel/vercel-ai.js.map +1 -1
- package/build/cjs/mongoose/mongoose-dc-subscriber.js +1 -1
- package/build/cjs/mongoose/mongoose-dc-subscriber.js.map +1 -1
- package/build/cjs/mysql2/index.js +23 -0
- package/build/cjs/mysql2/index.js.map +1 -0
- package/build/cjs/mysql2/mysql2-dc-subscriber.js +68 -0
- package/build/cjs/mysql2/mysql2-dc-subscriber.js.map +1 -0
- package/build/cjs/orchestrion/bundler/esbuild.js +11 -0
- package/build/cjs/orchestrion/bundler/esbuild.js.map +1 -0
- package/build/cjs/orchestrion/bundler/options.js +15 -0
- package/build/cjs/orchestrion/bundler/options.js.map +1 -0
- package/build/cjs/orchestrion/bundler/rollup.js +11 -0
- package/build/cjs/orchestrion/bundler/rollup.js.map +1 -0
- package/build/cjs/orchestrion/bundler/vite.js +4 -21
- package/build/cjs/orchestrion/bundler/vite.js.map +1 -1
- package/build/cjs/orchestrion/bundler/webpack.js +32 -0
- package/build/cjs/orchestrion/bundler/webpack.js.map +1 -0
- package/build/cjs/orchestrion/channels.js +53 -11
- package/build/cjs/orchestrion/channels.js.map +1 -1
- package/build/cjs/orchestrion/config/amqplib.js +81 -0
- package/build/cjs/orchestrion/config/amqplib.js.map +1 -0
- package/build/cjs/orchestrion/config/dataloader.js +53 -0
- package/build/cjs/orchestrion/config/dataloader.js.map +1 -0
- package/build/cjs/orchestrion/config/express.js +76 -0
- package/build/cjs/orchestrion/config/express.js.map +1 -0
- package/build/cjs/orchestrion/config/firebase.js +8 -0
- package/build/cjs/orchestrion/config/firebase.js.map +1 -0
- package/build/cjs/orchestrion/config/generic-pool.js +21 -0
- package/build/cjs/orchestrion/config/generic-pool.js.map +1 -0
- package/build/cjs/orchestrion/config/google-genai.js +38 -0
- package/build/cjs/orchestrion/config/google-genai.js.map +1 -0
- package/build/cjs/orchestrion/config/graphql.js +28 -0
- package/build/cjs/orchestrion/config/graphql.js.map +1 -0
- package/build/cjs/orchestrion/config/index.js +59 -14
- package/build/cjs/orchestrion/config/index.js.map +1 -1
- package/build/cjs/orchestrion/config/kafkajs.js +30 -0
- package/build/cjs/orchestrion/config/kafkajs.js.map +1 -0
- package/build/cjs/orchestrion/config/knex.js +43 -0
- package/build/cjs/orchestrion/config/knex.js.map +1 -0
- package/build/cjs/orchestrion/config/langchain.js +8 -0
- package/build/cjs/orchestrion/config/langchain.js.map +1 -0
- package/build/cjs/orchestrion/config/langgraph.js +8 -0
- package/build/cjs/orchestrion/config/langgraph.js.map +1 -0
- package/build/cjs/orchestrion/config/mongodb.js +8 -0
- package/build/cjs/orchestrion/config/mongodb.js.map +1 -0
- package/build/cjs/orchestrion/config/mongoose.js +8 -0
- package/build/cjs/orchestrion/config/mongoose.js.map +1 -0
- package/build/cjs/orchestrion/config/mysql2.js +32 -0
- package/build/cjs/orchestrion/config/mysql2.js.map +1 -0
- package/build/cjs/orchestrion/config/nestjs.js +122 -0
- package/build/cjs/orchestrion/config/nestjs.js.map +1 -0
- package/build/cjs/orchestrion/config/postgres.js +50 -0
- package/build/cjs/orchestrion/config/postgres.js.map +1 -0
- package/build/cjs/orchestrion/config/prisma.js +8 -0
- package/build/cjs/orchestrion/config/prisma.js.map +1 -0
- package/build/cjs/orchestrion/config/react-router.js +8 -0
- package/build/cjs/orchestrion/config/react-router.js.map +1 -0
- package/build/cjs/orchestrion/config/redis.js +76 -0
- package/build/cjs/orchestrion/config/redis.js.map +1 -0
- package/build/cjs/orchestrion/config/remix.js +8 -0
- package/build/cjs/orchestrion/config/remix.js.map +1 -0
- package/build/cjs/orchestrion/config/tedious.js +8 -0
- package/build/cjs/orchestrion/config/tedious.js.map +1 -0
- package/build/cjs/orchestrion/config/vercel-ai.js +18 -14
- package/build/cjs/orchestrion/config/vercel-ai.js.map +1 -1
- package/build/cjs/orchestrion/detect.js +12 -11
- package/build/cjs/orchestrion/detect.js.map +1 -1
- package/build/cjs/orchestrion/index.js +33 -1
- package/build/cjs/orchestrion/index.js.map +1 -1
- package/build/cjs/orchestrion/runtime/register.js +25 -14
- package/build/cjs/orchestrion/runtime/register.js.map +1 -1
- package/build/cjs/prisma/global.js +14 -0
- package/build/cjs/prisma/global.js.map +1 -0
- package/build/cjs/prisma/index.js +27 -0
- package/build/cjs/prisma/index.js.map +1 -0
- package/build/cjs/prisma/tracing-helper.js +211 -0
- package/build/cjs/prisma/tracing-helper.js.map +1 -0
- package/build/cjs/redis/index.js +23 -0
- package/build/cjs/redis/index.js.map +1 -0
- package/build/cjs/redis/redis-dc-subscriber.js +23 -35
- package/build/cjs/redis/redis-dc-subscriber.js.map +1 -1
- package/build/cjs/tracing-channel.js +7 -6
- package/build/cjs/tracing-channel.js.map +1 -1
- package/build/cjs/vercel-ai/util.js +112 -0
- package/build/cjs/vercel-ai/util.js.map +1 -0
- package/build/cjs/vercel-ai/vercel-ai-dc-subscriber.js +138 -74
- package/build/cjs/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -1
- package/build/cjs/vercel-ai/{vercel-ai-orchestrion-v6-subscriber.js → vercel-ai-orchestrion-subscriber.js} +153 -23
- package/build/cjs/vercel-ai/vercel-ai-orchestrion-subscriber.js.map +1 -0
- package/build/esm/graphql/graphql-dc-subscriber.js +116 -0
- package/build/esm/graphql/graphql-dc-subscriber.js.map +1 -0
- package/build/esm/graphql/index.js +21 -0
- package/build/esm/graphql/index.js.map +1 -0
- package/build/esm/graphql/utils.js +87 -0
- package/build/esm/graphql/utils.js.map +1 -0
- package/build/esm/index.js +4 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/integrations/tracing-channel/amqplib.js +418 -0
- package/build/esm/integrations/tracing-channel/amqplib.js.map +1 -0
- package/build/esm/integrations/tracing-channel/anthropic.js +1 -1
- package/build/esm/integrations/tracing-channel/dataloader.js +93 -0
- package/build/esm/integrations/tracing-channel/dataloader.js.map +1 -0
- package/build/esm/integrations/tracing-channel/express/index.js +22 -0
- package/build/esm/integrations/tracing-channel/express/index.js.map +1 -0
- package/build/esm/integrations/tracing-channel/express/instrumentation.js +171 -0
- package/build/esm/integrations/tracing-channel/express/instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing-channel/express/route.js +68 -0
- package/build/esm/integrations/tracing-channel/express/route.js.map +1 -0
- package/build/esm/integrations/tracing-channel/fastify/instrumentation.js +2 -2
- package/build/esm/integrations/tracing-channel/fastify/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing-channel/generic-pool.js +32 -0
- package/build/esm/integrations/tracing-channel/generic-pool.js.map +1 -0
- package/build/esm/integrations/tracing-channel/google-genai.js +94 -0
- package/build/esm/integrations/tracing-channel/google-genai.js.map +1 -0
- package/build/esm/integrations/tracing-channel/graphql/constants.js +14 -0
- package/build/esm/integrations/tracing-channel/graphql/constants.js.map +1 -0
- package/build/esm/integrations/tracing-channel/graphql/index.js +63 -0
- package/build/esm/integrations/tracing-channel/graphql/index.js.map +1 -0
- package/build/esm/integrations/tracing-channel/graphql/resolvers.js +164 -0
- package/build/esm/integrations/tracing-channel/graphql/resolvers.js.map +1 -0
- package/build/esm/integrations/tracing-channel/graphql/spans.js +96 -0
- package/build/esm/integrations/tracing-channel/graphql/spans.js.map +1 -0
- package/build/esm/integrations/tracing-channel/ioredis.js +36 -34
- package/build/esm/integrations/tracing-channel/ioredis.js.map +1 -1
- package/build/esm/integrations/tracing-channel/kafkajs/consumer.js +67 -0
- package/build/esm/integrations/tracing-channel/kafkajs/consumer.js.map +1 -0
- package/build/esm/integrations/tracing-channel/kafkajs/index.js +68 -0
- package/build/esm/integrations/tracing-channel/kafkajs/index.js.map +1 -0
- package/build/esm/integrations/tracing-channel/kafkajs/semconv.js +12 -0
- package/build/esm/integrations/tracing-channel/kafkajs/semconv.js.map +1 -0
- package/build/esm/integrations/tracing-channel/kafkajs/spans.js +112 -0
- package/build/esm/integrations/tracing-channel/kafkajs/spans.js.map +1 -0
- package/build/esm/integrations/tracing-channel/knex.js +186 -0
- package/build/esm/integrations/tracing-channel/knex.js.map +1 -0
- package/build/esm/integrations/tracing-channel/mysql.js +2 -2
- package/build/esm/integrations/tracing-channel/mysql.js.map +1 -1
- package/build/esm/integrations/tracing-channel/mysql2.js +81 -0
- package/build/esm/integrations/tracing-channel/mysql2.js.map +1 -0
- package/build/esm/integrations/tracing-channel/openai.js +1 -1
- package/build/esm/integrations/tracing-channel/openai.js.map +1 -1
- package/build/esm/integrations/tracing-channel/postgres-js.js +189 -0
- package/build/esm/integrations/tracing-channel/postgres-js.js.map +1 -0
- package/build/esm/integrations/tracing-channel/postgres.js +6 -6
- package/build/esm/integrations/tracing-channel/postgres.js.map +1 -1
- package/build/esm/integrations/tracing-channel/redis.js +225 -0
- package/build/esm/integrations/tracing-channel/redis.js.map +1 -0
- package/build/esm/integrations/tracing-channel/vercel-ai.js +1 -1
- package/build/esm/integrations/tracing-channel/vercel-ai.js.map +1 -1
- package/build/esm/mongoose/mongoose-dc-subscriber.js +2 -2
- package/build/esm/mongoose/mongoose-dc-subscriber.js.map +1 -1
- package/build/esm/mysql2/index.js +21 -0
- package/build/esm/mysql2/index.js.map +1 -0
- package/build/esm/mysql2/mysql2-dc-subscriber.js +62 -0
- package/build/esm/mysql2/mysql2-dc-subscriber.js.map +1 -0
- package/build/esm/orchestrion/bundler/esbuild.js +9 -0
- package/build/esm/orchestrion/bundler/esbuild.js.map +1 -0
- package/build/esm/orchestrion/bundler/options.js +13 -0
- package/build/esm/orchestrion/bundler/options.js.map +1 -0
- package/build/esm/orchestrion/bundler/rollup.js +9 -0
- package/build/esm/orchestrion/bundler/rollup.js.map +1 -0
- package/build/esm/orchestrion/bundler/vite.js +5 -22
- package/build/esm/orchestrion/bundler/vite.js.map +1 -1
- package/build/esm/orchestrion/bundler/webpack.js +27 -0
- package/build/esm/orchestrion/bundler/webpack.js.map +1 -0
- package/build/esm/orchestrion/channels.js +53 -11
- package/build/esm/orchestrion/channels.js.map +1 -1
- package/build/esm/orchestrion/config/amqplib.js +78 -0
- package/build/esm/orchestrion/config/amqplib.js.map +1 -0
- package/build/esm/orchestrion/config/dataloader.js +50 -0
- package/build/esm/orchestrion/config/dataloader.js.map +1 -0
- package/build/esm/orchestrion/config/express.js +73 -0
- package/build/esm/orchestrion/config/express.js.map +1 -0
- package/build/esm/orchestrion/config/firebase.js +5 -0
- package/build/esm/orchestrion/config/firebase.js.map +1 -0
- package/build/esm/orchestrion/config/generic-pool.js +18 -0
- package/build/esm/orchestrion/config/generic-pool.js.map +1 -0
- package/build/esm/orchestrion/config/google-genai.js +35 -0
- package/build/esm/orchestrion/config/google-genai.js.map +1 -0
- package/build/esm/orchestrion/config/graphql.js +25 -0
- package/build/esm/orchestrion/config/graphql.js.map +1 -0
- package/build/esm/orchestrion/config/index.js +59 -15
- package/build/esm/orchestrion/config/index.js.map +1 -1
- package/build/esm/orchestrion/config/kafkajs.js +27 -0
- package/build/esm/orchestrion/config/kafkajs.js.map +1 -0
- package/build/esm/orchestrion/config/knex.js +40 -0
- package/build/esm/orchestrion/config/knex.js.map +1 -0
- package/build/esm/orchestrion/config/langchain.js +5 -0
- package/build/esm/orchestrion/config/langchain.js.map +1 -0
- package/build/esm/orchestrion/config/langgraph.js +5 -0
- package/build/esm/orchestrion/config/langgraph.js.map +1 -0
- package/build/esm/orchestrion/config/mongodb.js +5 -0
- package/build/esm/orchestrion/config/mongodb.js.map +1 -0
- package/build/esm/orchestrion/config/mongoose.js +5 -0
- package/build/esm/orchestrion/config/mongoose.js.map +1 -0
- package/build/esm/orchestrion/config/mysql2.js +29 -0
- package/build/esm/orchestrion/config/mysql2.js.map +1 -0
- package/build/esm/orchestrion/config/nestjs.js +119 -0
- package/build/esm/orchestrion/config/nestjs.js.map +1 -0
- package/build/esm/orchestrion/config/postgres.js +47 -0
- package/build/esm/orchestrion/config/postgres.js.map +1 -0
- package/build/esm/orchestrion/config/prisma.js +5 -0
- package/build/esm/orchestrion/config/prisma.js.map +1 -0
- package/build/esm/orchestrion/config/react-router.js +5 -0
- package/build/esm/orchestrion/config/react-router.js.map +1 -0
- package/build/esm/orchestrion/config/redis.js +73 -0
- package/build/esm/orchestrion/config/redis.js.map +1 -0
- package/build/esm/orchestrion/config/remix.js +5 -0
- package/build/esm/orchestrion/config/remix.js.map +1 -0
- package/build/esm/orchestrion/config/tedious.js +5 -0
- package/build/esm/orchestrion/config/tedious.js.map +1 -0
- package/build/esm/orchestrion/config/vercel-ai.js +18 -14
- package/build/esm/orchestrion/config/vercel-ai.js.map +1 -1
- package/build/esm/orchestrion/detect.js +13 -12
- package/build/esm/orchestrion/detect.js.map +1 -1
- package/build/esm/orchestrion/index.js +23 -2
- package/build/esm/orchestrion/index.js.map +1 -1
- package/build/esm/orchestrion/runtime/register.js +27 -16
- package/build/esm/orchestrion/runtime/register.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/prisma/global.js +12 -0
- package/build/esm/prisma/global.js.map +1 -0
- package/build/esm/prisma/index.js +24 -0
- package/build/esm/prisma/index.js.map +1 -0
- package/build/esm/prisma/tracing-helper.js +209 -0
- package/build/esm/prisma/tracing-helper.js.map +1 -0
- package/build/esm/redis/index.js +21 -0
- package/build/esm/redis/index.js.map +1 -0
- package/build/esm/redis/redis-dc-subscriber.js +24 -36
- package/build/esm/redis/redis-dc-subscriber.js.map +1 -1
- package/build/esm/tracing-channel.js +8 -7
- package/build/esm/tracing-channel.js.map +1 -1
- package/build/esm/vercel-ai/util.js +106 -0
- package/build/esm/vercel-ai/util.js.map +1 -0
- package/build/esm/vercel-ai/vercel-ai-dc-subscriber.js +121 -59
- package/build/esm/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -1
- package/build/esm/vercel-ai/{vercel-ai-orchestrion-v6-subscriber.js → vercel-ai-orchestrion-subscriber.js} +153 -23
- package/build/esm/vercel-ai/vercel-ai-orchestrion-subscriber.js.map +1 -0
- package/build/types/graphql/graphql-dc-subscriber.d.ts +94 -0
- package/build/types/graphql/graphql-dc-subscriber.d.ts.map +1 -0
- package/build/types/graphql/index.d.ts +12 -0
- package/build/types/graphql/index.d.ts.map +1 -0
- package/build/types/graphql/utils.d.ts +36 -0
- package/build/types/graphql/utils.d.ts.map +1 -0
- package/build/types/index.d.ts +6 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/integrations/tracing-channel/amqplib.d.ts +11 -0
- package/build/types/integrations/tracing-channel/amqplib.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/dataloader.d.ts +11 -0
- package/build/types/integrations/tracing-channel/dataloader.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/express/index.d.ts +18 -0
- package/build/types/integrations/tracing-channel/express/index.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/express/instrumentation.d.ts +4 -0
- package/build/types/integrations/tracing-channel/express/instrumentation.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/express/route.d.ts +28 -0
- package/build/types/integrations/tracing-channel/express/route.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/express/types.d.ts +64 -0
- package/build/types/integrations/tracing-channel/express/types.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/fastify/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing-channel/generic-pool.d.ts +10 -0
- package/build/types/integrations/tracing-channel/generic-pool.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/google-genai.d.ts +12 -0
- package/build/types/integrations/tracing-channel/google-genai.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/graphql/constants.d.ts +12 -0
- package/build/types/integrations/tracing-channel/graphql/constants.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/graphql/graphql-types.d.ts +135 -0
- package/build/types/integrations/tracing-channel/graphql/graphql-types.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/graphql/index.d.ts +28 -0
- package/build/types/integrations/tracing-channel/graphql/index.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/graphql/resolvers.d.ts +13 -0
- package/build/types/integrations/tracing-channel/graphql/resolvers.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/graphql/spans.d.ts +17 -0
- package/build/types/integrations/tracing-channel/graphql/spans.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/graphql/types.d.ts +25 -0
- package/build/types/integrations/tracing-channel/graphql/types.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/ioredis.d.ts +20 -0
- package/build/types/integrations/tracing-channel/ioredis.d.ts.map +1 -1
- package/build/types/integrations/tracing-channel/kafkajs/consumer.d.ts +8 -0
- package/build/types/integrations/tracing-channel/kafkajs/consumer.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/kafkajs/index.d.ts +17 -0
- package/build/types/integrations/tracing-channel/kafkajs/index.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/kafkajs/semconv.d.ts +10 -0
- package/build/types/integrations/tracing-channel/kafkajs/semconv.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/kafkajs/spans.d.ts +38 -0
- package/build/types/integrations/tracing-channel/kafkajs/spans.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/kafkajs/types.d.ts +40 -0
- package/build/types/integrations/tracing-channel/kafkajs/types.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/knex.d.ts +11 -0
- package/build/types/integrations/tracing-channel/knex.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/mysql.d.ts.map +1 -1
- package/build/types/integrations/tracing-channel/mysql2.d.ts +15 -0
- package/build/types/integrations/tracing-channel/mysql2.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/openai.d.ts.map +1 -1
- package/build/types/integrations/tracing-channel/postgres-js.d.ts +26 -0
- package/build/types/integrations/tracing-channel/postgres-js.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/postgres.d.ts.map +1 -1
- package/build/types/integrations/tracing-channel/redis.d.ts +16 -0
- package/build/types/integrations/tracing-channel/redis.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/vercel-ai.d.ts +1 -1
- package/build/types/mongoose/mongoose-dc-subscriber.d.ts.map +1 -1
- package/build/types/mysql2/index.d.ts +11 -0
- package/build/types/mysql2/index.d.ts.map +1 -0
- package/build/types/mysql2/mysql2-dc-subscriber.d.ts +59 -0
- package/build/types/mysql2/mysql2-dc-subscriber.d.ts.map +1 -0
- package/build/types/orchestrion/bundler/esbuild.d.ts +21 -0
- package/build/types/orchestrion/bundler/esbuild.d.ts.map +1 -0
- package/build/types/orchestrion/bundler/options.d.ts +19 -0
- package/build/types/orchestrion/bundler/options.d.ts.map +1 -0
- package/build/types/orchestrion/bundler/rollup.d.ts +17 -0
- package/build/types/orchestrion/bundler/rollup.d.ts.map +1 -0
- package/build/types/orchestrion/bundler/vite.d.ts +4 -17
- package/build/types/orchestrion/bundler/vite.d.ts.map +1 -1
- package/build/types/orchestrion/bundler/webpack.d.ts +19 -0
- package/build/types/orchestrion/bundler/webpack.d.ts.map +1 -0
- package/build/types/orchestrion/channels.d.ts +71 -10
- package/build/types/orchestrion/channels.d.ts.map +1 -1
- package/build/types/orchestrion/config/amqplib.d.ts +66 -0
- package/build/types/orchestrion/config/amqplib.d.ts.map +1 -0
- package/build/types/orchestrion/config/dataloader.d.ts +46 -0
- package/build/types/orchestrion/config/dataloader.d.ts.map +1 -0
- package/build/types/orchestrion/config/express.d.ts +32 -0
- package/build/types/orchestrion/config/express.d.ts.map +1 -0
- package/build/types/orchestrion/config/firebase.d.ts +4 -0
- package/build/types/orchestrion/config/firebase.d.ts.map +1 -0
- package/build/types/orchestrion/config/generic-pool.d.ts +31 -0
- package/build/types/orchestrion/config/generic-pool.d.ts.map +1 -0
- package/build/types/orchestrion/config/google-genai.d.ts +30 -0
- package/build/types/orchestrion/config/google-genai.d.ts.map +1 -0
- package/build/types/orchestrion/config/graphql.d.ts +29 -0
- package/build/types/orchestrion/config/graphql.d.ts.map +1 -0
- package/build/types/orchestrion/config/index.d.ts +18 -5
- package/build/types/orchestrion/config/index.d.ts.map +1 -1
- package/build/types/orchestrion/config/kafkajs.d.ts +17 -0
- package/build/types/orchestrion/config/kafkajs.d.ts.map +1 -0
- package/build/types/orchestrion/config/knex.d.ts +9 -0
- package/build/types/orchestrion/config/knex.d.ts.map +1 -0
- package/build/types/orchestrion/config/langchain.d.ts +4 -0
- package/build/types/orchestrion/config/langchain.d.ts.map +1 -0
- package/build/types/orchestrion/config/langgraph.d.ts +4 -0
- package/build/types/orchestrion/config/langgraph.d.ts.map +1 -0
- package/build/types/orchestrion/config/mongodb.d.ts +4 -0
- package/build/types/orchestrion/config/mongodb.d.ts.map +1 -0
- package/build/types/orchestrion/config/mongoose.d.ts +4 -0
- package/build/types/orchestrion/config/mongoose.d.ts.map +1 -0
- package/build/types/orchestrion/config/mysql2.d.ts +18 -0
- package/build/types/orchestrion/config/mysql2.d.ts.map +1 -0
- package/build/types/orchestrion/config/nestjs.d.ts +24 -0
- package/build/types/orchestrion/config/nestjs.d.ts.map +1 -0
- package/build/types/orchestrion/config/postgres.d.ts +9 -0
- package/build/types/orchestrion/config/postgres.d.ts.map +1 -0
- package/build/types/orchestrion/config/prisma.d.ts +4 -0
- package/build/types/orchestrion/config/prisma.d.ts.map +1 -0
- package/build/types/orchestrion/config/react-router.d.ts +4 -0
- package/build/types/orchestrion/config/react-router.d.ts.map +1 -0
- package/build/types/orchestrion/config/redis.d.ts +37 -0
- package/build/types/orchestrion/config/redis.d.ts.map +1 -0
- package/build/types/orchestrion/config/remix.d.ts +4 -0
- package/build/types/orchestrion/config/remix.d.ts.map +1 -0
- package/build/types/orchestrion/config/tedious.d.ts +4 -0
- package/build/types/orchestrion/config/tedious.d.ts.map +1 -0
- 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/detect.d.ts +3 -10
- package/build/types/orchestrion/detect.d.ts.map +1 -1
- package/build/types/orchestrion/index.d.ts +55 -4
- package/build/types/orchestrion/index.d.ts.map +1 -1
- package/build/types/orchestrion/runtime/register.d.ts +11 -9
- package/build/types/orchestrion/runtime/register.d.ts.map +1 -1
- package/build/types/prisma/global.d.ts +5 -0
- package/build/types/prisma/global.d.ts.map +1 -0
- package/build/types/prisma/index.d.ts +45 -0
- package/build/types/prisma/index.d.ts.map +1 -0
- package/build/types/prisma/tracing-helper.d.ts +46 -0
- package/build/types/prisma/tracing-helper.d.ts.map +1 -0
- package/build/types/prisma/types.d.ts +37 -0
- package/build/types/prisma/types.d.ts.map +1 -0
- package/build/types/redis/index.d.ts +18 -0
- package/build/types/redis/index.d.ts.map +1 -0
- package/build/types/redis/redis-dc-subscriber.d.ts +0 -5
- package/build/types/redis/redis-dc-subscriber.d.ts.map +1 -1
- package/build/types/tracing-channel.d.ts +5 -0
- package/build/types/tracing-channel.d.ts.map +1 -1
- package/build/types/vercel-ai/util.d.ts +30 -0
- package/build/types/vercel-ai/util.d.ts.map +1 -0
- package/build/types/vercel-ai/vercel-ai-dc-subscriber.d.ts +6 -2
- package/build/types/vercel-ai/vercel-ai-dc-subscriber.d.ts.map +1 -1
- package/build/types/vercel-ai/{vercel-ai-orchestrion-v6-subscriber.d.ts → vercel-ai-orchestrion-subscriber.d.ts} +1 -1
- package/build/types/vercel-ai/vercel-ai-orchestrion-subscriber.d.ts.map +1 -0
- package/build/types-ts3.8/graphql/graphql-dc-subscriber.d.ts +94 -0
- package/build/types-ts3.8/graphql/index.d.ts +12 -0
- package/build/types-ts3.8/graphql/utils.d.ts +36 -0
- package/build/types-ts3.8/index.d.ts +6 -2
- package/build/types-ts3.8/integrations/tracing-channel/amqplib.d.ts +11 -0
- package/build/types-ts3.8/integrations/tracing-channel/dataloader.d.ts +11 -0
- package/build/types-ts3.8/integrations/tracing-channel/express/index.d.ts +18 -0
- package/build/types-ts3.8/integrations/tracing-channel/express/instrumentation.d.ts +4 -0
- package/build/types-ts3.8/integrations/tracing-channel/express/route.d.ts +28 -0
- package/build/types-ts3.8/integrations/tracing-channel/express/types.d.ts +64 -0
- package/build/types-ts3.8/integrations/tracing-channel/generic-pool.d.ts +10 -0
- package/build/types-ts3.8/integrations/tracing-channel/google-genai.d.ts +12 -0
- package/build/types-ts3.8/integrations/tracing-channel/graphql/constants.d.ts +12 -0
- package/build/types-ts3.8/integrations/tracing-channel/graphql/graphql-types.d.ts +135 -0
- package/build/types-ts3.8/integrations/tracing-channel/graphql/index.d.ts +30 -0
- package/build/types-ts3.8/integrations/tracing-channel/graphql/resolvers.d.ts +13 -0
- package/build/types-ts3.8/integrations/tracing-channel/graphql/spans.d.ts +17 -0
- package/build/types-ts3.8/integrations/tracing-channel/graphql/types.d.ts +25 -0
- package/build/types-ts3.8/integrations/tracing-channel/ioredis.d.ts +20 -0
- package/build/types-ts3.8/integrations/tracing-channel/kafkajs/consumer.d.ts +8 -0
- package/build/types-ts3.8/integrations/tracing-channel/kafkajs/index.d.ts +17 -0
- package/build/types-ts3.8/integrations/tracing-channel/kafkajs/semconv.d.ts +10 -0
- package/build/types-ts3.8/integrations/tracing-channel/kafkajs/spans.d.ts +38 -0
- package/build/types-ts3.8/integrations/tracing-channel/kafkajs/types.d.ts +40 -0
- package/build/types-ts3.8/integrations/tracing-channel/knex.d.ts +11 -0
- package/build/types-ts3.8/integrations/tracing-channel/mysql2.d.ts +15 -0
- package/build/types-ts3.8/integrations/tracing-channel/postgres-js.d.ts +26 -0
- package/build/types-ts3.8/integrations/tracing-channel/redis.d.ts +16 -0
- package/build/types-ts3.8/integrations/tracing-channel/vercel-ai.d.ts +1 -1
- package/build/types-ts3.8/mysql2/index.d.ts +11 -0
- package/build/types-ts3.8/mysql2/mysql2-dc-subscriber.d.ts +59 -0
- package/build/types-ts3.8/orchestrion/bundler/esbuild.d.ts +21 -0
- package/build/types-ts3.8/orchestrion/bundler/options.d.ts +19 -0
- package/build/types-ts3.8/orchestrion/bundler/rollup.d.ts +17 -0
- package/build/types-ts3.8/orchestrion/bundler/vite.d.ts +4 -17
- package/build/types-ts3.8/orchestrion/bundler/webpack.d.ts +19 -0
- package/build/types-ts3.8/orchestrion/channels.d.ts +71 -10
- package/build/types-ts3.8/orchestrion/config/amqplib.d.ts +66 -0
- package/build/types-ts3.8/orchestrion/config/dataloader.d.ts +46 -0
- package/build/types-ts3.8/orchestrion/config/express.d.ts +32 -0
- package/build/types-ts3.8/orchestrion/config/firebase.d.ts +4 -0
- package/build/types-ts3.8/orchestrion/config/generic-pool.d.ts +31 -0
- package/build/types-ts3.8/orchestrion/config/google-genai.d.ts +30 -0
- package/build/types-ts3.8/orchestrion/config/graphql.d.ts +29 -0
- package/build/types-ts3.8/orchestrion/config/index.d.ts +18 -5
- package/build/types-ts3.8/orchestrion/config/kafkajs.d.ts +17 -0
- package/build/types-ts3.8/orchestrion/config/knex.d.ts +9 -0
- package/build/types-ts3.8/orchestrion/config/langchain.d.ts +4 -0
- package/build/types-ts3.8/orchestrion/config/langgraph.d.ts +4 -0
- package/build/types-ts3.8/orchestrion/config/mongodb.d.ts +4 -0
- package/build/types-ts3.8/orchestrion/config/mongoose.d.ts +4 -0
- package/build/types-ts3.8/orchestrion/config/mysql2.d.ts +18 -0
- package/build/types-ts3.8/orchestrion/config/nestjs.d.ts +24 -0
- package/build/types-ts3.8/orchestrion/config/postgres.d.ts +9 -0
- package/build/types-ts3.8/orchestrion/config/prisma.d.ts +4 -0
- package/build/types-ts3.8/orchestrion/config/react-router.d.ts +4 -0
- package/build/types-ts3.8/orchestrion/config/redis.d.ts +37 -0
- package/build/types-ts3.8/orchestrion/config/remix.d.ts +4 -0
- package/build/types-ts3.8/orchestrion/config/tedious.d.ts +4 -0
- package/build/types-ts3.8/orchestrion/config/vercel-ai.d.ts +1 -0
- package/build/types-ts3.8/orchestrion/detect.d.ts +3 -10
- package/build/types-ts3.8/orchestrion/index.d.ts +57 -4
- package/build/types-ts3.8/orchestrion/runtime/register.d.ts +11 -9
- package/build/types-ts3.8/prisma/global.d.ts +5 -0
- package/build/types-ts3.8/prisma/index.d.ts +45 -0
- package/build/types-ts3.8/prisma/tracing-helper.d.ts +52 -0
- package/build/types-ts3.8/prisma/types.d.ts +40 -0
- package/build/types-ts3.8/redis/index.d.ts +18 -0
- package/build/types-ts3.8/redis/redis-dc-subscriber.d.ts +0 -5
- package/build/types-ts3.8/tracing-channel.d.ts +5 -0
- package/build/types-ts3.8/vercel-ai/util.d.ts +30 -0
- package/build/types-ts3.8/vercel-ai/vercel-ai-dc-subscriber.d.ts +6 -2
- package/build/types-ts3.8/vercel-ai/{vercel-ai-orchestrion-v6-subscriber.d.ts → vercel-ai-orchestrion-subscriber.d.ts} +1 -1
- package/package.json +41 -8
- package/build/cjs/vercel-ai/vercel-ai-orchestrion-v6-subscriber.js.map +0 -1
- package/build/esm/vercel-ai/vercel-ai-orchestrion-v6-subscriber.js.map +0 -1
- package/build/types/vercel-ai/vercel-ai-orchestrion-v6-subscriber.d.ts.map +0 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const attributes = require('@sentry/conventions/attributes');
|
|
4
|
+
const core = require('@sentry/core');
|
|
5
|
+
const semconv = require('./semconv.js');
|
|
6
|
+
const spans = require('./spans.js');
|
|
7
|
+
|
|
8
|
+
const consumerCallbackWrapped = /* @__PURE__ */ Symbol("sentry-kafkajs-consumer-callback-wrapped");
|
|
9
|
+
function isWrappedConsumerCallback(fn) {
|
|
10
|
+
return typeof fn === "function" && fn[consumerCallbackWrapped] === true;
|
|
11
|
+
}
|
|
12
|
+
function wrapEachMessage(original) {
|
|
13
|
+
const wrapped = function eachMessage(payload) {
|
|
14
|
+
const sentryTrace = spans.getHeaderAsString(payload.message.headers, "sentry-trace");
|
|
15
|
+
const baggage = spans.getHeaderAsString(payload.message.headers, "baggage");
|
|
16
|
+
return core.continueTrace({ sentryTrace, baggage }, () => {
|
|
17
|
+
const span = spans.startConsumerSpan({
|
|
18
|
+
topic: payload.topic,
|
|
19
|
+
message: payload.message,
|
|
20
|
+
operationType: semconv.MESSAGING_OPERATION_TYPE_VALUE_PROCESS,
|
|
21
|
+
attributes: {
|
|
22
|
+
[semconv.ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.partition)
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const promise = core.withActiveSpan(span, () => original.call(this, payload));
|
|
26
|
+
return spans.endSpansOnPromise([span], promise);
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
wrapped[consumerCallbackWrapped] = true;
|
|
30
|
+
return wrapped;
|
|
31
|
+
}
|
|
32
|
+
function wrapEachBatch(original) {
|
|
33
|
+
const wrapped = function eachBatch(payload) {
|
|
34
|
+
const receivingSpan = core.startNewTrace(
|
|
35
|
+
() => spans.startConsumerSpan({
|
|
36
|
+
topic: payload.batch.topic,
|
|
37
|
+
message: void 0,
|
|
38
|
+
operationType: semconv.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,
|
|
39
|
+
attributes: {
|
|
40
|
+
[attributes.MESSAGING_BATCH_MESSAGE_COUNT]: payload.batch.messages.length,
|
|
41
|
+
[semconv.ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition)
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
);
|
|
45
|
+
return core.withActiveSpan(receivingSpan, () => {
|
|
46
|
+
const spans$1 = [receivingSpan];
|
|
47
|
+
payload.batch.messages.forEach((message) => {
|
|
48
|
+
spans$1.push(
|
|
49
|
+
spans.startConsumerSpan({
|
|
50
|
+
topic: payload.batch.topic,
|
|
51
|
+
message,
|
|
52
|
+
operationType: semconv.MESSAGING_OPERATION_TYPE_VALUE_PROCESS,
|
|
53
|
+
links: spans.getLinksFromHeaders(message.headers),
|
|
54
|
+
attributes: {
|
|
55
|
+
[semconv.ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition)
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
const promise = original.call(this, payload);
|
|
61
|
+
return spans.endSpansOnPromise(spans$1, promise);
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
wrapped[consumerCallbackWrapped] = true;
|
|
65
|
+
return wrapped;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
exports.isWrappedConsumerCallback = isWrappedConsumerCallback;
|
|
69
|
+
exports.wrapEachBatch = wrapEachBatch;
|
|
70
|
+
exports.wrapEachMessage = wrapEachMessage;
|
|
71
|
+
//# sourceMappingURL=consumer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consumer.js","sources":["../../../../../src/integrations/tracing-channel/kafkajs/consumer.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors, Aspecto\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-kafkajs\n * - Upstream version: @opentelemetry/instrumentation-kafkajs@0.27.0\n * - Span-creating wrappers for the consumer callbacks (`_getConsumerEachMessagePatch`/\n * `_getConsumerEachBatchPatch`), migrated to the `@sentry/core` span API. The `run` channel's `start`\n * subscriber swaps the user's `eachMessage`/`eachBatch` for these before the original runs.\n */\n\nimport { MESSAGING_BATCH_MESSAGE_COUNT } from '@sentry/conventions/attributes';\nimport type { Span } from '@sentry/core';\nimport { continueTrace, startNewTrace, withActiveSpan } from '@sentry/core';\nimport {\n ATTR_MESSAGING_DESTINATION_PARTITION_ID,\n MESSAGING_OPERATION_TYPE_VALUE_PROCESS,\n MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,\n} from './semconv';\nimport { endSpansOnPromise, getHeaderAsString, getLinksFromHeaders, startConsumerSpan } from './spans';\nimport type { EachBatchHandler, EachMessageHandler, KafkaMessage } from './types';\n\n// Marks a callback we've already wrapped. A user can reuse one config object across multiple\n// `consumer.run(config)` calls (e.g. a second consumer); without this guard the second `start` would\n// wrap the wrapper and emit duplicate spans per message.\nconst consumerCallbackWrapped: unique symbol = Symbol('sentry-kafkajs-consumer-callback-wrapped');\n\ntype MaybeWrapped = { [consumerCallbackWrapped]?: true };\n\n/** Whether `fn` is a callback this module already wrapped, so callers skip re-wrapping it. */\nexport function isWrappedConsumerCallback(fn: unknown): boolean {\n return typeof fn === 'function' && (fn as MaybeWrapped)[consumerCallbackWrapped] === true;\n}\n\n/** Wraps `eachMessage` so each processed message becomes a consumer span parented to the message's producer. */\nexport function wrapEachMessage(original: EachMessageHandler): EachMessageHandler {\n const wrapped: EachMessageHandler & MaybeWrapped = function eachMessage(this: unknown, payload) {\n const sentryTrace = getHeaderAsString(payload.message.headers, 'sentry-trace');\n const baggage = getHeaderAsString(payload.message.headers, 'baggage');\n\n // Continue the producer's trace so the consumer span is parented to the message's producer.\n return continueTrace({ sentryTrace, baggage }, () => {\n const span = startConsumerSpan({\n topic: payload.topic,\n message: payload.message,\n operationType: MESSAGING_OPERATION_TYPE_VALUE_PROCESS,\n attributes: {\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.partition),\n },\n });\n\n const promise = withActiveSpan(span, () => original.call(this, payload));\n return endSpansOnPromise([span], promise);\n });\n };\n wrapped[consumerCallbackWrapped] = true;\n return wrapped;\n}\n\n/** Wraps `eachBatch` so the batch pull becomes a fresh-root receiving span with a process span per message. */\nexport function wrapEachBatch(original: EachBatchHandler): EachBatchHandler {\n const wrapped: EachBatchHandler & MaybeWrapped = function eachBatch(this: unknown, payload) {\n // A batch pull aggregates messages from many producers, so the receiving span is a fresh root\n // trace and each processed message links back to its own producer span. Mirrors the OTel messaging\n // semantic conventions for a topic with multiple consumers.\n const receivingSpan = startNewTrace(() =>\n startConsumerSpan({\n topic: payload.batch.topic,\n message: undefined,\n operationType: MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,\n attributes: {\n [MESSAGING_BATCH_MESSAGE_COUNT]: payload.batch.messages.length,\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition),\n },\n }),\n );\n\n return withActiveSpan(receivingSpan, () => {\n const spans: Span[] = [receivingSpan];\n payload.batch.messages.forEach((message: KafkaMessage) => {\n spans.push(\n startConsumerSpan({\n topic: payload.batch.topic,\n message,\n operationType: MESSAGING_OPERATION_TYPE_VALUE_PROCESS,\n links: getLinksFromHeaders(message.headers),\n attributes: {\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition),\n },\n }),\n );\n });\n const promise = original.call(this, payload);\n return endSpansOnPromise(spans, promise);\n });\n };\n wrapped[consumerCallbackWrapped] = true;\n return wrapped;\n}\n"],"names":["getHeaderAsString","continueTrace","startConsumerSpan","MESSAGING_OPERATION_TYPE_VALUE_PROCESS","ATTR_MESSAGING_DESTINATION_PARTITION_ID","withActiveSpan","endSpansOnPromise","startNewTrace","MESSAGING_OPERATION_TYPE_VALUE_RECEIVE","MESSAGING_BATCH_MESSAGE_COUNT","spans","getLinksFromHeaders"],"mappings":";;;;;;;AA0BA,MAAM,uBAAA,0BAAgD,0CAA0C,CAAA;AAKzF,SAAS,0BAA0B,EAAA,EAAsB;AAC9D,EAAA,OAAO,OAAO,EAAA,KAAO,UAAA,IAAe,EAAA,CAAoB,uBAAuB,CAAA,KAAM,IAAA;AACvF;AAGO,SAAS,gBAAgB,QAAA,EAAkD;AAChF,EAAA,MAAM,OAAA,GAA6C,SAAS,WAAA,CAA2B,OAAA,EAAS;AAC9F,IAAA,MAAM,WAAA,GAAcA,uBAAA,CAAkB,OAAA,CAAQ,OAAA,CAAQ,SAAS,cAAc,CAAA;AAC7E,IAAA,MAAM,OAAA,GAAUA,uBAAA,CAAkB,OAAA,CAAQ,OAAA,CAAQ,SAAS,SAAS,CAAA;AAGpE,IAAA,OAAOC,kBAAA,CAAc,EAAE,WAAA,EAAa,OAAA,IAAW,MAAM;AACnD,MAAA,MAAM,OAAOC,uBAAA,CAAkB;AAAA,QAC7B,OAAO,OAAA,CAAQ,KAAA;AAAA,QACf,SAAS,OAAA,CAAQ,OAAA;AAAA,QACjB,aAAA,EAAeC,8CAAA;AAAA,QACf,UAAA,EAAY;AAAA,UACV,CAACC,+CAAuC,GAAG,MAAA,CAAO,QAAQ,SAAS;AAAA;AACrE,OACD,CAAA;AAED,MAAA,MAAM,OAAA,GAAUC,oBAAe,IAAA,EAAM,MAAM,SAAS,IAAA,CAAK,IAAA,EAAM,OAAO,CAAC,CAAA;AACvE,MAAA,OAA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AAA,CAAK,IAAA,EAAM,OAAO,CAAA;AAC3C,MAAA,OAAOE,uBAAA,CAAkBI,SAAO,OAAO,CAAA;AAAA,IACzC,CAAC,CAAA;AAAA,EACH,CAAA;AACA,EAAA,OAAA,CAAQ,uBAAuB,CAAA,GAAI,IAAA;AACnC,EAAA,OAAO,OAAA;AACT;;;;;;"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const diagnosticsChannel = require('node:diagnostics_channel');
|
|
4
|
+
const core = require('@sentry/core');
|
|
5
|
+
const debugBuild = require('../../../debug-build.js');
|
|
6
|
+
const channels = require('../../../orchestrion/channels.js');
|
|
7
|
+
const consumer = require('./consumer.js');
|
|
8
|
+
const spans = require('./spans.js');
|
|
9
|
+
|
|
10
|
+
const INTEGRATION_NAME = "Kafka";
|
|
11
|
+
function subscribeToProducer() {
|
|
12
|
+
const channel = diagnosticsChannel.tracingChannel(channels.CHANNELS.KAFKAJS_SEND_BATCH);
|
|
13
|
+
const subscribers = {
|
|
14
|
+
start(ctx) {
|
|
15
|
+
const spans$1 = [];
|
|
16
|
+
(ctx.arguments[0]?.topicMessages ?? []).forEach((topicMessage) => {
|
|
17
|
+
topicMessage.messages.forEach((message) => {
|
|
18
|
+
spans$1.push(spans.startProducerSpan(topicMessage.topic, message));
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
ctx._sentrySpans = spans$1;
|
|
22
|
+
},
|
|
23
|
+
error(ctx) {
|
|
24
|
+
if (ctx._sentrySpans) {
|
|
25
|
+
spans.applyErrorToSpans(ctx._sentrySpans, ctx.error);
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
asyncEnd(ctx) {
|
|
29
|
+
ctx._sentrySpans?.forEach((span) => span.end());
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
channel.subscribe(subscribers);
|
|
33
|
+
}
|
|
34
|
+
function subscribeToConsumer() {
|
|
35
|
+
const channel = diagnosticsChannel.tracingChannel(channels.CHANNELS.KAFKAJS_CONSUMER_RUN);
|
|
36
|
+
const subscribers = {
|
|
37
|
+
start(ctx) {
|
|
38
|
+
const config = ctx.arguments[0];
|
|
39
|
+
if (!config || typeof config !== "object") {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (typeof config.eachMessage === "function" && !consumer.isWrappedConsumerCallback(config.eachMessage)) {
|
|
43
|
+
config.eachMessage = consumer.wrapEachMessage(config.eachMessage);
|
|
44
|
+
}
|
|
45
|
+
if (typeof config.eachBatch === "function" && !consumer.isWrappedConsumerCallback(config.eachBatch)) {
|
|
46
|
+
config.eachBatch = consumer.wrapEachBatch(config.eachBatch);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
channel.subscribe(subscribers);
|
|
51
|
+
}
|
|
52
|
+
const _kafkajsChannelIntegration = (() => {
|
|
53
|
+
return {
|
|
54
|
+
name: INTEGRATION_NAME,
|
|
55
|
+
setupOnce() {
|
|
56
|
+
if (!diagnosticsChannel.tracingChannel) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
debugBuild.DEBUG_BUILD && core.debug.log(
|
|
60
|
+
`[orchestrion:kafkajs] subscribing to channels "${channels.CHANNELS.KAFKAJS_SEND_BATCH}", "${channels.CHANNELS.KAFKAJS_CONSUMER_RUN}"`
|
|
61
|
+
);
|
|
62
|
+
subscribeToProducer();
|
|
63
|
+
subscribeToConsumer();
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
const kafkajsChannelIntegration = core.defineIntegration(_kafkajsChannelIntegration);
|
|
68
|
+
|
|
69
|
+
exports.kafkajsChannelIntegration = kafkajsChannelIntegration;
|
|
70
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing-channel/kafkajs/index.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { TracingChannelSubscribers } from 'node:diagnostics_channel';\nimport type { IntegrationFn, Span } from '@sentry/core';\nimport { debug, defineIntegration } from '@sentry/core';\nimport { DEBUG_BUILD } from '../../../debug-build';\nimport { CHANNELS } from '../../../orchestrion/channels';\nimport { isWrappedConsumerCallback, wrapEachBatch, wrapEachMessage } from './consumer';\nimport { applyErrorToSpans, startProducerSpan } from './spans';\nimport type { ConsumerRunConfig, ProducerBatch } from './types';\n\n// NOTE: this uses the same name as the OTel `Kafka` integration by design. When enabled, the OTel\n// integration is omitted from the default set (see `experimentalUseDiagnosticsChannelInjection`).\nconst INTEGRATION_NAME = 'Kafka' as const;\n\n/** The tracing-channel context the transform attaches around `messageProducer.js`'s `sendBatch`. */\ninterface SendBatchChannelContext {\n // `arguments[0]` is the `{ topicMessages }` batch (kafkajs normalizes `send` into `sendBatch`).\n arguments: [ProducerBatch?, ...unknown[]];\n error?: unknown;\n // The producer spans opened at `start`, ended on `asyncEnd` (and marked errored on `error`).\n _sentrySpans?: Span[];\n}\n\n/** The tracing-channel context the transform attaches around `consumer/index.js`'s `run`. */\ninterface ConsumerRunChannelContext {\n // `arguments[0]` is the `run(config)` config whose `eachMessage`/`eachBatch` we swap in place.\n arguments: [ConsumerRunConfig?, ...unknown[]];\n}\n\nfunction subscribeToProducer(): void {\n const channel = diagnosticsChannel.tracingChannel<SendBatchChannelContext>(CHANNELS.KAFKAJS_SEND_BATCH);\n // Node types `subscribe` as requiring every lifecycle handler; runtime accepts a partial set, so we\n // pass only the ones we use (matching `bindTracingChannelToSpan`'s handling in `tracing-channel.ts`).\n const subscribers: Partial<TracingChannelSubscribers<SendBatchChannelContext>> = {\n start(ctx) {\n const spans: Span[] = [];\n // `startProducerSpan` mutates each message's headers; doing it at `start` means the mutation\n // reaches the real call, propagating the producer's trace to consumers.\n (ctx.arguments[0]?.topicMessages ?? []).forEach(topicMessage => {\n topicMessage.messages.forEach(message => {\n spans.push(startProducerSpan(topicMessage.topic, message));\n });\n });\n ctx._sentrySpans = spans;\n },\n error(ctx) {\n if (ctx._sentrySpans) {\n applyErrorToSpans(ctx._sentrySpans, ctx.error);\n }\n },\n asyncEnd(ctx) {\n // `asyncEnd` fires on both success and failure; `error` (above) has already set the status.\n ctx._sentrySpans?.forEach(span => span.end());\n },\n };\n channel.subscribe(subscribers as TracingChannelSubscribers<SendBatchChannelContext>);\n}\n\nfunction subscribeToConsumer(): void {\n const channel = diagnosticsChannel.tracingChannel<ConsumerRunChannelContext>(CHANNELS.KAFKAJS_CONSUMER_RUN);\n const subscribers: Partial<TracingChannelSubscribers<ConsumerRunChannelContext>> = {\n start(ctx) {\n const config = ctx.arguments[0];\n if (!config || typeof config !== 'object') {\n return;\n }\n // Swap the user callbacks for span-creating wrappers before `run` destructures its config. The\n // `isWrappedConsumerCallback` guard keeps this idempotent: a config object reused across another\n // `run` (or a second consumer) must not have its wrapper wrapped again, which would double spans.\n if (typeof config.eachMessage === 'function' && !isWrappedConsumerCallback(config.eachMessage)) {\n config.eachMessage = wrapEachMessage(config.eachMessage);\n }\n if (typeof config.eachBatch === 'function' && !isWrappedConsumerCallback(config.eachBatch)) {\n config.eachBatch = wrapEachBatch(config.eachBatch);\n }\n },\n };\n channel.subscribe(subscribers as TracingChannelSubscribers<ConsumerRunChannelContext>);\n}\n\nconst _kafkajsChannelIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n if (!diagnosticsChannel.tracingChannel) {\n return;\n }\n\n DEBUG_BUILD &&\n debug.log(\n `[orchestrion:kafkajs] subscribing to channels \"${CHANNELS.KAFKAJS_SEND_BATCH}\", \"${CHANNELS.KAFKAJS_CONSUMER_RUN}\"`,\n );\n\n subscribeToProducer();\n subscribeToConsumer();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * EXPERIMENTAL — orchestrion-driven kafkajs integration.\n *\n * Subscribes to the `orchestrion:kafkajs:*` diagnostics_channels that the orchestrion code transform\n * injects into `kafkajs`'s `producer/messageProducer.js` (`sendBatch`) and `consumer/index.js` (`run`).\n * Requires the orchestrion runtime hook or bundler plugin to be active — wire that up via\n * `experimentalUseDiagnosticsChannelInjection`.\n *\n * Known limitation vs. the OTel integration it replaces: the wrapping producer-`transaction` span is\n * not emitted (the transformer can't replace `transaction()`'s return value to patch commit/abort).\n * Transactional `send`/`sendBatch` calls still produce producer spans, since they route through the\n * same instrumented `sendBatch`.\n */\nexport const kafkajsChannelIntegration = defineIntegration(_kafkajsChannelIntegration);\n"],"names":["CHANNELS","spans","startProducerSpan","applyErrorToSpans","isWrappedConsumerCallback","wrapEachMessage","wrapEachBatch","DEBUG_BUILD","debug","defineIntegration"],"mappings":";;;;;;;;;AAYA,MAAM,gBAAA,GAAmB,OAAA;AAiBzB,SAAS,mBAAA,GAA4B;AACnC,EAAA,MAAM,OAAA,GAAU,kBAAA,CAAmB,cAAA,CAAwCA,iBAAA,CAAS,kBAAkB,CAAA;AAGtG,EAAA,MAAM,WAAA,GAA2E;AAAA,IAC/E,MAAM,GAAA,EAAK;AACT,MAAA,MAAMC,UAAgB,EAAC;AAGvB,MAAA,CAAC,GAAA,CAAI,UAAU,CAAC,CAAA,EAAG,iBAAiB,EAAC,EAAG,QAAQ,CAAA,YAAA,KAAgB;AAC9D,QAAA,YAAA,CAAa,QAAA,CAAS,QAAQ,CAAA,OAAA,KAAW;AACvC,UAAAA,OAAA,CAAM,IAAA,CAAKC,uBAAA,CAAkB,YAAA,CAAa,KAAA,EAAO,OAAO,CAAC,CAAA;AAAA,QAC3D,CAAC,CAAA;AAAA,MACH,CAAC,CAAA;AACD,MAAA,GAAA,CAAI,YAAA,GAAeD,OAAA;AAAA,IACrB,CAAA;AAAA,IACA,MAAM,GAAA,EAAK;AACT,MAAA,IAAI,IAAI,YAAA,EAAc;AACpB,QAAAE,uBAAA,CAAkB,GAAA,CAAI,YAAA,EAAc,GAAA,CAAI,KAAK,CAAA;AAAA,MAC/C;AAAA,IACF,CAAA;AAAA,IAC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kBAAkB,CAAA,IAAA,EAAOA,kBAAS,oBAAoB,CAAA,CAAA;AAAA,OACnH;AAEF,MAAA,mBAAA,EAAoB;AACpB,MAAA,mBAAA,EAAoB;AAAA,IACtB;AAAA,GACF;AACF,CAAA,CAAA;AAeO,MAAM,yBAAA,GAA4BS,uBAAkB,0BAA0B;;;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const ATTR_MESSAGING_DESTINATION_PARTITION_ID = "messaging.destination.partition.id";
|
|
4
|
+
const ATTR_MESSAGING_KAFKA_MESSAGE_KEY = "messaging.kafka.message.key";
|
|
5
|
+
const ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE = "messaging.kafka.message.tombstone";
|
|
6
|
+
const ATTR_MESSAGING_KAFKA_OFFSET = "messaging.kafka.offset";
|
|
7
|
+
const MESSAGING_OPERATION_TYPE_VALUE_PROCESS = "process";
|
|
8
|
+
const MESSAGING_OPERATION_TYPE_VALUE_RECEIVE = "receive";
|
|
9
|
+
const MESSAGING_OPERATION_TYPE_VALUE_SEND = "send";
|
|
10
|
+
const MESSAGING_SYSTEM_VALUE_KAFKA = "kafka";
|
|
11
|
+
const ERROR_TYPE_VALUE_OTHER = "_OTHER";
|
|
12
|
+
|
|
13
|
+
exports.ATTR_MESSAGING_DESTINATION_PARTITION_ID = ATTR_MESSAGING_DESTINATION_PARTITION_ID;
|
|
14
|
+
exports.ATTR_MESSAGING_KAFKA_MESSAGE_KEY = ATTR_MESSAGING_KAFKA_MESSAGE_KEY;
|
|
15
|
+
exports.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE = ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE;
|
|
16
|
+
exports.ATTR_MESSAGING_KAFKA_OFFSET = ATTR_MESSAGING_KAFKA_OFFSET;
|
|
17
|
+
exports.ERROR_TYPE_VALUE_OTHER = ERROR_TYPE_VALUE_OTHER;
|
|
18
|
+
exports.MESSAGING_OPERATION_TYPE_VALUE_PROCESS = MESSAGING_OPERATION_TYPE_VALUE_PROCESS;
|
|
19
|
+
exports.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE = MESSAGING_OPERATION_TYPE_VALUE_RECEIVE;
|
|
20
|
+
exports.MESSAGING_OPERATION_TYPE_VALUE_SEND = MESSAGING_OPERATION_TYPE_VALUE_SEND;
|
|
21
|
+
exports.MESSAGING_SYSTEM_VALUE_KAFKA = MESSAGING_SYSTEM_VALUE_KAFKA;
|
|
22
|
+
//# sourceMappingURL=semconv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semconv.js","sources":["../../../../../src/integrations/tracing-channel/kafkajs/semconv.ts"],"sourcesContent":["/*\n * Unstable OTel semantic-convention keys/values without a `@sentry/conventions` constant, inlined to\n * keep this integration free of `@opentelemetry/*` deps. Values are byte-identical to the vendored OTel\n * instrumentation (`@sentry/node`'s `integrations/tracing/kafka/vendored/semconv.ts`) for span parity.\n */\n\nexport const ATTR_MESSAGING_DESTINATION_PARTITION_ID = 'messaging.destination.partition.id' as const;\nexport const ATTR_MESSAGING_KAFKA_MESSAGE_KEY = 'messaging.kafka.message.key' as const;\nexport const ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE = 'messaging.kafka.message.tombstone' as const;\nexport const ATTR_MESSAGING_KAFKA_OFFSET = 'messaging.kafka.offset' as const;\nexport const MESSAGING_OPERATION_TYPE_VALUE_PROCESS = 'process' as const;\nexport const MESSAGING_OPERATION_TYPE_VALUE_RECEIVE = 'receive' as const;\nexport const MESSAGING_OPERATION_TYPE_VALUE_SEND = 'send' as const;\nexport const MESSAGING_SYSTEM_VALUE_KAFKA = 'kafka' as const;\n\n// `_OTHER` is OTel's fallback bucket when no more specific `error.type` is known.\nexport const ERROR_TYPE_VALUE_OTHER = '_OTHER' as const;\n"],"names":[],"mappings":";;AAMO,MAAM,uCAAA,GAA0C;AAChD,MAAM,gCAAA,GAAmC;AACzC,MAAM,sCAAA,GAAyC;AAC/C,MAAM,2BAAA,GAA8B;AACpC,MAAM,sCAAA,GAAyC;AAC/C,MAAM,sCAAA,GAAyC;AAC/C,MAAM,mCAAA,GAAsC;AAC5C,MAAM,4BAAA,GAA+B;AAGrC,MAAM,sBAAA,GAAyB;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const attributes = require('@sentry/conventions/attributes');
|
|
4
|
+
const core = require('@sentry/core');
|
|
5
|
+
const semconv = require('./semconv.js');
|
|
6
|
+
|
|
7
|
+
const PRODUCER_ORIGIN = "auto.kafkajs.orchestrion.producer";
|
|
8
|
+
const CONSUMER_ORIGIN = "auto.kafkajs.orchestrion.consumer";
|
|
9
|
+
const TRACE_FLAG_SAMPLED = 1;
|
|
10
|
+
const TRACE_FLAG_NONE = 0;
|
|
11
|
+
function getHeaderAsString(headers, key) {
|
|
12
|
+
const value = headers?.[key];
|
|
13
|
+
if (value == null) {
|
|
14
|
+
return void 0;
|
|
15
|
+
}
|
|
16
|
+
return Array.isArray(value) ? value[0]?.toString() : value.toString();
|
|
17
|
+
}
|
|
18
|
+
function getLinksFromHeaders(headers) {
|
|
19
|
+
const sentryTrace = getHeaderAsString(headers, "sentry-trace");
|
|
20
|
+
if (!sentryTrace) {
|
|
21
|
+
return void 0;
|
|
22
|
+
}
|
|
23
|
+
const { traceId, parentSpanId, sampled } = core.propagationContextFromHeaders(
|
|
24
|
+
sentryTrace,
|
|
25
|
+
getHeaderAsString(headers, "baggage")
|
|
26
|
+
);
|
|
27
|
+
if (!parentSpanId) {
|
|
28
|
+
return void 0;
|
|
29
|
+
}
|
|
30
|
+
return [
|
|
31
|
+
{
|
|
32
|
+
context: {
|
|
33
|
+
traceId,
|
|
34
|
+
spanId: parentSpanId,
|
|
35
|
+
isRemote: true,
|
|
36
|
+
traceFlags: sampled ? TRACE_FLAG_SAMPLED : TRACE_FLAG_NONE
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
function startConsumerSpan({ topic, message, operationType, links, attributes: attributes$1 }) {
|
|
42
|
+
const operationName = operationType === semconv.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE ? "poll" : operationType;
|
|
43
|
+
return core.startInactiveSpan({
|
|
44
|
+
name: `${operationName} ${topic}`,
|
|
45
|
+
// todo(v11): Use https://getsentry.github.io/sentry-conventions/ops/#messaging
|
|
46
|
+
op: "message",
|
|
47
|
+
kind: operationType === semconv.MESSAGING_OPERATION_TYPE_VALUE_RECEIVE ? core.SPAN_KIND.CLIENT : core.SPAN_KIND.CONSUMER,
|
|
48
|
+
links,
|
|
49
|
+
attributes: {
|
|
50
|
+
...attributes$1,
|
|
51
|
+
[attributes.MESSAGING_SYSTEM]: semconv.MESSAGING_SYSTEM_VALUE_KAFKA,
|
|
52
|
+
[attributes.MESSAGING_DESTINATION_NAME]: topic,
|
|
53
|
+
[attributes.MESSAGING_OPERATION_TYPE]: operationType,
|
|
54
|
+
[attributes.MESSAGING_OPERATION_NAME]: operationName,
|
|
55
|
+
[semconv.ATTR_MESSAGING_KAFKA_MESSAGE_KEY]: message?.key ? String(message.key) : void 0,
|
|
56
|
+
[semconv.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]: message?.key && message.value === null ? true : void 0,
|
|
57
|
+
[semconv.ATTR_MESSAGING_KAFKA_OFFSET]: message?.offset,
|
|
58
|
+
// Mirror the upstream behavior of only tagging per-message processing spans (not the batch
|
|
59
|
+
// receiving span, which carries no message) with the auto origin.
|
|
60
|
+
...message ? { [core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: CONSUMER_ORIGIN } : {}
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function startProducerSpan(topic, message) {
|
|
65
|
+
const span = core.startInactiveSpan({
|
|
66
|
+
name: `send ${topic}`,
|
|
67
|
+
op: "message",
|
|
68
|
+
kind: core.SPAN_KIND.PRODUCER,
|
|
69
|
+
attributes: {
|
|
70
|
+
[attributes.MESSAGING_SYSTEM]: semconv.MESSAGING_SYSTEM_VALUE_KAFKA,
|
|
71
|
+
[attributes.MESSAGING_DESTINATION_NAME]: topic,
|
|
72
|
+
[semconv.ATTR_MESSAGING_KAFKA_MESSAGE_KEY]: message.key ? String(message.key) : void 0,
|
|
73
|
+
[semconv.ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]: message.key && message.value === null ? true : void 0,
|
|
74
|
+
[semconv.ATTR_MESSAGING_DESTINATION_PARTITION_ID]: message.partition !== void 0 ? String(message.partition) : void 0,
|
|
75
|
+
[attributes.MESSAGING_OPERATION_NAME]: "send",
|
|
76
|
+
[attributes.MESSAGING_OPERATION_TYPE]: semconv.MESSAGING_OPERATION_TYPE_VALUE_SEND,
|
|
77
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: PRODUCER_ORIGIN
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
message.headers = message.headers ?? {};
|
|
81
|
+
const traceData = core.getTraceData({ span });
|
|
82
|
+
if (traceData["sentry-trace"]) {
|
|
83
|
+
message.headers["sentry-trace"] = traceData["sentry-trace"];
|
|
84
|
+
}
|
|
85
|
+
if (traceData.baggage) {
|
|
86
|
+
message.headers["baggage"] = traceData.baggage;
|
|
87
|
+
}
|
|
88
|
+
return span;
|
|
89
|
+
}
|
|
90
|
+
function applyErrorToSpans(spans, reason) {
|
|
91
|
+
let errorMessage;
|
|
92
|
+
let errorType = semconv.ERROR_TYPE_VALUE_OTHER;
|
|
93
|
+
if (typeof reason === "string" || reason === void 0) {
|
|
94
|
+
errorMessage = reason;
|
|
95
|
+
} else if (typeof reason === "object" && reason !== null && Object.prototype.hasOwnProperty.call(reason, "message")) {
|
|
96
|
+
errorMessage = reason.message;
|
|
97
|
+
errorType = reason.constructor.name;
|
|
98
|
+
}
|
|
99
|
+
spans.forEach((span) => {
|
|
100
|
+
span.setAttribute(attributes.ERROR_TYPE, errorType);
|
|
101
|
+
span.setStatus({ code: core.SPAN_STATUS_ERROR, message: errorMessage });
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
function endSpansOnPromise(spans, promise) {
|
|
105
|
+
return Promise.resolve(promise).catch((reason) => {
|
|
106
|
+
applyErrorToSpans(spans, reason);
|
|
107
|
+
throw reason;
|
|
108
|
+
}).finally(() => {
|
|
109
|
+
spans.forEach((span) => span.end());
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
exports.applyErrorToSpans = applyErrorToSpans;
|
|
114
|
+
exports.endSpansOnPromise = endSpansOnPromise;
|
|
115
|
+
exports.getHeaderAsString = getHeaderAsString;
|
|
116
|
+
exports.getLinksFromHeaders = getLinksFromHeaders;
|
|
117
|
+
exports.startConsumerSpan = startConsumerSpan;
|
|
118
|
+
exports.startProducerSpan = startProducerSpan;
|
|
119
|
+
//# sourceMappingURL=spans.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spans.js","sources":["../../../../../src/integrations/tracing-channel/kafkajs/spans.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors, Aspecto\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-kafkajs\n * - Upstream version: @opentelemetry/instrumentation-kafkajs@0.27.0\n * - Span builders migrated to the `@sentry/core` span API. Kept byte-identical in span name/attributes\n * for parity with the OTel integration this replaces; only the origin changes to\n * `auto.kafkajs.orchestrion.*` to mark the injection path.\n */\n\nimport {\n ERROR_TYPE,\n MESSAGING_DESTINATION_NAME,\n MESSAGING_OPERATION_NAME,\n MESSAGING_OPERATION_TYPE,\n MESSAGING_SYSTEM,\n} from '@sentry/conventions/attributes';\nimport type { Span, SpanAttributes, SpanLink } from '@sentry/core';\nimport {\n getTraceData,\n propagationContextFromHeaders,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_KIND,\n SPAN_STATUS_ERROR,\n startInactiveSpan,\n} from '@sentry/core';\nimport type { KafkaMessage, Message } from './types';\nimport {\n ATTR_MESSAGING_DESTINATION_PARTITION_ID,\n ATTR_MESSAGING_KAFKA_MESSAGE_KEY,\n ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE,\n ATTR_MESSAGING_KAFKA_OFFSET,\n ERROR_TYPE_VALUE_OTHER,\n MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,\n MESSAGING_OPERATION_TYPE_VALUE_SEND,\n MESSAGING_SYSTEM_VALUE_KAFKA,\n} from './semconv';\n\nconst PRODUCER_ORIGIN = 'auto.kafkajs.orchestrion.producer';\nconst CONSUMER_ORIGIN = 'auto.kafkajs.orchestrion.consumer';\n\n// `@opentelemetry/api` `TraceFlags`, inlined to avoid an OTel dep: SAMPLED = 0x1, NONE = 0x0.\nconst TRACE_FLAG_SAMPLED = 1;\nconst TRACE_FLAG_NONE = 0;\n\ninterface ConsumerSpanOptions {\n topic: string;\n message: KafkaMessage | undefined;\n operationType: string;\n attributes: SpanAttributes;\n links?: SpanLink[];\n}\n\n/**\n * Reads a header value off a kafkajs message as a string. kafkajs delivers headers as `Buffer`s (or\n * arrays of them), so we normalize to a string before handing them to Sentry's trace helpers.\n */\nexport function getHeaderAsString(headers: KafkaMessage['headers'], key: string): string | undefined {\n const value = headers?.[key];\n if (value == null) {\n return undefined;\n }\n return Array.isArray(value) ? value[0]?.toString() : value.toString();\n}\n\n/**\n * Builds a span link to the producer span carried in the message headers, mirroring the upstream\n * behavior of linking each batch-processed message to its originating producer span.\n */\nexport function getLinksFromHeaders(headers: KafkaMessage['headers']): SpanLink[] | undefined {\n const sentryTrace = getHeaderAsString(headers, 'sentry-trace');\n if (!sentryTrace) {\n return undefined;\n }\n\n const { traceId, parentSpanId, sampled } = propagationContextFromHeaders(\n sentryTrace,\n getHeaderAsString(headers, 'baggage'),\n );\n if (!parentSpanId) {\n return undefined;\n }\n\n return [\n {\n context: {\n traceId,\n spanId: parentSpanId,\n isRemote: true,\n traceFlags: sampled ? TRACE_FLAG_SAMPLED : TRACE_FLAG_NONE,\n },\n },\n ];\n}\n\n/** Starts an inactive consumer (process/receive) span carrying the kafkajs messaging attributes. */\nexport function startConsumerSpan({ topic, message, operationType, links, attributes }: ConsumerSpanOptions): Span {\n // The batch \"receive\" span is named `poll`; per-message spans use the operation type verbatim.\n const operationName = operationType === MESSAGING_OPERATION_TYPE_VALUE_RECEIVE ? 'poll' : operationType;\n\n return startInactiveSpan({\n name: `${operationName} ${topic}`,\n // todo(v11): Use https://getsentry.github.io/sentry-conventions/ops/#messaging\n op: 'message',\n kind: operationType === MESSAGING_OPERATION_TYPE_VALUE_RECEIVE ? SPAN_KIND.CLIENT : SPAN_KIND.CONSUMER,\n links,\n attributes: {\n ...attributes,\n [MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,\n [MESSAGING_DESTINATION_NAME]: topic,\n [MESSAGING_OPERATION_TYPE]: operationType,\n [MESSAGING_OPERATION_NAME]: operationName,\n [ATTR_MESSAGING_KAFKA_MESSAGE_KEY]: message?.key ? String(message.key) : undefined,\n [ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]: message?.key && message.value === null ? true : undefined,\n [ATTR_MESSAGING_KAFKA_OFFSET]: message?.offset as string | undefined,\n // Mirror the upstream behavior of only tagging per-message processing spans (not the batch\n // receiving span, which carries no message) with the auto origin.\n ...(message ? { [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: CONSUMER_ORIGIN } : {}),\n },\n });\n}\n\n/** Starts an inactive producer span and propagates its trace into the message headers. */\nexport function startProducerSpan(topic: string, message: Message): Span {\n const span = startInactiveSpan({\n name: `send ${topic}`,\n op: 'message',\n kind: SPAN_KIND.PRODUCER,\n attributes: {\n [MESSAGING_SYSTEM]: MESSAGING_SYSTEM_VALUE_KAFKA,\n [MESSAGING_DESTINATION_NAME]: topic,\n [ATTR_MESSAGING_KAFKA_MESSAGE_KEY]: message.key ? String(message.key) : undefined,\n [ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE]: message.key && message.value === null ? true : undefined,\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]:\n message.partition !== undefined ? String(message.partition) : undefined,\n [MESSAGING_OPERATION_NAME]: 'send',\n [MESSAGING_OPERATION_TYPE]: MESSAGING_OPERATION_TYPE_VALUE_SEND,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: PRODUCER_ORIGIN,\n },\n });\n\n // Propagate the producer span's trace to consumers via the message headers.\n message.headers = message.headers ?? {};\n const traceData = getTraceData({ span });\n if (traceData['sentry-trace']) {\n message.headers['sentry-trace'] = traceData['sentry-trace'];\n }\n if (traceData.baggage) {\n message.headers['baggage'] = traceData.baggage;\n }\n\n return span;\n}\n\n/**\n * Marks all `spans` with the error status and `error.type` derived from a settle-time `reason`,\n * WITHOUT ending them. Mirrors the vendored `endSpansOnPromise` catch block. The producer path (which\n * receives discrete `error`/`asyncEnd` channel events) applies the error on `error` and ends on\n * `asyncEnd`; the consumer path folds this into `endSpansOnPromise`.\n */\nexport function applyErrorToSpans(spans: Span[], reason: unknown): void {\n let errorMessage: string | undefined;\n let errorType: string = ERROR_TYPE_VALUE_OTHER;\n if (typeof reason === 'string' || reason === undefined) {\n errorMessage = reason;\n } else if (typeof reason === 'object' && reason !== null && Object.prototype.hasOwnProperty.call(reason, 'message')) {\n errorMessage = (reason as { message?: string }).message;\n errorType = (reason as { constructor: { name: string } }).constructor.name;\n }\n\n spans.forEach(span => {\n span.setAttribute(ERROR_TYPE, errorType);\n span.setStatus({ code: SPAN_STATUS_ERROR, message: errorMessage });\n });\n}\n\n/**\n * Resolves once `promise` settles, applying the error status to all `spans` on failure and ending\n * them regardless. Used by the consumer path, which invokes the user callback directly (and so holds a\n * real promise). Verbatim from the vendored `endSpansOnPromise`.\n */\nexport function endSpansOnPromise<T>(spans: Span[], promise: Promise<T>): Promise<T> {\n return Promise.resolve(promise)\n .catch(reason => {\n applyErrorToSpans(spans, reason);\n throw reason;\n })\n .finally(() => {\n spans.forEach(span => span.end());\n });\n}\n"],"names":["propagationContextFromHeaders","attributes","MESSAGING_OPERATION_TYPE_VALUE_RECEIVE","startInactiveSpan","SPAN_KIND","MESSAGING_SYSTEM","MESSAGING_SYSTEM_VALUE_KAFKA","MESSAGING_DESTINATION_NAME","MESSAGING_OPERATION_TYPE","MESSAGING_OPERATION_NAME","ATTR_MESSAGING_KAFKA_MESSAGE_KEY","ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE","ATTR_MESSAGING_KAFKA_OFFSET","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","ATTR_MESSAGING_DESTINATION_PARTITION_ID","MESSAGING_OPERATION_TYPE_VALUE_SEND","getTraceData","ERROR_TYPE_VALUE_OTHER","ERROR_TYPE","SPAN_STATUS_ERROR"],"mappings":";;;;;;AAwCA,MAAM,eAAA,GAAkB,mCAAA;AACxB,MAAM,eAAA,GAAkB,mCAAA;AAGxB,MAAM,kBAAA,GAAqB,CAAA;AAC3B,MAAM,eAAA,GAAkB,CAAA;AAcjB,SAAS,iBAAA,CAAkB,SAAkC,GAAA,EAAiC;AACnG,EAAA,MAAM,KAAA,GAAQ,UAAU,GAAG,CAAA;AAC3B,EAAA,IAAI,SAAS,IAAA,EAAM;AACjB,IAAA,OAAO,MAAA;AAAA,EACT;AACA,EAAA,OAAO,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,GAAI,KAAA,CAAM,CAAC,CAAA,EAAG,QAAA,EAAS,GAAI,KAAA,CAAM,QAAA,EAAS;AACtE;AAMO,SAAS,oBAAoB,OAAA,EAA0D;AAC5F,EAAA,MAAM,WAAA,GAAc,iBAAA,CAAkB,OAAA,EAAS,cAAc,CAAA;AAC7D,E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,EAClC,CAAC,CAAA;AACL;;;;;;;;;"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const diagnosticsChannel = require('node:diagnostics_channel');
|
|
4
|
+
const core = require('@sentry/core');
|
|
5
|
+
const attributes = require('@sentry/conventions/attributes');
|
|
6
|
+
const debugBuild = require('../../debug-build.js');
|
|
7
|
+
const channels = require('../../orchestrion/channels.js');
|
|
8
|
+
const tracingChannel = require('../../tracing-channel.js');
|
|
9
|
+
|
|
10
|
+
const INTEGRATION_NAME = "Knex";
|
|
11
|
+
const ORIGIN = "auto.db.orchestrion.knex";
|
|
12
|
+
const MAX_QUERY_LENGTH = 1021;
|
|
13
|
+
const ATTR_DB_SQL_TABLE = "db.sql.table";
|
|
14
|
+
const DB_SYSTEM_SQLITE = "sqlite";
|
|
15
|
+
const DB_SYSTEM_POSTGRESQL = "postgresql";
|
|
16
|
+
const parentSpanSymbol = /* @__PURE__ */ Symbol("sentry.orchestrion.knex.parent-span");
|
|
17
|
+
const _knexChannelIntegration = (() => {
|
|
18
|
+
return {
|
|
19
|
+
name: INTEGRATION_NAME,
|
|
20
|
+
setupOnce() {
|
|
21
|
+
if (!diagnosticsChannel.tracingChannel) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
debugBuild.DEBUG_BUILD && core.debug.log(`[orchestrion:knex] subscribing to channel "${channels.CHANNELS.KNEX_QUERY}"`);
|
|
25
|
+
core.waitForTracingChannelBinding(() => {
|
|
26
|
+
subscribeBuilder(channels.CHANNELS.KNEX_QUERY_BUILDER);
|
|
27
|
+
subscribeBuilder(channels.CHANNELS.KNEX_SCHEMA_BUILDER);
|
|
28
|
+
subscribeBuilder(channels.CHANNELS.KNEX_RAW);
|
|
29
|
+
subscribeQuery();
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
function subscribeBuilder(channelName) {
|
|
35
|
+
diagnosticsChannel.tracingChannel(channelName).end.subscribe((message) => {
|
|
36
|
+
const builder = message.result;
|
|
37
|
+
if (!builder || typeof builder !== "object" || parentSpanSymbol in builder) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const activeSpan = core.getActiveSpan();
|
|
41
|
+
if (!activeSpan) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
Object.defineProperty(builder, parentSpanSymbol, { value: activeSpan });
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function subscribeQuery() {
|
|
48
|
+
tracingChannel.bindTracingChannelToSpan(
|
|
49
|
+
diagnosticsChannel.tracingChannel(channels.CHANNELS.KNEX_QUERY),
|
|
50
|
+
(data) => {
|
|
51
|
+
const runner = data.self;
|
|
52
|
+
const builder = runner?.builder;
|
|
53
|
+
const parentSpan = builder?.[parentSpanSymbol] ?? core.getActiveSpan();
|
|
54
|
+
if (!parentSpan) {
|
|
55
|
+
return void 0;
|
|
56
|
+
}
|
|
57
|
+
const query = data.arguments[0];
|
|
58
|
+
const client = runner?.client;
|
|
59
|
+
const connection = client?.config?.connection;
|
|
60
|
+
const connectionString = connection?.connectionString;
|
|
61
|
+
const table = extractTableName(builder);
|
|
62
|
+
const operation = query?.method;
|
|
63
|
+
const name = connection?.filename || connection?.database || extractDatabaseFromConnectionString(connectionString);
|
|
64
|
+
const attributes$1 = {
|
|
65
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
|
|
66
|
+
"knex.version": data.moduleVersion,
|
|
67
|
+
[attributes.DB_SYSTEM]: mapSystem(client?.driverName),
|
|
68
|
+
[ATTR_DB_SQL_TABLE]: table,
|
|
69
|
+
[attributes.DB_OPERATION]: operation,
|
|
70
|
+
[attributes.DB_USER]: connection?.user,
|
|
71
|
+
[attributes.DB_NAME]: name,
|
|
72
|
+
[attributes.NET_PEER_NAME]: connection?.host ?? extractHostFromConnectionString(connectionString),
|
|
73
|
+
[attributes.NET_PEER_PORT]: connection?.port ?? extractPortFromConnectionString(connectionString),
|
|
74
|
+
[attributes.NET_TRANSPORT]: connection?.filename === ":memory:" ? "inproc" : void 0,
|
|
75
|
+
[attributes.DB_STATEMENT]: query?.sql != null ? core.truncate(query.sql, MAX_QUERY_LENGTH) : void 0
|
|
76
|
+
};
|
|
77
|
+
return core.startInactiveSpan({
|
|
78
|
+
name: getName(name, operation, table) ?? "knex.query",
|
|
79
|
+
kind: core.SPAN_KIND.CLIENT,
|
|
80
|
+
op: "db",
|
|
81
|
+
parentSpan,
|
|
82
|
+
attributes: attributes$1
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
beforeSpanEnd(span, data) {
|
|
87
|
+
if ("error" in data) {
|
|
88
|
+
const message = cleanErrorMessage(data);
|
|
89
|
+
if (message !== void 0) {
|
|
90
|
+
span.setStatus({ code: core.SPAN_STATUS_ERROR, message });
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
function cleanErrorMessage(data) {
|
|
98
|
+
const error = data.error;
|
|
99
|
+
if (!error || typeof error !== "object" || typeof error.message !== "string") {
|
|
100
|
+
return void 0;
|
|
101
|
+
}
|
|
102
|
+
const rawMessage = error.message;
|
|
103
|
+
const query = data.arguments[0];
|
|
104
|
+
if (!query?.sql) {
|
|
105
|
+
return rawMessage;
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
const formatter = getFormatter(data.self);
|
|
109
|
+
const fullQuery = formatter(query.sql, query.bindings || []);
|
|
110
|
+
return rawMessage.replace(`${fullQuery} - `, "");
|
|
111
|
+
} catch {
|
|
112
|
+
return rawMessage;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function getFormatter(runner) {
|
|
116
|
+
if (runner) {
|
|
117
|
+
const client = runner.client;
|
|
118
|
+
if (client) {
|
|
119
|
+
if (client._formatQuery) {
|
|
120
|
+
return client._formatQuery.bind(client);
|
|
121
|
+
} else if (client.SqlString) {
|
|
122
|
+
return client.SqlString.format.bind(client.SqlString);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (runner.builder?.toString) {
|
|
126
|
+
return runner.builder.toString.bind(runner.builder);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return () => "<noop formatter>";
|
|
130
|
+
}
|
|
131
|
+
function mapSystem(driverName) {
|
|
132
|
+
if (driverName === "sqlite3") {
|
|
133
|
+
return DB_SYSTEM_SQLITE;
|
|
134
|
+
}
|
|
135
|
+
if (driverName === "pg") {
|
|
136
|
+
return DB_SYSTEM_POSTGRESQL;
|
|
137
|
+
}
|
|
138
|
+
return driverName;
|
|
139
|
+
}
|
|
140
|
+
function getName(db, operation, table) {
|
|
141
|
+
if (operation && db) {
|
|
142
|
+
return table ? `${operation} ${db}.${table}` : `${operation} ${db}`;
|
|
143
|
+
}
|
|
144
|
+
return db;
|
|
145
|
+
}
|
|
146
|
+
function extractTableName(builder) {
|
|
147
|
+
const table = builder?._single?.table;
|
|
148
|
+
if (table && typeof table === "object") {
|
|
149
|
+
return extractTableName(table);
|
|
150
|
+
}
|
|
151
|
+
return typeof table === "string" ? table : void 0;
|
|
152
|
+
}
|
|
153
|
+
function extractDatabaseFromConnectionString(connectionString) {
|
|
154
|
+
if (!connectionString) {
|
|
155
|
+
return void 0;
|
|
156
|
+
}
|
|
157
|
+
try {
|
|
158
|
+
const db = new URL(connectionString).pathname?.replace(/^\//, "");
|
|
159
|
+
return db || void 0;
|
|
160
|
+
} catch {
|
|
161
|
+
return void 0;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function extractHostFromConnectionString(connectionString) {
|
|
165
|
+
if (!connectionString) {
|
|
166
|
+
return void 0;
|
|
167
|
+
}
|
|
168
|
+
try {
|
|
169
|
+
return new URL(connectionString).hostname || void 0;
|
|
170
|
+
} catch {
|
|
171
|
+
return void 0;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
function extractPortFromConnectionString(connectionString) {
|
|
175
|
+
if (!connectionString) {
|
|
176
|
+
return void 0;
|
|
177
|
+
}
|
|
178
|
+
try {
|
|
179
|
+
const port = new URL(connectionString).port;
|
|
180
|
+
return port ? parseInt(port, 10) : void 0;
|
|
181
|
+
} catch {
|
|
182
|
+
return void 0;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
const knexChannelIntegration = core.defineIntegration(_knexChannelIntegration);
|
|
186
|
+
|
|
187
|
+
exports.knexChannelIntegration = knexChannelIntegration;
|
|
188
|
+
//# sourceMappingURL=knex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knex.js","sources":["../../../../src/integrations/tracing-channel/knex.ts"],"sourcesContent":["// The `@sentry/conventions` db/net attribute keys are deprecated (superseded by newer semconv), but we\n// emit them deliberately to preserve parity with what `@opentelemetry/instrumentation-knex` produced.\n/* oxlint-disable typescript/no-deprecated */\n\nimport * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { IntegrationFn, Span, SpanAttributes } from '@sentry/core';\nimport {\n debug,\n defineIntegration,\n getActiveSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_KIND,\n SPAN_STATUS_ERROR,\n startInactiveSpan,\n truncate,\n waitForTracingChannelBinding,\n} from '@sentry/core';\nimport {\n DB_NAME,\n DB_OPERATION,\n DB_STATEMENT,\n DB_SYSTEM,\n DB_USER,\n NET_PEER_NAME,\n NET_PEER_PORT,\n NET_TRANSPORT,\n} from '@sentry/conventions/attributes';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { CHANNELS } from '../../orchestrion/channels';\nimport { bindTracingChannelToSpan } from '../../tracing-channel';\n\n// NOTE: this uses the same name as the OTel integration by design. `@sentry/node`'s `knexIntegration`\n// picks this subscriber over the vendored OTel path when orchestrion injection is active.\nconst INTEGRATION_NAME = 'Knex' as const;\nconst ORIGIN = 'auto.db.orchestrion.knex';\n\n// Max length of the query text captured in `db.statement`; \"...\" is appended when truncated, so the\n// truncated statement caps at 1024 chars (1 KiB), matching `@opentelemetry/instrumentation-knex`.\nconst MAX_QUERY_LENGTH = 1021;\n\n// `db.sql.table` is deprecated and not exported by `@sentry/conventions`, so keep it local. Matches\n// what `@opentelemetry/instrumentation-knex` emitted.\nconst ATTR_DB_SQL_TABLE = 'db.sql.table';\n\nconst DB_SYSTEM_SQLITE = 'sqlite';\nconst DB_SYSTEM_POSTGRESQL = 'postgresql';\n\n// The span active when a builder is created, reused as the parent when the query runs later (the query\n// often executes in a different async context than the builder was created in).\nconst parentSpanSymbol = Symbol('sentry.orchestrion.knex.parent-span');\n\ninterface KnexQuery {\n sql?: string;\n method?: string;\n bindings?: unknown[];\n}\n\ninterface KnexConnectionConfig {\n filename?: string;\n database?: string;\n user?: string;\n host?: string;\n port?: number;\n connectionString?: string;\n}\n\ninterface KnexBuilder {\n _single?: { table?: unknown };\n toString?: () => string;\n [parentSpanSymbol]?: Span;\n}\n\ninterface KnexClient {\n driverName?: string;\n config?: { connection?: KnexConnectionConfig };\n _formatQuery?: (sql: string, bindings: unknown[]) => string;\n SqlString?: { format: (sql: string, bindings: unknown[]) => string };\n}\n\ninterface KnexRunner {\n client?: KnexClient;\n builder?: KnexBuilder;\n}\n\n/** Context orchestrion attaches to the `orchestrion:knex:query` channel (wrapping `Runner.query`). */\ninterface KnexQueryChannelContext {\n // `arguments[0]` is the query object (`{ sql, method, bindings }`).\n arguments: [KnexQuery?];\n self?: KnexRunner;\n moduleVersion?: string;\n result?: unknown;\n error?: unknown;\n}\n\n/** Context orchestrion attaches to the `Client.queryBuilder`/`schemaBuilder`/`raw` channels. */\ninterface KnexBuilderChannelContext {\n arguments: unknown[];\n self?: unknown;\n // The builder returned by the wrapped method.\n result?: KnexBuilder;\n}\n\nconst _knexChannelIntegration = (() => {\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:knex] subscribing to channel \"${CHANNELS.KNEX_QUERY}\"`);\n\n waitForTracingChannelBinding(() => {\n subscribeBuilder(CHANNELS.KNEX_QUERY_BUILDER);\n subscribeBuilder(CHANNELS.KNEX_SCHEMA_BUILDER);\n subscribeBuilder(CHANNELS.KNEX_RAW);\n subscribeQuery();\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Bookkeeping only: stash the span active at builder-creation time onto the returned builder. It is\n * read back as the parent when the query runs (see `subscribeQuery`), because the query often executes\n * in a different async context. A `Client` builder method is synchronous, so its `result` (the builder)\n * is available on the channel's `end`.\n */\nfunction subscribeBuilder(channelName: string): void {\n diagnosticsChannel.tracingChannel(channelName).end.subscribe(message => {\n const builder = (message as KnexBuilderChannelContext).result;\n if (!builder || typeof builder !== 'object' || parentSpanSymbol in builder) {\n return;\n }\n\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n return;\n }\n\n Object.defineProperty(builder, parentSpanSymbol, { value: activeSpan });\n });\n}\n\nfunction subscribeQuery(): void {\n bindTracingChannelToSpan<KnexQueryChannelContext>(\n diagnosticsChannel.tracingChannel<KnexQueryChannelContext>(CHANNELS.KNEX_QUERY),\n data => {\n const runner = data.self;\n const builder = runner?.builder;\n\n // The builder captures the span active when it was created (see `subscribeBuilder`).\n // `onlyIfParent`: only instrument queries that run as part of an existing trace, matching OTel.\n const parentSpan = builder?.[parentSpanSymbol] ?? getActiveSpan();\n if (!parentSpan) {\n return undefined;\n }\n\n const query = data.arguments[0];\n const client = runner?.client;\n const connection = client?.config?.connection;\n const connectionString = connection?.connectionString;\n const table = extractTableName(builder);\n const operation = query?.method;\n const name =\n connection?.filename || connection?.database || extractDatabaseFromConnectionString(connectionString);\n\n const attributes: SpanAttributes = {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n 'knex.version': data.moduleVersion,\n [DB_SYSTEM]: mapSystem(client?.driverName),\n [ATTR_DB_SQL_TABLE]: table,\n [DB_OPERATION]: operation,\n [DB_USER]: connection?.user,\n [DB_NAME]: name,\n [NET_PEER_NAME]: connection?.host ?? extractHostFromConnectionString(connectionString),\n [NET_PEER_PORT]: connection?.port ?? extractPortFromConnectionString(connectionString),\n [NET_TRANSPORT]: connection?.filename === ':memory:' ? 'inproc' : undefined,\n [DB_STATEMENT]: query?.sql != null ? truncate(query.sql, MAX_QUERY_LENGTH) : undefined,\n };\n\n return startInactiveSpan({\n name: getName(name, operation, table) ?? 'knex.query',\n kind: SPAN_KIND.CLIENT,\n op: 'db',\n parentSpan,\n attributes,\n });\n },\n {\n beforeSpanEnd(span, data) {\n // knex prefixes query errors with the full SQL (\"<query> - <error>\"). Strip it so the span\n // status message is just the driver error, matching the vendored OTel instrumentation.\n if ('error' in data) {\n const message = cleanErrorMessage(data);\n if (message !== undefined) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message });\n }\n }\n },\n },\n );\n}\n\nfunction cleanErrorMessage(data: KnexQueryChannelContext): string | undefined {\n const error = data.error;\n if (!error || typeof error !== 'object' || typeof (error as { message?: unknown }).message !== 'string') {\n return undefined;\n }\n\n const rawMessage = (error as { message: string }).message;\n const query = data.arguments[0];\n if (!query?.sql) {\n return rawMessage;\n }\n\n try {\n const formatter = getFormatter(data.self);\n const fullQuery = formatter(query.sql, query.bindings || []);\n return rawMessage.replace(`${fullQuery} - `, '');\n } catch {\n return rawMessage;\n }\n}\n\nfunction getFormatter(runner: KnexRunner | undefined): (sql: string, bindings: unknown[]) => string {\n if (runner) {\n const client = runner.client;\n if (client) {\n if (client._formatQuery) {\n return client._formatQuery.bind(client);\n } else if (client.SqlString) {\n return client.SqlString.format.bind(client.SqlString);\n }\n }\n if (runner.builder?.toString) {\n return runner.builder.toString.bind(runner.builder);\n }\n }\n\n return () => '<noop formatter>';\n}\n\nfunction mapSystem(driverName: string | undefined): string | undefined {\n if (driverName === 'sqlite3') {\n return DB_SYSTEM_SQLITE;\n }\n if (driverName === 'pg') {\n return DB_SYSTEM_POSTGRESQL;\n }\n return driverName;\n}\n\nfunction getName(db: string | undefined, operation?: string, table?: string): string | undefined {\n // `db` can be undefined when the database can't be determined from the knex config. Guard against\n // interpolating it (which would emit the literal \"undefined\") and let the call site fall back.\n if (operation && db) {\n return table ? `${operation} ${db}.${table}` : `${operation} ${db}`;\n }\n return db;\n}\n\nfunction extractTableName(builder: KnexBuilder | undefined): string | undefined {\n const table = builder?._single?.table;\n if (table && typeof table === 'object') {\n return extractTableName(table as KnexBuilder);\n }\n return typeof table === 'string' ? table : undefined;\n}\n\nfunction extractDatabaseFromConnectionString(connectionString: string | undefined): string | undefined {\n if (!connectionString) {\n return undefined;\n }\n try {\n const db = new URL(connectionString).pathname?.replace(/^\\//, '');\n return db || undefined;\n } catch {\n return undefined;\n }\n}\n\nfunction extractHostFromConnectionString(connectionString: string | undefined): string | undefined {\n if (!connectionString) {\n return undefined;\n }\n try {\n return new URL(connectionString).hostname || undefined;\n } catch {\n return undefined;\n }\n}\n\nfunction extractPortFromConnectionString(connectionString: string | undefined): number | undefined {\n if (!connectionString) {\n return undefined;\n }\n try {\n const port = new URL(connectionString).port;\n return port ? parseInt(port, 10) : undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * EXPERIMENTAL - orchestrion-driven knex integration.\n *\n * Subscribes to the `orchestrion:knex:*` diagnostics_channels that the orchestrion code transform\n * injects into knex's `Runner.query` (span) and `Client.queryBuilder`/`schemaBuilder`/`raw` (parent-span\n * bookkeeping). Requires the orchestrion runtime hook or bundler plugin to be active.\n */\nexport const knexChannelIntegration = defineIntegration(_knexChannelIntegration);\n"],"names":["DEBUG_BUILD","debug","CHANNELS","waitForTracingChannelBinding","getActiveSpan","bindTracingChannelToSpan","attributes","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","DB_SYSTEM","DB_OPERATION","DB_USER","DB_NAME","NET_PEER_NAME","NET_PEER_PORT","NET_TRANSPORT","DB_STAT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jG,EAAA,IAAI,CAAC,gBAAA,EAAkB;AACrB,IAAA,OAAO,MAAA;AAAA,EACT;AACA,EAAA,IAAI;AACF,IAAA,MAAM,IAAA,GAAO,IAAI,GAAA,CAAI,gBAAgB,CAAA,CAAE,IAAA;AACvC,IAAA,OAAO,IAAA,GAAO,QAAA,CAAS,IAAA,EAAM,EAAE,CAAA,GAAI,KAAA,CAAA;AAAA,EACrC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACF;AASO,MAAM,sBAAA,GAAyBC,uBAAkB,uBAAuB;;;;"}
|
|
@@ -76,7 +76,7 @@ function extractSql(firstArg) {
|
|
|
76
76
|
if (typeof firstArg === "string") {
|
|
77
77
|
return firstArg;
|
|
78
78
|
}
|
|
79
|
-
if (firstArg &&
|
|
79
|
+
if (core.isObjectLike(firstArg) && "sql" in firstArg) {
|
|
80
80
|
const sql = firstArg.sql;
|
|
81
81
|
return typeof sql === "string" ? sql : void 0;
|
|
82
82
|
}
|