@depup/sentry__server-utils 10.67.0-depup.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -0
- package/build/cjs/debug-build.js +6 -0
- package/build/cjs/debug-build.js.map +1 -0
- 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 +34 -0
- package/build/cjs/index.js.map +1 -0
- 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/anthropic.js +101 -0
- package/build/cjs/integrations/tracing-channel/anthropic.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/constants.js +16 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/constants.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/index.js +154 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/index.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/MessageAttributes.js +46 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/MessageAttributes.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.js +47 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.js +419 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/dynamodb.js +131 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/dynamodb.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/kinesis.js +21 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/kinesis.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/lambda.js +64 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/lambda.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/s3.js +21 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/s3.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/secretsmanager.js +27 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/secretsmanager.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/sns.js +63 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/sns.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/sqs.js +116 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/sqs.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/stepfunctions.js +25 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/services/stepfunctions.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/utils.js +30 -0
- package/build/cjs/integrations/tracing-channel/aws-sdk/utils.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 +168 -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/errors.js +42 -0
- package/build/cjs/integrations/tracing-channel/fastify/errors.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/fastify/index.js +34 -0
- package/build/cjs/integrations/tracing-channel/fastify/index.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/fastify/instrumentation.js +279 -0
- package/build/cjs/integrations/tracing-channel/fastify/instrumentation.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/fastify/utils.js +11 -0
- package/build/cjs/integrations/tracing-channel/fastify/utils.js.map +1 -0
- 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/hapi-types.js +30 -0
- package/build/cjs/integrations/tracing-channel/hapi-types.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/hapi-utils.js +177 -0
- package/build/cjs/integrations/tracing-channel/hapi-utils.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/hapi.js +52 -0
- package/build/cjs/integrations/tracing-channel/hapi.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/ioredis.js +99 -0
- package/build/cjs/integrations/tracing-channel/ioredis.js.map +1 -0
- 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/koa.js +146 -0
- package/build/cjs/integrations/tracing-channel/koa.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/langchain.js +63 -0
- package/build/cjs/integrations/tracing-channel/langchain.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/langgraph.js +100 -0
- package/build/cjs/integrations/tracing-channel/langgraph.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/lru-memoizer.js +31 -0
- package/build/cjs/integrations/tracing-channel/lru-memoizer.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/mongodb.js +104 -0
- package/build/cjs/integrations/tracing-channel/mongodb.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/mongoose.js +110 -0
- package/build/cjs/integrations/tracing-channel/mongoose.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/mysql.js +107 -0
- package/build/cjs/integrations/tracing-channel/mysql.js.map +1 -0
- 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 +81 -0
- package/build/cjs/integrations/tracing-channel/openai.js.map +1 -0
- 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 +170 -0
- package/build/cjs/integrations/tracing-channel/postgres.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/redis.js +218 -0
- package/build/cjs/integrations/tracing-channel/redis.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/tedious.js +145 -0
- package/build/cjs/integrations/tracing-channel/tedious.js.map +1 -0
- package/build/cjs/integrations/tracing-channel/vercel-ai.js +25 -0
- package/build/cjs/integrations/tracing-channel/vercel-ai.js.map +1 -0
- package/build/cjs/mongodb/mongodb-span.js +133 -0
- package/build/cjs/mongodb/mongodb-span.js.map +1 -0
- package/build/cjs/mongoose/index.js +23 -0
- package/build/cjs/mongoose/index.js.map +1 -0
- package/build/cjs/mongoose/mongoose-dc-subscriber.js +97 -0
- package/build/cjs/mongoose/mongoose-dc-subscriber.js.map +1 -0
- package/build/cjs/mongoose/mongoose-legacy-span.js +40 -0
- package/build/cjs/mongoose/mongoose-legacy-span.js.map +1 -0
- 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 +15 -0
- package/build/cjs/orchestrion/bundler/esbuild.js.map +1 -0
- package/build/cjs/orchestrion/bundler/options.js +24 -0
- package/build/cjs/orchestrion/bundler/options.js.map +1 -0
- package/build/cjs/orchestrion/bundler/rollup.js +15 -0
- package/build/cjs/orchestrion/bundler/rollup.js.map +1 -0
- package/build/cjs/orchestrion/bundler/vite.js +21 -0
- package/build/cjs/orchestrion/bundler/vite.js.map +1 -0
- package/build/cjs/orchestrion/bundler/webpack.js +36 -0
- package/build/cjs/orchestrion/bundler/webpack.js.map +1 -0
- package/build/cjs/orchestrion/channels.js +70 -0
- package/build/cjs/orchestrion/channels.js.map +1 -0
- package/build/cjs/orchestrion/config/amqplib.js +81 -0
- package/build/cjs/orchestrion/config/amqplib.js.map +1 -0
- package/build/cjs/orchestrion/config/anthropic-ai.js +43 -0
- package/build/cjs/orchestrion/config/anthropic-ai.js.map +1 -0
- package/build/cjs/orchestrion/config/aws-sdk.js +28 -0
- package/build/cjs/orchestrion/config/aws-sdk.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 +77 -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/hapi.js +26 -0
- package/build/cjs/orchestrion/config/hapi.js.map +1 -0
- package/build/cjs/orchestrion/config/index.js +89 -0
- package/build/cjs/orchestrion/config/index.js.map +1 -0
- package/build/cjs/orchestrion/config/ioredis.js +35 -0
- package/build/cjs/orchestrion/config/ioredis.js.map +1 -0
- 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/koa.js +16 -0
- package/build/cjs/orchestrion/config/koa.js.map +1 -0
- package/build/cjs/orchestrion/config/langchain.js +52 -0
- package/build/cjs/orchestrion/config/langchain.js.map +1 -0
- package/build/cjs/orchestrion/config/langgraph.js +28 -0
- package/build/cjs/orchestrion/config/langgraph.js.map +1 -0
- package/build/cjs/orchestrion/config/lru-memoizer.js +17 -0
- package/build/cjs/orchestrion/config/lru-memoizer.js.map +1 -0
- package/build/cjs/orchestrion/config/mongodb.js +67 -0
- package/build/cjs/orchestrion/config/mongodb.js.map +1 -0
- package/build/cjs/orchestrion/config/mongoose.js +107 -0
- package/build/cjs/orchestrion/config/mongoose.js.map +1 -0
- package/build/cjs/orchestrion/config/mysql.js +16 -0
- package/build/cjs/orchestrion/config/mysql.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/openai.js +40 -0
- package/build/cjs/orchestrion/config/openai.js.map +1 -0
- package/build/cjs/orchestrion/config/pg.js +51 -0
- package/build/cjs/orchestrion/config/pg.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 +54 -0
- package/build/cjs/orchestrion/config/remix.js.map +1 -0
- package/build/cjs/orchestrion/config/tedious.js +24 -0
- package/build/cjs/orchestrion/config/tedious.js.map +1 -0
- package/build/cjs/orchestrion/config/vercel-ai.js +48 -0
- package/build/cjs/orchestrion/config/vercel-ai.js.map +1 -0
- package/build/cjs/orchestrion/detect.js +26 -0
- package/build/cjs/orchestrion/detect.js.map +1 -0
- package/build/cjs/orchestrion/index.js +89 -0
- package/build/cjs/orchestrion/index.js.map +1 -0
- package/build/cjs/orchestrion/runtime/register.js +77 -0
- package/build/cjs/orchestrion/runtime/register.js.map +1 -0
- 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 +101 -0
- package/build/cjs/redis/redis-dc-subscriber.js.map +1 -0
- package/build/cjs/redis/redis-statement-serializer.js +34 -0
- package/build/cjs/redis/redis-statement-serializer.js.map +1 -0
- package/build/cjs/tracing-channel.js +134 -0
- package/build/cjs/tracing-channel.js.map +1 -0
- package/build/cjs/vercel-ai/index.js +23 -0
- package/build/cjs/vercel-ai/index.js.map +1 -0
- 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 +433 -0
- package/build/cjs/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -0
- package/build/cjs/vercel-ai/vercel-ai-orchestrion-subscriber.js +399 -0
- package/build/cjs/vercel-ai/vercel-ai-orchestrion-subscriber.js.map +1 -0
- package/build/esm/debug-build.js +4 -0
- package/build/esm/debug-build.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 +12 -0
- package/build/esm/index.js.map +1 -0
- 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 +99 -0
- package/build/esm/integrations/tracing-channel/anthropic.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/constants.js +9 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/constants.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/index.js +152 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/index.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/MessageAttributes.js +41 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/MessageAttributes.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.js +45 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.js +417 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/dynamodb.js +129 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/dynamodb.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/kinesis.js +19 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/kinesis.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/lambda.js +62 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/lambda.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/s3.js +19 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/s3.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/secretsmanager.js +25 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/secretsmanager.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/sns.js +61 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/sns.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/sqs.js +114 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/sqs.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/stepfunctions.js +23 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/services/stepfunctions.js.map +1 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/utils.js +26 -0
- package/build/esm/integrations/tracing-channel/aws-sdk/utils.js.map +1 -0
- 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 +166 -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/errors.js +39 -0
- package/build/esm/integrations/tracing-channel/fastify/errors.js.map +1 -0
- package/build/esm/integrations/tracing-channel/fastify/index.js +30 -0
- package/build/esm/integrations/tracing-channel/fastify/index.js.map +1 -0
- package/build/esm/integrations/tracing-channel/fastify/instrumentation.js +277 -0
- package/build/esm/integrations/tracing-channel/fastify/instrumentation.js.map +1 -0
- package/build/esm/integrations/tracing-channel/fastify/utils.js +8 -0
- package/build/esm/integrations/tracing-channel/fastify/utils.js.map +1 -0
- 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/hapi-types.js +25 -0
- package/build/esm/integrations/tracing-channel/hapi-types.js.map +1 -0
- package/build/esm/integrations/tracing-channel/hapi-utils.js +172 -0
- package/build/esm/integrations/tracing-channel/hapi-utils.js.map +1 -0
- package/build/esm/integrations/tracing-channel/hapi.js +50 -0
- package/build/esm/integrations/tracing-channel/hapi.js.map +1 -0
- package/build/esm/integrations/tracing-channel/ioredis.js +96 -0
- package/build/esm/integrations/tracing-channel/ioredis.js.map +1 -0
- 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/koa.js +144 -0
- package/build/esm/integrations/tracing-channel/koa.js.map +1 -0
- package/build/esm/integrations/tracing-channel/langchain.js +61 -0
- package/build/esm/integrations/tracing-channel/langchain.js.map +1 -0
- package/build/esm/integrations/tracing-channel/langgraph.js +98 -0
- package/build/esm/integrations/tracing-channel/langgraph.js.map +1 -0
- package/build/esm/integrations/tracing-channel/lru-memoizer.js +29 -0
- package/build/esm/integrations/tracing-channel/lru-memoizer.js.map +1 -0
- package/build/esm/integrations/tracing-channel/mongodb.js +102 -0
- package/build/esm/integrations/tracing-channel/mongodb.js.map +1 -0
- package/build/esm/integrations/tracing-channel/mongoose.js +108 -0
- package/build/esm/integrations/tracing-channel/mongoose.js.map +1 -0
- package/build/esm/integrations/tracing-channel/mysql.js +105 -0
- package/build/esm/integrations/tracing-channel/mysql.js.map +1 -0
- 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 +79 -0
- package/build/esm/integrations/tracing-channel/openai.js.map +1 -0
- 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 +168 -0
- package/build/esm/integrations/tracing-channel/postgres.js.map +1 -0
- package/build/esm/integrations/tracing-channel/redis.js +216 -0
- package/build/esm/integrations/tracing-channel/redis.js.map +1 -0
- package/build/esm/integrations/tracing-channel/tedious.js +143 -0
- package/build/esm/integrations/tracing-channel/tedious.js.map +1 -0
- package/build/esm/integrations/tracing-channel/vercel-ai.js +23 -0
- package/build/esm/integrations/tracing-channel/vercel-ai.js.map +1 -0
- package/build/esm/mongodb/mongodb-span.js +126 -0
- package/build/esm/mongodb/mongodb-span.js.map +1 -0
- package/build/esm/mongoose/index.js +21 -0
- package/build/esm/mongoose/index.js.map +1 -0
- package/build/esm/mongoose/mongoose-dc-subscriber.js +89 -0
- package/build/esm/mongoose/mongoose-dc-subscriber.js.map +1 -0
- package/build/esm/mongoose/mongoose-legacy-span.js +38 -0
- package/build/esm/mongoose/mongoose-legacy-span.js.map +1 -0
- 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 +22 -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 +15 -0
- package/build/esm/orchestrion/bundler/vite.js.map +1 -0
- 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 +68 -0
- package/build/esm/orchestrion/channels.js.map +1 -0
- package/build/esm/orchestrion/config/amqplib.js +78 -0
- package/build/esm/orchestrion/config/amqplib.js.map +1 -0
- package/build/esm/orchestrion/config/anthropic-ai.js +40 -0
- package/build/esm/orchestrion/config/anthropic-ai.js.map +1 -0
- package/build/esm/orchestrion/config/aws-sdk.js +25 -0
- package/build/esm/orchestrion/config/aws-sdk.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 +74 -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/hapi.js +23 -0
- package/build/esm/orchestrion/config/hapi.js.map +1 -0
- package/build/esm/orchestrion/config/index.js +84 -0
- package/build/esm/orchestrion/config/index.js.map +1 -0
- package/build/esm/orchestrion/config/ioredis.js +32 -0
- package/build/esm/orchestrion/config/ioredis.js.map +1 -0
- 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/koa.js +13 -0
- package/build/esm/orchestrion/config/koa.js.map +1 -0
- package/build/esm/orchestrion/config/langchain.js +48 -0
- package/build/esm/orchestrion/config/langchain.js.map +1 -0
- package/build/esm/orchestrion/config/langgraph.js +25 -0
- package/build/esm/orchestrion/config/langgraph.js.map +1 -0
- package/build/esm/orchestrion/config/lru-memoizer.js +14 -0
- package/build/esm/orchestrion/config/lru-memoizer.js.map +1 -0
- package/build/esm/orchestrion/config/mongodb.js +64 -0
- package/build/esm/orchestrion/config/mongodb.js.map +1 -0
- package/build/esm/orchestrion/config/mongoose.js +103 -0
- package/build/esm/orchestrion/config/mongoose.js.map +1 -0
- package/build/esm/orchestrion/config/mysql.js +13 -0
- package/build/esm/orchestrion/config/mysql.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/openai.js +37 -0
- package/build/esm/orchestrion/config/openai.js.map +1 -0
- package/build/esm/orchestrion/config/pg.js +48 -0
- package/build/esm/orchestrion/config/pg.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 +51 -0
- package/build/esm/orchestrion/config/remix.js.map +1 -0
- package/build/esm/orchestrion/config/tedious.js +21 -0
- package/build/esm/orchestrion/config/tedious.js.map +1 -0
- package/build/esm/orchestrion/config/vercel-ai.js +45 -0
- package/build/esm/orchestrion/config/vercel-ai.js.map +1 -0
- package/build/esm/orchestrion/detect.js +23 -0
- package/build/esm/orchestrion/detect.js.map +1 -0
- package/build/esm/orchestrion/index.js +58 -0
- package/build/esm/orchestrion/index.js.map +1 -0
- package/build/esm/orchestrion/runtime/register.js +76 -0
- package/build/esm/orchestrion/runtime/register.js.map +1 -0
- package/build/esm/package.json +1 -0
- 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 +94 -0
- package/build/esm/redis/redis-dc-subscriber.js.map +1 -0
- package/build/esm/redis/redis-statement-serializer.js +32 -0
- package/build/esm/redis/redis-statement-serializer.js.map +1 -0
- package/build/esm/tracing-channel.js +132 -0
- package/build/esm/tracing-channel.js.map +1 -0
- package/build/esm/vercel-ai/index.js +21 -0
- package/build/esm/vercel-ai/index.js.map +1 -0
- 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 +425 -0
- package/build/esm/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -0
- package/build/esm/vercel-ai/vercel-ai-orchestrion-subscriber.js +397 -0
- package/build/esm/vercel-ai/vercel-ai-orchestrion-subscriber.js.map +1 -0
- package/build/orchestrion/import-hook.mjs +19 -0
- package/build/types/debug-build.d.ts +7 -0
- package/build/types/debug-build.d.ts.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 +22 -0
- package/build/types/index.d.ts.map +1 -0
- 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/anthropic.d.ts +10 -0
- package/build/types/integrations/tracing-channel/anthropic.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/aws-sdk.types.d.ts +43 -0
- package/build/types/integrations/tracing-channel/aws-sdk/aws-sdk.types.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/constants.d.ts +15 -0
- package/build/types/integrations/tracing-channel/aws-sdk/constants.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/index.d.ts +15 -0
- package/build/types/integrations/tracing-channel/aws-sdk/index.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/MessageAttributes.d.ts +23 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/MessageAttributes.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/ServiceExtension.d.ts +9 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/ServiceExtension.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.d.ts +10 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.d.ts +14 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/dynamodb.d.ts +8 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/dynamodb.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/index.d.ts +2 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/index.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/kinesis.d.ts +6 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/kinesis.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/lambda.d.ts +9 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/lambda.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/s3.d.ts +6 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/s3.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/secretsmanager.d.ts +8 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/secretsmanager.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/sns.d.ts +9 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/sns.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/sqs.d.ts +9 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/sqs.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/stepfunctions.d.ts +6 -0
- package/build/types/integrations/tracing-channel/aws-sdk/services/stepfunctions.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/types.d.ts +26 -0
- package/build/types/integrations/tracing-channel/aws-sdk/types.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/aws-sdk/utils.d.ts +5 -0
- package/build/types/integrations/tracing-channel/aws-sdk/utils.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/errors.d.ts +12 -0
- package/build/types/integrations/tracing-channel/fastify/errors.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/fastify/index.d.ts +66 -0
- package/build/types/integrations/tracing-channel/fastify/index.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/fastify/instrumentation.d.ts +10 -0
- package/build/types/integrations/tracing-channel/fastify/instrumentation.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/fastify/types.d.ts +32 -0
- package/build/types/integrations/tracing-channel/fastify/types.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/fastify/utils.d.ts +9 -0
- package/build/types/integrations/tracing-channel/fastify/utils.d.ts.map +1 -0
- 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/hapi-types.d.ts +53 -0
- package/build/types/integrations/tracing-channel/hapi-types.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/hapi-utils.d.ts +25 -0
- package/build/types/integrations/tracing-channel/hapi-utils.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/hapi.d.ts +9 -0
- package/build/types/integrations/tracing-channel/hapi.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/ioredis.d.ts +37 -0
- package/build/types/integrations/tracing-channel/ioredis.d.ts.map +1 -0
- 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/koa.d.ts +14 -0
- package/build/types/integrations/tracing-channel/koa.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/langchain.d.ts +10 -0
- package/build/types/integrations/tracing-channel/langchain.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/langgraph.d.ts +10 -0
- package/build/types/integrations/tracing-channel/langgraph.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/lru-memoizer.d.ts +10 -0
- package/build/types/integrations/tracing-channel/lru-memoizer.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/mongodb.d.ts +12 -0
- package/build/types/integrations/tracing-channel/mongodb.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/mongoose.d.ts +15 -0
- package/build/types/integrations/tracing-channel/mongoose.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/mysql.d.ts +12 -0
- package/build/types/integrations/tracing-channel/mysql.d.ts.map +1 -0
- 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 +10 -0
- package/build/types/integrations/tracing-channel/openai.d.ts.map +1 -0
- 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 +15 -0
- package/build/types/integrations/tracing-channel/postgres.d.ts.map +1 -0
- 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/tedious.d.ts +11 -0
- package/build/types/integrations/tracing-channel/tedious.d.ts.map +1 -0
- package/build/types/integrations/tracing-channel/vercel-ai.d.ts +13 -0
- package/build/types/integrations/tracing-channel/vercel-ai.d.ts.map +1 -0
- package/build/types/mongodb/mongodb-span.d.ts +66 -0
- package/build/types/mongodb/mongodb-span.d.ts.map +1 -0
- package/build/types/mongoose/index.d.ts +13 -0
- package/build/types/mongoose/index.d.ts.map +1 -0
- package/build/types/mongoose/mongoose-dc-subscriber.d.ts +63 -0
- package/build/types/mongoose/mongoose-dc-subscriber.d.ts.map +1 -0
- package/build/types/mongoose/mongoose-legacy-span.d.ts +29 -0
- package/build/types/mongoose/mongoose-legacy-span.d.ts.map +1 -0
- 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 +29 -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 +18 -0
- package/build/types/orchestrion/bundler/vite.d.ts.map +1 -0
- 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 +130 -0
- package/build/types/orchestrion/channels.d.ts.map +1 -0
- 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/anthropic-ai.d.ts +31 -0
- package/build/types/orchestrion/config/anthropic-ai.d.ts.map +1 -0
- package/build/types/orchestrion/config/aws-sdk.d.ts +19 -0
- package/build/types/orchestrion/config/aws-sdk.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 +30 -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/hapi.d.ts +17 -0
- package/build/types/orchestrion/config/hapi.d.ts.map +1 -0
- package/build/types/orchestrion/config/index.d.ts +37 -0
- package/build/types/orchestrion/config/index.d.ts.map +1 -0
- package/build/types/orchestrion/config/ioredis.d.ts +7 -0
- package/build/types/orchestrion/config/ioredis.d.ts.map +1 -0
- 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/koa.d.ts +17 -0
- package/build/types/orchestrion/config/koa.d.ts.map +1 -0
- package/build/types/orchestrion/config/langchain.d.ts +18 -0
- package/build/types/orchestrion/config/langchain.d.ts.map +1 -0
- package/build/types/orchestrion/config/langgraph.d.ts +21 -0
- package/build/types/orchestrion/config/langgraph.d.ts.map +1 -0
- package/build/types/orchestrion/config/lru-memoizer.d.ts +16 -0
- package/build/types/orchestrion/config/lru-memoizer.d.ts.map +1 -0
- package/build/types/orchestrion/config/mongodb.d.ts +59 -0
- package/build/types/orchestrion/config/mongodb.d.ts.map +1 -0
- package/build/types/orchestrion/config/mongoose.d.ts +40 -0
- package/build/types/orchestrion/config/mongoose.d.ts.map +1 -0
- package/build/types/orchestrion/config/mysql.d.ts +16 -0
- package/build/types/orchestrion/config/mysql.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/openai.d.ts +18 -0
- package/build/types/orchestrion/config/openai.d.ts.map +1 -0
- package/build/types/orchestrion/config/pg.d.ts +33 -0
- package/build/types/orchestrion/config/pg.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 +9 -0
- package/build/types/orchestrion/config/remix.d.ts.map +1 -0
- package/build/types/orchestrion/config/tedious.d.ts +12 -0
- package/build/types/orchestrion/config/tedious.d.ts.map +1 -0
- package/build/types/orchestrion/config/vercel-ai.d.ts +12 -0
- package/build/types/orchestrion/config/vercel-ai.d.ts.map +1 -0
- package/build/types/orchestrion/detect.d.ts +26 -0
- package/build/types/orchestrion/detect.d.ts.map +1 -0
- package/build/types/orchestrion/index.d.ts +136 -0
- package/build/types/orchestrion/index.d.ts.map +1 -0
- package/build/types/orchestrion/runtime/register.d.ts +25 -0
- package/build/types/orchestrion/runtime/register.d.ts.map +1 -0
- 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 +89 -0
- package/build/types/redis/redis-dc-subscriber.d.ts.map +1 -0
- package/build/types/redis/redis-statement-serializer.d.ts +6 -0
- package/build/types/redis/redis-statement-serializer.d.ts.map +1 -0
- package/build/types/tracing-channel.d.ts +73 -0
- package/build/types/tracing-channel.d.ts.map +1 -0
- package/build/types/vercel-ai/index.d.ts +27 -0
- package/build/types/vercel-ai/index.d.ts.map +1 -0
- 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 +72 -0
- package/build/types/vercel-ai/vercel-ai-dc-subscriber.d.ts.map +1 -0
- package/build/types/vercel-ai/vercel-ai-orchestrion-subscriber.d.ts +12 -0
- package/build/types/vercel-ai/vercel-ai-orchestrion-subscriber.d.ts.map +1 -0
- package/build/types-ts3.8/debug-build.d.ts +7 -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 +23 -0
- package/build/types-ts3.8/integrations/tracing-channel/amqplib.d.ts +11 -0
- package/build/types-ts3.8/integrations/tracing-channel/anthropic.d.ts +10 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/aws-sdk.types.d.ts +43 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/constants.d.ts +15 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/index.d.ts +15 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/MessageAttributes.d.ts +23 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/ServiceExtension.d.ts +9 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/ServicesExtensions.d.ts +10 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/bedrock-runtime.d.ts +14 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/dynamodb.d.ts +8 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/index.d.ts +2 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/kinesis.d.ts +6 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/lambda.d.ts +9 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/s3.d.ts +6 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/secretsmanager.d.ts +8 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/sns.d.ts +9 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/sqs.d.ts +9 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/services/stepfunctions.d.ts +6 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/types.d.ts +26 -0
- package/build/types-ts3.8/integrations/tracing-channel/aws-sdk/utils.d.ts +5 -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/fastify/errors.d.ts +12 -0
- package/build/types-ts3.8/integrations/tracing-channel/fastify/index.d.ts +66 -0
- package/build/types-ts3.8/integrations/tracing-channel/fastify/instrumentation.d.ts +10 -0
- package/build/types-ts3.8/integrations/tracing-channel/fastify/types.d.ts +32 -0
- package/build/types-ts3.8/integrations/tracing-channel/fastify/utils.d.ts +9 -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/hapi-types.d.ts +65 -0
- package/build/types-ts3.8/integrations/tracing-channel/hapi-utils.d.ts +25 -0
- package/build/types-ts3.8/integrations/tracing-channel/hapi.d.ts +9 -0
- package/build/types-ts3.8/integrations/tracing-channel/ioredis.d.ts +37 -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/koa.d.ts +14 -0
- package/build/types-ts3.8/integrations/tracing-channel/langchain.d.ts +10 -0
- package/build/types-ts3.8/integrations/tracing-channel/langgraph.d.ts +10 -0
- package/build/types-ts3.8/integrations/tracing-channel/lru-memoizer.d.ts +10 -0
- package/build/types-ts3.8/integrations/tracing-channel/mongodb.d.ts +12 -0
- package/build/types-ts3.8/integrations/tracing-channel/mongoose.d.ts +15 -0
- package/build/types-ts3.8/integrations/tracing-channel/mysql.d.ts +12 -0
- package/build/types-ts3.8/integrations/tracing-channel/mysql2.d.ts +15 -0
- package/build/types-ts3.8/integrations/tracing-channel/openai.d.ts +10 -0
- package/build/types-ts3.8/integrations/tracing-channel/postgres-js.d.ts +26 -0
- package/build/types-ts3.8/integrations/tracing-channel/postgres.d.ts +15 -0
- package/build/types-ts3.8/integrations/tracing-channel/redis.d.ts +16 -0
- package/build/types-ts3.8/integrations/tracing-channel/tedious.d.ts +11 -0
- package/build/types-ts3.8/integrations/tracing-channel/vercel-ai.d.ts +13 -0
- package/build/types-ts3.8/mongodb/mongodb-span.d.ts +66 -0
- package/build/types-ts3.8/mongoose/index.d.ts +13 -0
- package/build/types-ts3.8/mongoose/mongoose-dc-subscriber.d.ts +63 -0
- package/build/types-ts3.8/mongoose/mongoose-legacy-span.d.ts +29 -0
- 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/node-diagnostics-channel.d.ts +19 -0
- package/build/types-ts3.8/orchestrion/bundler/esbuild.d.ts +21 -0
- package/build/types-ts3.8/orchestrion/bundler/options.d.ts +29 -0
- package/build/types-ts3.8/orchestrion/bundler/rollup.d.ts +17 -0
- package/build/types-ts3.8/orchestrion/bundler/vite.d.ts +18 -0
- package/build/types-ts3.8/orchestrion/bundler/webpack.d.ts +19 -0
- package/build/types-ts3.8/orchestrion/channels.d.ts +130 -0
- package/build/types-ts3.8/orchestrion/config/amqplib.d.ts +66 -0
- package/build/types-ts3.8/orchestrion/config/anthropic-ai.d.ts +31 -0
- package/build/types-ts3.8/orchestrion/config/aws-sdk.d.ts +19 -0
- package/build/types-ts3.8/orchestrion/config/dataloader.d.ts +46 -0
- package/build/types-ts3.8/orchestrion/config/express.d.ts +30 -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/hapi.d.ts +17 -0
- package/build/types-ts3.8/orchestrion/config/index.d.ts +37 -0
- package/build/types-ts3.8/orchestrion/config/ioredis.d.ts +7 -0
- 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/koa.d.ts +17 -0
- package/build/types-ts3.8/orchestrion/config/langchain.d.ts +18 -0
- package/build/types-ts3.8/orchestrion/config/langgraph.d.ts +21 -0
- package/build/types-ts3.8/orchestrion/config/lru-memoizer.d.ts +16 -0
- package/build/types-ts3.8/orchestrion/config/mongodb.d.ts +59 -0
- package/build/types-ts3.8/orchestrion/config/mongoose.d.ts +40 -0
- package/build/types-ts3.8/orchestrion/config/mysql.d.ts +16 -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/openai.d.ts +18 -0
- package/build/types-ts3.8/orchestrion/config/pg.d.ts +33 -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 +9 -0
- package/build/types-ts3.8/orchestrion/config/tedious.d.ts +12 -0
- package/build/types-ts3.8/orchestrion/config/vercel-ai.d.ts +12 -0
- package/build/types-ts3.8/orchestrion/detect.d.ts +26 -0
- package/build/types-ts3.8/orchestrion/index.d.ts +138 -0
- package/build/types-ts3.8/orchestrion/runtime/register.d.ts +25 -0
- 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 +89 -0
- package/build/types-ts3.8/redis/redis-statement-serializer.d.ts +6 -0
- package/build/types-ts3.8/tracing-channel.d.ts +73 -0
- package/build/types-ts3.8/vercel-ai/index.d.ts +27 -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 +72 -0
- package/build/types-ts3.8/vercel-ai/vercel-ai-orchestrion-subscriber.d.ts +12 -0
- package/changes.json +14 -0
- package/package.json +189 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lru-memoizer.js","sources":["../../../../src/integrations/tracing-channel/lru-memoizer.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { IntegrationFn } from '@sentry/core';\nimport { debug, defineIntegration, waitForTracingChannelBinding } from '@sentry/core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { CHANNELS } from '../../orchestrion/channels';\nimport { bindTracingChannelToSpan } from '../../tracing-channel';\n\n// Same name as the OTel integration by design — when enabled, the OTel\n// 'LruMemoizer' integration is omitted from the default set.\nconst INTEGRATION_NAME = 'LruMemoizer' as const;\n\ninterface LruMemoizerLoadContext {\n arguments: unknown[];\n}\n\nconst _lruMemoizerChannelIntegration = (() => {\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:lru-memoizer] subscribing to channel \"${CHANNELS.LRU_MEMOIZER_LOAD}\"`);\n\n waitForTracingChannelBinding(() => {\n bindTracingChannelToSpan(\n diagnosticsChannel.tracingChannel<LruMemoizerLoadContext>(CHANNELS.LRU_MEMOIZER_LOAD),\n // We only want the helper's caller-context restore for the callback lru-memoizer fires from a detached `setImmediate`.\n () => undefined,\n );\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * EXPERIMENTAL — orchestrion-driven lru-memoizer integration. Subscribes to\n * `orchestrion:lru-memoizer:load` (injected into `lru-memoizer/lib/async.js`'s\n * `memoizedFunction`). Creates no spans; only re-runs the memoized callback with the\n * caller's scope. Requires the orchestrion runtime hook or bundler plugin.\n */\nexport const lruMemoizerChannelIntegration = defineIntegration(_lruMemoizerChannelIntegration);\n"],"names":["DEBUG_BUILD","debug","CHANNELS","waitForTracingChannelBinding","bindTracingChannelToSpan","defineIntegration"],"mappings":";;;;;;;;AASA,MAAM,gBAAA,GAAmB,aAAA;AAMzB,MAAM,kCAAkC,MAAM;AAC5C,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AAEV,MAAA,IAAI,CAAC,mBAAmB,cAAA,EAAgB;AACtC,QAAA;AAAA,MACF;AAEA,MAAAA,sBAAA,IAAeC,UAAA,CAAM,GAAA,CAAI,CAAA,mDAAA,EAAsDC,iBAAA,CAAS,iBAAiB,CAAA,CAAA,CAAG,CAAA;AAE5G,MAAAC,iCAAA,CAA6B,MAAM;AACjC,QAAAC,uCAAA;AAAA,UACE,kBAAA,CAAmB,cAAA,CAAuCF,iBAAA,CAAS,iBAAiB,CAAA;AAAA;AAAA,UAEpF,MAAM;AAAA,SACR;AAAA,MACF,CAAC,CAAA;AAAA,IACH;AAAA,GACF;AACF,CAAA,CAAA;AAQO,MAAM,6BAAA,GAAgCG,uBAAkB,8BAA8B;;;;"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const diagnosticsChannel = require('node:diagnostics_channel');
|
|
4
|
+
const core = require('@sentry/core');
|
|
5
|
+
const mongodbSpan = require('../../mongodb/mongodb-span.js');
|
|
6
|
+
const channels = require('../../orchestrion/channels.js');
|
|
7
|
+
const tracingChannel = require('../../tracing-channel.js');
|
|
8
|
+
|
|
9
|
+
const INTEGRATION_NAME = "Mongo";
|
|
10
|
+
const ORIGIN = "auto.db.orchestrion.mongo";
|
|
11
|
+
const V3_DEDICATED_COMMANDS = /* @__PURE__ */ new Set(["insert", "update", "delete", "find", "getMore", "killCursors"]);
|
|
12
|
+
const _mongodbChannelIntegration = (() => {
|
|
13
|
+
return {
|
|
14
|
+
name: INTEGRATION_NAME,
|
|
15
|
+
setupOnce() {
|
|
16
|
+
if (!diagnosticsChannel.tracingChannel) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
core.waitForTracingChannelBinding(() => {
|
|
20
|
+
subscribeV4Command();
|
|
21
|
+
subscribeV4Checkout();
|
|
22
|
+
subscribeV3Wireprotocol();
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
function subscribeV4Command() {
|
|
28
|
+
tracingChannel.bindTracingChannelToSpan(
|
|
29
|
+
diagnosticsChannel.tracingChannel(channels.CHANNELS.MONGODB_COMMAND),
|
|
30
|
+
(data) => {
|
|
31
|
+
const args = data.arguments ?? [];
|
|
32
|
+
const ns = args[0];
|
|
33
|
+
const cmd = args[1];
|
|
34
|
+
if (!ns || !cmd || typeof cmd !== "object" || cmd.ismaster || cmd.hello) {
|
|
35
|
+
return void 0;
|
|
36
|
+
}
|
|
37
|
+
const operation = Object.keys(cmd)[0];
|
|
38
|
+
return mongodbSpan.startMongoSpan(mongodbSpan.getV4SpanAttributes(data.self, ns, cmd, operation, ORIGIN));
|
|
39
|
+
},
|
|
40
|
+
// Matches otel's `shouldSkipInstrumentation`: only trace when there is
|
|
41
|
+
// an active parent span, to avoid emitting orphaned mongodb spans.
|
|
42
|
+
{ requiresParentSpan: true }
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
function subscribeV4Checkout() {
|
|
46
|
+
tracingChannel.bindTracingChannelToSpan(diagnosticsChannel.tracingChannel(channels.CHANNELS.MONGODB_CHECKOUT), () => void 0);
|
|
47
|
+
}
|
|
48
|
+
function subscribeV3Wireprotocol() {
|
|
49
|
+
for (const operation of ["insert", "update", "remove"]) {
|
|
50
|
+
const channel = operation === "insert" ? channels.CHANNELS.MONGODB_V3_INSERT : operation === "update" ? channels.CHANNELS.MONGODB_V3_UPDATE : channels.CHANNELS.MONGODB_V3_REMOVE;
|
|
51
|
+
bindV3(channel, (args) => ({
|
|
52
|
+
topology: args[0],
|
|
53
|
+
ns: args[1],
|
|
54
|
+
command: args[2]?.[0],
|
|
55
|
+
operation
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
bindV3(channels.CHANNELS.MONGODB_V3_COMMAND, (args) => {
|
|
59
|
+
const command = args[2];
|
|
60
|
+
const type = command ? Object.keys(command)[0] : void 0;
|
|
61
|
+
if (type && V3_DEDICATED_COMMANDS.has(type)) {
|
|
62
|
+
return void 0;
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
topology: args[0],
|
|
66
|
+
ns: args[1],
|
|
67
|
+
command,
|
|
68
|
+
operation: command ? mongodbSpan.getV3CommandOperation(command) : void 0
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
bindV3(channels.CHANNELS.MONGODB_V3_QUERY, (args) => ({
|
|
72
|
+
topology: args[0],
|
|
73
|
+
ns: args[1],
|
|
74
|
+
command: args[2],
|
|
75
|
+
operation: "find"
|
|
76
|
+
}));
|
|
77
|
+
bindV3(channels.CHANNELS.MONGODB_V3_GET_MORE, (args) => ({
|
|
78
|
+
topology: args[0],
|
|
79
|
+
ns: args[1],
|
|
80
|
+
command: args[2]?.cmd,
|
|
81
|
+
operation: "getMore"
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
function bindV3(channelName, extract) {
|
|
85
|
+
tracingChannel.bindTracingChannelToSpan(
|
|
86
|
+
diagnosticsChannel.tracingChannel(channelName),
|
|
87
|
+
(data) => {
|
|
88
|
+
const args = data.arguments;
|
|
89
|
+
if (!args) {
|
|
90
|
+
return void 0;
|
|
91
|
+
}
|
|
92
|
+
const info = extract(args);
|
|
93
|
+
if (!info || typeof info.ns !== "string") {
|
|
94
|
+
return void 0;
|
|
95
|
+
}
|
|
96
|
+
return mongodbSpan.startMongoSpan(mongodbSpan.getV3SpanAttributes(info.ns, info.topology, info.command, info.operation, ORIGIN));
|
|
97
|
+
},
|
|
98
|
+
{ requiresParentSpan: true }
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
const mongodbChannelIntegration = core.defineIntegration(_mongodbChannelIntegration);
|
|
102
|
+
|
|
103
|
+
exports.mongodbChannelIntegration = mongodbChannelIntegration;
|
|
104
|
+
//# sourceMappingURL=mongodb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongodb.js","sources":["../../../../src/integrations/tracing-channel/mongodb.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { IntegrationFn } from '@sentry/core';\nimport { defineIntegration, waitForTracingChannelBinding } from '@sentry/core';\nimport type { MongodbNamespace, MongoV3Topology } from '../../mongodb/mongodb-span';\nimport {\n getV3CommandOperation,\n getV3SpanAttributes,\n getV4SpanAttributes,\n startMongoSpan,\n} from '../../mongodb/mongodb-span';\nimport { CHANNELS } from '../../orchestrion/channels';\nimport { bindTracingChannelToSpan } from '../../tracing-channel';\n\nconst INTEGRATION_NAME = 'Mongo' as const;\n\nconst ORIGIN = 'auto.db.orchestrion.mongo';\n\n/**\n * what orchestrion's transform attaches to a channel context:\n * `self` is the `this`, plus args.\n */\ninterface MongoChannelContext {\n self?: { address?: string };\n arguments?: unknown[];\n}\n\n// Details extracted from a v3 wireprotocol call's arguments to build its span.\ninterface V3CallInfo {\n topology: MongoV3Topology | undefined;\n ns: string;\n command: Record<string, unknown> | undefined;\n operation: string | undefined;\n}\n\n// Command doc first-keys whose span the `v3_command` channel must suppress.\n// The `insert`/`update`/`remove`/`query`/`getMore` functions call the shared\n// `command` function internally. Orchestrion transforms the `command` *source*\n// (unlike the vendored OTel patch, which wraps the module's exported reference\n// and misses internal calls), so `v3_command` would double-span the ones that\n// already have their own dedicated channel (`v3_insert`/`update`/`remove`/\n// `query`/`get_more`) without this guard.\n//\n// `killCursors` has no dedicated channel, but is suppressed too for OTel\n// parity: OTel wraps `wireprotocol/index.js`'s `command` property, which never\n// intercepts `kill_cursors.js`'s direct `require('./command')` call — so OTel\n// emits no killCursors span, and neither should we.\nconst V3_DEDICATED_COMMANDS = new Set(['insert', 'update', 'delete', 'find', 'getMore', 'killCursors']);\n\nconst _mongodbChannelIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n if (!diagnosticsChannel.tracingChannel) {\n return;\n }\n\n waitForTracingChannelBinding(() => {\n subscribeV4Command();\n subscribeV4Checkout();\n subscribeV3Wireprotocol();\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * `Connection.prototype.command` (mongodb >=4.0) one span per command.\n * Handles both the >=6.4 promise form and the >=4.0 <6.4 callback form\n * (both publish to this channel).\n */\nfunction subscribeV4Command(): void {\n bindTracingChannelToSpan(\n diagnosticsChannel.tracingChannel<MongoChannelContext>(CHANNELS.MONGODB_COMMAND),\n data => {\n const args = data.arguments ?? [];\n const ns = args[0] as MongodbNamespace | undefined;\n const cmd = args[1] as Record<string, unknown> | undefined;\n // Skip handshake/heartbeat commands (matches otel).\n if (!ns || !cmd || typeof cmd !== 'object' || cmd.ismaster || cmd.hello) {\n return undefined;\n }\n const operation = Object.keys(cmd)[0];\n return startMongoSpan(getV4SpanAttributes(data.self, ns, cmd, operation, ORIGIN));\n },\n // Matches otel's `shouldSkipInstrumentation`: only trace when there is\n // an active parent span, to avoid emitting orphaned mongodb spans.\n { requiresParentSpan: true },\n );\n}\n\n/**\n * `ConnectionPool.prototype.checkOut` (mongodb 4.0 - 6.3, callback form).\n * Creates no span (`getSpan` returns `undefined`) but the binding re-runs\n * the checkout callback under the caller's captured context, so the pooled\n * `command()` invoked inside it re-inherits the active span.\n */\nfunction subscribeV4Checkout(): void {\n bindTracingChannelToSpan(diagnosticsChannel.tracingChannel(CHANNELS.MONGODB_CHECKOUT), () => undefined);\n}\n\n/**\n * mongodb >=3.3 <4 had no unified `command`; each operation is a separate\n * `lib/core/wireprotocol` function with its own argument layout, so each\n * channel extracts topology/namespace/command/op differently before building\n * the span.\n */\nfunction subscribeV3Wireprotocol(): void {\n for (const operation of ['insert', 'update', 'remove'] as const) {\n const channel =\n operation === 'insert'\n ? CHANNELS.MONGODB_V3_INSERT\n : operation === 'update'\n ? CHANNELS.MONGODB_V3_UPDATE\n : CHANNELS.MONGODB_V3_REMOVE;\n bindV3(channel, args => ({\n topology: args[0] as MongoV3Topology | undefined,\n ns: args[1] as string,\n command: (args[2] as Record<string, unknown>[] | undefined)?.[0],\n operation,\n }));\n }\n\n // `command`(server, ns, cmd, options, callback) operation derived from the\n // command doc. Skips commands that have a dedicated channel. See set above.\n bindV3(CHANNELS.MONGODB_V3_COMMAND, args => {\n const command = args[2] as Record<string, unknown> | undefined;\n const type = command ? Object.keys(command)[0] : undefined;\n if (type && V3_DEDICATED_COMMANDS.has(type)) {\n return undefined;\n }\n return {\n topology: args[0] as MongoV3Topology | undefined,\n ns: args[1] as string,\n command,\n operation: command ? getV3CommandOperation(command) : undefined,\n };\n });\n\n // `query`(server, ns, cmd, cursorState, options, callback). a find.\n bindV3(CHANNELS.MONGODB_V3_QUERY, args => ({\n topology: args[0] as MongoV3Topology | undefined,\n ns: args[1] as string,\n command: args[2] as Record<string, unknown> | undefined,\n operation: 'find',\n }));\n\n // `getMore`(server, ns, cursorState, batchSize, options, callback)\n // command doc is `cursorState.cmd`.\n bindV3(CHANNELS.MONGODB_V3_GET_MORE, args => ({\n topology: args[0] as MongoV3Topology | undefined,\n ns: args[1] as string,\n command: (args[2] as { cmd?: Record<string, unknown> } | undefined)?.cmd,\n operation: 'getMore',\n }));\n}\n\nfunction bindV3(channelName: string, extract: (args: unknown[]) => V3CallInfo | undefined): void {\n bindTracingChannelToSpan(\n diagnosticsChannel.tracingChannel<MongoChannelContext>(channelName),\n data => {\n const args = data.arguments;\n if (!args) {\n return undefined;\n }\n const info = extract(args);\n if (!info || typeof info.ns !== 'string') {\n return undefined;\n }\n return startMongoSpan(getV3SpanAttributes(info.ns, info.topology, info.command, info.operation, ORIGIN));\n },\n { requiresParentSpan: true },\n );\n}\n\n/**\n * EXPERIMENTAL: orchestrion-driven mongodb integration.\n *\n * Reproduces the vendored `@opentelemetry/instrumentation-mongodb` span shape\n * (legacy db/net semantic conventions, `mongodb.<op>` names, scrubbed\n * `db.statement`) via the `orchestrion:mongodb:*` diagnostics_channels\n * injected by the orchestrion code transform.\n */\nexport const mongodbChannelIntegration = defineIntegration(_mongodbChannelIntegration);\n"],"names":["waitForTracingChannelBinding","bindTracingChannelToSpan","CHANNELS","startMongoSpan","getV4SpanAttributes","getV3CommandOperation","getV3SpanAttributes","defineIntegration"],"mappings":";;;;;;;;AAaA,MAAM,gBAAA,GAAmB,OAAA;AAEzB,MAAM,MAAA,GAAS,2BAAA;AA+Bf,MAAM,qBAAA,mBAAwB,IAAI,GAAA,CAAI,CAAC,QAAA,EAAU,UAAU,QAAA,EAAU,MAAA,EAAQ,SAAA,EAAW,aAAa,CAAC,CAAA;AAEtG,MAAM,8BAA8B,MAAM;AACxC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,IAAI,CAAC,mBAAmB,cAAA,EAAgB;AACtC,QAAA;AAAA,MACF;AAEA,MAAAA,iCAAA,CAA6B,MAAM;AACjC,QAAA,kBAAA,EAAmB;AACnB,QAAA,mBAAA,EAAoB;AACpB,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AAAA,GACb,CAAE,CAAA;AACJ;AAEA,SAAS,MAAA,CAAO,aAAqB,OAAA,EAA4D;AAC/F,EAAAD,uCAAA;AAAA,IACE,kBAAA,CAAmB,eAAoC,WAAW,CAAA;AAAA,IAClE,CAAA,IAAA,KAAQ;AACN,MAAA,MAAM,OAAO,IAAA,CAAK,SAAA;AAClB,MAAA,IAAI,CAAC,IAAA,EAAM;AACT,QAAA,OAAO,MAAA;AAAA,MACT;AACA,MAAA,MAAM,IAAA,GAAO,QAAQ,IAAI,CAAA;AACzB,MAAA,IAAI,CAAC,IAAA,IAAQ,OAAO,IAAA,CAAK,OAAO,QAAA,EAAU;AACxC,QAAA,OAAO,MAAA;AAAA,MACT;AACA,MAAA,OAAOE,0BAAA,CAAeG,+BAAA,CAAoB,IAAA,CAAK,EAAA,EAAI,IAAA,CAAK,QAAA,EAAU,IAAA,CAAK,OAAA,EAAS,IAAA,CAAK,SAAA,EAAW,MAAM,CAAC,CAAA;AAAA,IACzG,CAAA;AAAA,IACA,EAAE,oBAAoB,IAAA;AAAK,GAC7B;AACF;AAUO,MAAM,yBAAA,GAA4BC,uBAAkB,0BAA0B;;;;"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const diagnosticsChannel = require('node:diagnostics_channel');
|
|
4
|
+
const core = require('@sentry/core');
|
|
5
|
+
const mongooseDcSubscriber = require('../../mongoose/mongoose-dc-subscriber.js');
|
|
6
|
+
const mongooseLegacySpan = require('../../mongoose/mongoose-legacy-span.js');
|
|
7
|
+
const channels = require('../../orchestrion/channels.js');
|
|
8
|
+
const mongoose = require('../../orchestrion/config/mongoose.js');
|
|
9
|
+
const debugBuild = require('../../debug-build.js');
|
|
10
|
+
const tracingChannel = require('../../tracing-channel.js');
|
|
11
|
+
|
|
12
|
+
const INTEGRATION_NAME = "Mongoose";
|
|
13
|
+
const ORIGIN = "auto.db.orchestrion.mongoose";
|
|
14
|
+
const STORED_PARENT_SPAN = /* @__PURE__ */ new WeakMap();
|
|
15
|
+
let orchestrionSubscribed = false;
|
|
16
|
+
const _mongooseChannelIntegration = (() => {
|
|
17
|
+
return {
|
|
18
|
+
name: INTEGRATION_NAME,
|
|
19
|
+
setupOnce() {
|
|
20
|
+
if (!diagnosticsChannel.tracingChannel) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
core.waitForTracingChannelBinding(() => {
|
|
24
|
+
mongooseDcSubscriber.subscribeMongooseDiagnosticChannels(diagnosticsChannel.tracingChannel);
|
|
25
|
+
subscribeOrchestrionMongooseChannels();
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
function subscribeOrchestrionMongooseChannels() {
|
|
31
|
+
if (orchestrionSubscribed) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
orchestrionSubscribed = true;
|
|
35
|
+
debugBuild.DEBUG_BUILD && core.debug.log("[orchestrion:mongoose] subscribing to injected channels");
|
|
36
|
+
for (const channelName of mongoose.MONGOOSE_CONTEXT_CAPTURE_CHANNELS) {
|
|
37
|
+
channel(channelName).subscribe({
|
|
38
|
+
start(message) {
|
|
39
|
+
stashParentSpan(message.self);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
channel(channels.CHANNELS.MONGOOSE_MODEL_AGGREGATE).subscribe({
|
|
44
|
+
end(message) {
|
|
45
|
+
const result = message.result;
|
|
46
|
+
if (result && typeof result === "object") {
|
|
47
|
+
stashParentSpan(result);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
bindExecSpan(channels.CHANNELS.MONGOOSE_QUERY_EXEC, (self) => {
|
|
52
|
+
const query = self;
|
|
53
|
+
return startSpan(
|
|
54
|
+
query.mongooseCollection,
|
|
55
|
+
query.model?.modelName,
|
|
56
|
+
query.op ?? "exec",
|
|
57
|
+
STORED_PARENT_SPAN.get(self)
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
bindExecSpan(channels.CHANNELS.MONGOOSE_AGGREGATE_EXEC, (self) => {
|
|
61
|
+
const model = self._model;
|
|
62
|
+
return startSpan(model?.collection, model?.modelName, "aggregate", STORED_PARENT_SPAN.get(self));
|
|
63
|
+
});
|
|
64
|
+
bindExecSpan(channels.CHANNELS.MONGOOSE_MODEL_SAVE, (self) => {
|
|
65
|
+
const ctor = self.constructor;
|
|
66
|
+
return startSpan(ctor.collection, ctor.modelName, "save");
|
|
67
|
+
});
|
|
68
|
+
bindExecSpan(channels.CHANNELS.MONGOOSE_MODEL_REMOVE, (self) => {
|
|
69
|
+
const ctor = self.constructor;
|
|
70
|
+
return startSpan(ctor.collection, ctor.modelName, "remove");
|
|
71
|
+
});
|
|
72
|
+
bindExecSpan(channels.CHANNELS.MONGOOSE_MODEL_INSERT_MANY, (self) => {
|
|
73
|
+
const model = self;
|
|
74
|
+
return startSpan(model.collection, model.modelName, "insertMany");
|
|
75
|
+
});
|
|
76
|
+
bindExecSpan(channels.CHANNELS.MONGOOSE_MODEL_BULK_WRITE, (self) => {
|
|
77
|
+
const model = self;
|
|
78
|
+
return startSpan(model.collection, model.modelName, "bulkWrite");
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function startSpan(collection, modelName, operation, parentSpan) {
|
|
82
|
+
return mongooseLegacySpan.startMongooseLegacySpan({ collection, modelName, operation, origin: ORIGIN, parentSpan });
|
|
83
|
+
}
|
|
84
|
+
function channel(channelName) {
|
|
85
|
+
return diagnosticsChannel.tracingChannel(
|
|
86
|
+
channelName
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
function bindExecSpan(channelName, getSpan) {
|
|
90
|
+
tracingChannel.bindTracingChannelToSpan(
|
|
91
|
+
diagnosticsChannel.tracingChannel(channelName),
|
|
92
|
+
(data) => {
|
|
93
|
+
const self = data.self;
|
|
94
|
+
if (!self) {
|
|
95
|
+
return void 0;
|
|
96
|
+
}
|
|
97
|
+
return getSpan(self);
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
function stashParentSpan(self) {
|
|
102
|
+
const active = core.getActiveSpan();
|
|
103
|
+
if (self && active) {
|
|
104
|
+
STORED_PARENT_SPAN.set(self, active);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const mongooseChannelIntegration = core.defineIntegration(_mongooseChannelIntegration);
|
|
108
|
+
|
|
109
|
+
exports.mongooseChannelIntegration = mongooseChannelIntegration;
|
|
110
|
+
//# sourceMappingURL=mongoose.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongoose.js","sources":["../../../../src/integrations/tracing-channel/mongoose.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { IntegrationFn, Span } from '@sentry/core';\nimport { debug, defineIntegration, getActiveSpan, waitForTracingChannelBinding } from '@sentry/core';\nimport { subscribeMongooseDiagnosticChannels } from '../../mongoose/mongoose-dc-subscriber';\nimport type { MongooseLegacyCollection } from '../../mongoose/mongoose-legacy-span';\nimport { startMongooseLegacySpan } from '../../mongoose/mongoose-legacy-span';\nimport { CHANNELS } from '../../orchestrion/channels';\nimport { MONGOOSE_CONTEXT_CAPTURE_CHANNELS } from '../../orchestrion/config/mongoose';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport type { SentryTracingChannel } from '../../tracing-channel';\nimport { bindTracingChannelToSpan } from '../../tracing-channel';\n\nconst INTEGRATION_NAME = 'Mongoose' as const;\n\n// Origin distinguishes the orchestrion path from the OTel/IITM path\n// (`auto.db.otel.mongoose`) and the native diagnostics_channel path\n// (`auto.db.mongoose.diagnostic_channel`).\nconst ORIGIN = 'auto.db.orchestrion.mongoose';\n\ninterface MongooseQuery {\n mongooseCollection?: MongooseLegacyCollection;\n model?: { modelName?: string };\n op?: string;\n}\n\ninterface MongooseAggregate {\n _model?: { collection?: MongooseLegacyCollection; modelName?: string };\n}\n\ninterface MongooseModelStatic {\n collection?: MongooseLegacyCollection;\n modelName?: string;\n}\n\ninterface MongooseDocument {\n constructor: { collection?: MongooseLegacyCollection; modelName?: string };\n}\n\n/**\n * The shape orchestrion's transform attaches to the tracing-channel context\n * object. `self` is the `this` of the traced method\n */\ninterface MongooseChannelContext {\n self?: object;\n arguments?: unknown[];\n result?: unknown;\n error?: unknown;\n moduleVersion?: string;\n}\n\n// The active span captured when a query/aggregate was *built*, keyed by the\n// query/aggregate object.\n//\n// Used as the parent for the span created at `exec()` so a query parents to\n// where it was built, not where it happens to be awaited. A WeakMap avoids\n// mutating mongoose's own objects.\nconst STORED_PARENT_SPAN = new WeakMap<object, Span>();\n\nlet orchestrionSubscribed = false;\n\nconst _mongooseChannelIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n if (!diagnosticsChannel.tracingChannel) {\n return;\n }\n\n waitForTracingChannelBinding(() => {\n // mongoose >= 9.7 publishes via its own diagnostics_channel; reuse\n // the shared native subscriber so this single integration covers all\n // versions after it replaces the OTel one. Idempotent and inert on\n // < 9.7 (those channels just never get published to)\n subscribeMongooseDiagnosticChannels(diagnosticsChannel.tracingChannel);\n\n // mongoose < 9.7 is covered by the orchestrion-injected channels.\n subscribeOrchestrionMongooseChannels();\n });\n },\n };\n}) satisfies IntegrationFn;\n\nfunction subscribeOrchestrionMongooseChannels(): void {\n if (orchestrionSubscribed) {\n return;\n }\n orchestrionSubscribed = true;\n\n DEBUG_BUILD && debug.log('[orchestrion:mongoose] subscribing to injected channels');\n\n // Context-capture builders: stash the active span at build time so `exec()`\n // can parent to it.\n for (const channelName of MONGOOSE_CONTEXT_CAPTURE_CHANNELS) {\n channel(channelName).subscribe({\n start(message) {\n stashParentSpan(message.self);\n },\n });\n }\n\n // `Model.aggregate()` returns the aggregate it builds; stash the parent on\n // the returned object.\n channel(CHANNELS.MONGOOSE_MODEL_AGGREGATE).subscribe({\n end(message) {\n const result = message.result;\n if (result && typeof result === 'object') {\n stashParentSpan(result);\n }\n },\n });\n\n // Query execution.\n bindExecSpan(CHANNELS.MONGOOSE_QUERY_EXEC, self => {\n const query = self as MongooseQuery;\n return startSpan(\n query.mongooseCollection,\n query.model?.modelName,\n query.op ?? 'exec',\n STORED_PARENT_SPAN.get(self),\n );\n });\n\n // Aggregation execution.\n bindExecSpan(CHANNELS.MONGOOSE_AGGREGATE_EXEC, self => {\n const model = (self as MongooseAggregate)._model;\n return startSpan(model?.collection, model?.modelName, 'aggregate', STORED_PARENT_SPAN.get(self));\n });\n\n // `doc.save()` (and the `$save` alias).\n bindExecSpan(CHANNELS.MONGOOSE_MODEL_SAVE, self => {\n const ctor = (self as MongooseDocument).constructor;\n return startSpan(ctor.collection, ctor.modelName, 'save');\n });\n\n // `doc.remove()` (mongoose 5/6).\n bindExecSpan(CHANNELS.MONGOOSE_MODEL_REMOVE, self => {\n const ctor = (self as MongooseDocument).constructor;\n return startSpan(ctor.collection, ctor.modelName, 'remove');\n });\n\n // Static batch operations. `self` is the Model.\n bindExecSpan(CHANNELS.MONGOOSE_MODEL_INSERT_MANY, self => {\n const model = self as MongooseModelStatic;\n return startSpan(model.collection, model.modelName, 'insertMany');\n });\n bindExecSpan(CHANNELS.MONGOOSE_MODEL_BULK_WRITE, self => {\n const model = self as MongooseModelStatic;\n return startSpan(model.collection, model.modelName, 'bulkWrite');\n });\n}\n\nfunction startSpan(\n collection: MongooseLegacyCollection | undefined,\n modelName: string | undefined,\n operation: string,\n parentSpan?: Span,\n): Span {\n return startMongooseLegacySpan({ collection, modelName, operation, origin: ORIGIN, parentSpan });\n}\n\n// `SentryTracingChannel` relaxes Node's subscriber type to a `Partial`, so a\n// `start`-only (or `end`-only) subscriber for the context-capture channels\n// is accepted.\nfunction channel(channelName: string): SentryTracingChannel<MongooseChannelContext> {\n return diagnosticsChannel.tracingChannel<MongooseChannelContext>(\n channelName,\n ) as unknown as SentryTracingChannel<MongooseChannelContext>;\n}\n\nfunction bindExecSpan(channelName: string, getSpan: (self: object) => Span): void {\n bindTracingChannelToSpan<MongooseChannelContext>(\n diagnosticsChannel.tracingChannel<MongooseChannelContext>(channelName),\n data => {\n const self = data.self;\n if (!self) {\n return undefined;\n }\n return getSpan(self);\n },\n );\n}\n\nfunction stashParentSpan(self: object | undefined): void {\n const active = getActiveSpan();\n if (self && active) {\n STORED_PARENT_SPAN.set(self, active);\n }\n}\n\n/**\n * EXPERIMENTAL: orchestrion-driven mongoose integration.\n *\n * Reproduces the vendored `@opentelemetry/instrumentation-mongoose` span\n * shape (legacy db/net semantic conventions, `mongoose.<Model>.<op>` names,\n * build-time span parenting) via the `orchestrion:mongoose:*`\n * diagnostics_channels injected into mongoose `< 9.7` by the orchestrion\n * code transform. For mongoose `>= 9.7` it also drives the native\n * diagnostics_channel subscription, so this single integration covers every\n * supported version once it replaces the OTel one.\n */\nexport const mongooseChannelIntegration = defineIntegration(_mongooseChannelIntegration);\n"],"names":["waitForTracingChannelBinding","subscribeMongooseDiagnosticChannels","DEBUG_BUILD","debug","MONGOOSE_CONTEXT_CAPTURE_CHANNELS","CHANNELS","startMongooseLegacySpan","bindTracingChannelToSpan","getActiveSpan","defineIntegration"],"mappings":";;;;;;;;;;;AAYA,MAAM,gBAAA,GAAmB,UAAA;AAKzB,MAAM,MAAA,GAAS,8BAAA;AAuCf,MAAM,kBAAA,uBAAyB,OAAA,EAAsB;AAErD,IAAI,qBAAA,GAAwB,KAAA;AAE5B,MAAM,+BAA+B,MAAM;AACzC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,IAAI,CAAC,mBAAmB,cAAA,EAAgB;AACtC,QAAA;AAAA,MACF;AAEA,MAAAA,iCAAA,CAA6B,MAAM;AAKjC,QAAAC,wDAAA,CAAoC,mBAAmB,cAAc,CAAA;AAGrE,QAAA,oCAAA,EAAqC;AAAA,MACvC,CAAC,CAAA;AAAA,IACH;AAAA,GACF;AACF,CAAA,CAAA;AAEA,SAAS,oCAAA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A,IACrE,CAAA,IAAA,KAAQ;AACN,MAAA,MAAM,OAAO,IAAA,CAAK,IAAA;AAClB,MAAA,IAAI,CAAC,IAAA,EAAM;AACT,QAAA,OAAO,MAAA;AAAA,MACT;AACA,MAAA,OAAO,QAAQ,IAAI,CAAA;AAAA,IACrB;AAAA,GACF;AACF;AAEA,SAAS,gBAAgB,IAAA,EAAgC;AACvD,EAAA,MAAM,SAASC,kBAAA,EAAc;AAC7B,EAAA,IAAI,QAAQ,MAAA,EAAQ;AAClB,IAAA,kBAAA,CAAmB,GAAA,CAAI,MAAM,MAAM,CAAA;AAAA,EACrC;AACF;AAaO,MAAM,0BAAA,GAA6BC,uBAAkB,2BAA2B;;;;"}
|
|
@@ -0,0 +1,107 @@
|
|
|
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 tracingChannel = require('../../tracing-channel.js');
|
|
8
|
+
|
|
9
|
+
const INTEGRATION_NAME = "Mysql";
|
|
10
|
+
const ATTR_DB_SYSTEM = "db.system";
|
|
11
|
+
const ATTR_DB_CONNECTION_STRING = "db.connection_string";
|
|
12
|
+
const ATTR_DB_NAME = "db.name";
|
|
13
|
+
const ATTR_DB_USER = "db.user";
|
|
14
|
+
const ATTR_DB_STATEMENT = "db.statement";
|
|
15
|
+
const ATTR_NET_PEER_NAME = "net.peer.name";
|
|
16
|
+
const ATTR_NET_PEER_PORT = "net.peer.port";
|
|
17
|
+
const _mysqlChannelIntegration = (() => {
|
|
18
|
+
return {
|
|
19
|
+
name: INTEGRATION_NAME,
|
|
20
|
+
setupOnce() {
|
|
21
|
+
if (!diagnosticsChannel.tracingChannel) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
debugBuild.DEBUG_BUILD && core.debug.log(`[orchestrion:mysql] subscribing to channel "${channels.CHANNELS.MYSQL_QUERY}"`);
|
|
25
|
+
core.waitForTracingChannelBinding(() => {
|
|
26
|
+
tracingChannel.bindTracingChannelToSpan(
|
|
27
|
+
diagnosticsChannel.tracingChannel(channels.CHANNELS.MYSQL_QUERY),
|
|
28
|
+
(data) => {
|
|
29
|
+
const sql = extractSql(data.arguments[0]);
|
|
30
|
+
const { host, port, database, user } = getConnectionConfig(data.self);
|
|
31
|
+
const portNumber = typeof port === "string" ? parseInt(port, 10) : port;
|
|
32
|
+
const portIsNumber = typeof portNumber === "number" && !isNaN(portNumber);
|
|
33
|
+
data._sentryCallerScope = core.getCurrentScope();
|
|
34
|
+
return core.startInactiveSpan({
|
|
35
|
+
name: sql ?? "mysql.query",
|
|
36
|
+
kind: core.SPAN_KIND.CLIENT,
|
|
37
|
+
op: "db",
|
|
38
|
+
attributes: {
|
|
39
|
+
[ATTR_DB_SYSTEM]: "mysql",
|
|
40
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.db.orchestrion.mysql",
|
|
41
|
+
[ATTR_DB_CONNECTION_STRING]: getJDBCString(host, portIsNumber ? portNumber : void 0, database),
|
|
42
|
+
...database ? { [ATTR_DB_NAME]: database } : {},
|
|
43
|
+
...user ? { [ATTR_DB_USER]: user } : {},
|
|
44
|
+
...sql ? { [ATTR_DB_STATEMENT]: sql } : {},
|
|
45
|
+
...host ? { [ATTR_NET_PEER_NAME]: host } : {},
|
|
46
|
+
...portIsNumber ? { [ATTR_NET_PEER_PORT]: portNumber } : {}
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
// No-callback `query(sql)` returns a streamable `Query` emitter as `result`; it settles on the
|
|
52
|
+
// emitter's `'end'`/`'error'`, not the channel, so defer ending to those.
|
|
53
|
+
deferSpanEnd({ data, end }) {
|
|
54
|
+
const result = data.result;
|
|
55
|
+
if (!result || typeof result !== "object" || !hasOnMethod(result)) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
const callerScope = data._sentryCallerScope;
|
|
59
|
+
if (callerScope) {
|
|
60
|
+
core.bindScopeToEmitter(result, callerScope);
|
|
61
|
+
}
|
|
62
|
+
result.on("error", (err) => end(err));
|
|
63
|
+
result.on("end", () => end());
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
function hasOnMethod(obj) {
|
|
73
|
+
return "on" in obj && typeof obj.on === "function";
|
|
74
|
+
}
|
|
75
|
+
function extractSql(firstArg) {
|
|
76
|
+
if (typeof firstArg === "string") {
|
|
77
|
+
return firstArg;
|
|
78
|
+
}
|
|
79
|
+
if (core.isObjectLike(firstArg) && "sql" in firstArg) {
|
|
80
|
+
const sql = firstArg.sql;
|
|
81
|
+
return typeof sql === "string" ? sql : void 0;
|
|
82
|
+
}
|
|
83
|
+
return void 0;
|
|
84
|
+
}
|
|
85
|
+
function getConnectionConfig(connection) {
|
|
86
|
+
const config = connection?.config?.connectionConfig ?? connection?.config ?? {};
|
|
87
|
+
return {
|
|
88
|
+
host: config.host,
|
|
89
|
+
port: config.port,
|
|
90
|
+
database: config.database,
|
|
91
|
+
user: config.user
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function getJDBCString(host, port, database) {
|
|
95
|
+
let s = `jdbc:mysql://${host || "localhost"}`;
|
|
96
|
+
if (typeof port === "number") {
|
|
97
|
+
s += `:${port}`;
|
|
98
|
+
}
|
|
99
|
+
if (database) {
|
|
100
|
+
s += `/${database}`;
|
|
101
|
+
}
|
|
102
|
+
return s;
|
|
103
|
+
}
|
|
104
|
+
const mysqlChannelIntegration = core.defineIntegration(_mysqlChannelIntegration);
|
|
105
|
+
|
|
106
|
+
exports.mysqlChannelIntegration = mysqlChannelIntegration;
|
|
107
|
+
//# sourceMappingURL=mysql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mysql.js","sources":["../../../../src/integrations/tracing-channel/mysql.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { IntegrationFn, Scope } from '@sentry/core';\nimport {\n isObjectLike,\n bindScopeToEmitter,\n debug,\n defineIntegration,\n getCurrentScope,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_KIND,\n startInactiveSpan,\n waitForTracingChannelBinding,\n} from '@sentry/core';\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.\n// When enabled, OTel 'Mysql' integration is omitted from the default set.\nconst INTEGRATION_NAME = 'Mysql' as const;\n\n// OTel \"OLD\" db/net semantic-conventions, inlined to keep this integration free of OTel deps. Matches\n// `@opentelemetry/instrumentation-mysql`'s default and the SDK's `inferDbSpanData` (which renames spans\n// off `db.statement`).\nconst ATTR_DB_SYSTEM = 'db.system';\nconst ATTR_DB_CONNECTION_STRING = 'db.connection_string';\nconst ATTR_DB_NAME = 'db.name';\nconst ATTR_DB_USER = 'db.user';\nconst ATTR_DB_STATEMENT = 'db.statement';\nconst ATTR_NET_PEER_NAME = 'net.peer.name';\nconst ATTR_NET_PEER_PORT = 'net.peer.port';\n\n/**\n * The shape orchestrion's transform attaches to the tracing-channel `context` object. Documented here\n * rather than imported because orchestrion's runtime doesn't export it.\n */\ninterface MysqlQueryChannelContext {\n // The live args array passed to the wrapped `connection.query` call; `arguments[0]` is the SQL.\n arguments: unknown[];\n self?: MysqlConnection;\n moduleVersion?: string;\n result?: unknown;\n error?: unknown;\n // The caller's scope, captured at `start` and replayed onto the streamed `Query` emitter (see below).\n _sentryCallerScope?: Scope;\n}\n\ninterface MysqlConnectionConfig {\n host?: string;\n port?: number | string;\n database?: string;\n user?: string;\n // Pool connections nest the real config one level deeper.\n connectionConfig?: MysqlConnectionConfig;\n}\n\ninterface MysqlConnection {\n config?: MysqlConnectionConfig;\n}\n\nconst _mysqlChannelIntegration = (() => {\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:mysql] subscribing to channel \"${CHANNELS.MYSQL_QUERY}\"`);\n\n waitForTracingChannelBinding(() => {\n bindTracingChannelToSpan(\n diagnosticsChannel.tracingChannel<MysqlQueryChannelContext>(CHANNELS.MYSQL_QUERY),\n data => {\n const sql = extractSql(data.arguments[0]);\n const { host, port, database, user } = getConnectionConfig(data.self);\n const portNumber = typeof port === 'string' ? parseInt(port, 10) : port;\n const portIsNumber = typeof portNumber === 'number' && !isNaN(portNumber);\n\n // For the streamed path: mysql emits the `Query` emitter's events from its socket data\n // handler with the caller's context lost. `deferSpanEnd` replays this scope onto the emitter.\n data._sentryCallerScope = getCurrentScope();\n\n return startInactiveSpan({\n name: sql ?? 'mysql.query',\n kind: SPAN_KIND.CLIENT,\n op: 'db',\n attributes: {\n [ATTR_DB_SYSTEM]: 'mysql',\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.orchestrion.mysql',\n [ATTR_DB_CONNECTION_STRING]: getJDBCString(host, portIsNumber ? portNumber : undefined, database),\n ...(database ? { [ATTR_DB_NAME]: database } : {}),\n ...(user ? { [ATTR_DB_USER]: user } : {}),\n ...(sql ? { [ATTR_DB_STATEMENT]: sql } : {}),\n ...(host ? { [ATTR_NET_PEER_NAME]: host } : {}),\n ...(portIsNumber ? { [ATTR_NET_PEER_PORT]: portNumber } : {}),\n },\n });\n },\n {\n // No-callback `query(sql)` returns a streamable `Query` emitter as `result`; it settles on the\n // emitter's `'end'`/`'error'`, not the channel, so defer ending to those.\n deferSpanEnd({ data, end }) {\n const result = data.result;\n if (!result || typeof result !== 'object' || !hasOnMethod(result)) {\n return false;\n }\n\n // Replay the caller's scope so user listeners on the emitter nest under it, not a new trace.\n const callerScope = data._sentryCallerScope;\n if (callerScope) {\n bindScopeToEmitter(result, callerScope);\n }\n\n result.on('error', err => end(err));\n result.on('end', () => end());\n\n return true;\n },\n },\n );\n });\n },\n };\n}) satisfies IntegrationFn;\n\nfunction hasOnMethod(obj: object): obj is { on: (event: string, listener: (arg?: unknown) => void) => unknown } {\n return 'on' in obj && typeof (obj as { on?: unknown }).on === 'function';\n}\n\nfunction extractSql(firstArg: unknown): string | undefined {\n if (typeof firstArg === 'string') {\n return firstArg;\n }\n if (isObjectLike(firstArg) && 'sql' in firstArg) {\n const sql = (firstArg as { sql?: unknown }).sql;\n return typeof sql === 'string' ? sql : undefined;\n }\n return undefined;\n}\n\nfunction getConnectionConfig(connection: MysqlConnection | undefined): {\n host?: string;\n port?: number | string;\n database?: string;\n user?: string;\n} {\n // Pool connections nest the real config under `.connectionConfig`; single\n // connections expose it directly. Matches `@opentelemetry/instrumentation-mysql`.\n const config = connection?.config?.connectionConfig ?? connection?.config ?? {};\n return {\n host: config.host,\n port: config.port,\n database: config.database,\n user: config.user,\n };\n}\n\nfunction getJDBCString(host: string | undefined, port: number | undefined, database: string | undefined): string {\n let s = `jdbc:mysql://${host || 'localhost'}`;\n if (typeof port === 'number') {\n s += `:${port}`;\n }\n if (database) {\n s += `/${database}`;\n }\n return s;\n}\n\n/**\n * EXPERIMENTAL — orchestrion-driven mysql integration.\n *\n * Subscribes to the `orchestrion:mysql:query` diagnostics_channel that the\n * orchestrion code transform injects into `mysql/lib/Connection.js`'s\n * `Connection.prototype.query`. Requires the orchestrion runtime hook or\n * bundler plugin to be active — wire that up via `_experimentalSetupOrchestrion`.\n */\nexport const mysqlChannelIntegration = defineIntegration(_mysqlChannelIntegration);\n"],"names":["DEBUG_BUILD","debug","CHANNELS","waitForTracingChannelBinding","bindTracingChannelToSpan","getCurrentScope","startInactiveSpan","SPAN_KIND","SEMANTIC_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0BC,uBAAkB,wBAAwB;;;;"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const diagnosticsChannel = require('node:diagnostics_channel');
|
|
4
|
+
const core = require('@sentry/core');
|
|
5
|
+
const mysql2DcSubscriber = require('../../mysql2/mysql2-dc-subscriber.js');
|
|
6
|
+
const channels = require('../../orchestrion/channels.js');
|
|
7
|
+
const tracingChannel = require('../../tracing-channel.js');
|
|
8
|
+
const attributes = require('@sentry/conventions/attributes');
|
|
9
|
+
|
|
10
|
+
const INTEGRATION_NAME = "Mysql2";
|
|
11
|
+
const ORIGIN = "auto.db.orchestrion.mysql2";
|
|
12
|
+
const DB_SYSTEM_VALUE_MYSQL = "mysql";
|
|
13
|
+
function instrumentMysql2() {
|
|
14
|
+
mysql2DcSubscriber.subscribeMysql2DiagnosticChannels(diagnosticsChannel.tracingChannel);
|
|
15
|
+
subscribeQueryChannel(channels.CHANNELS.MYSQL2_QUERY);
|
|
16
|
+
subscribeQueryChannel(channels.CHANNELS.MYSQL2_EXECUTE);
|
|
17
|
+
}
|
|
18
|
+
function subscribeQueryChannel(channelName) {
|
|
19
|
+
tracingChannel.bindTracingChannelToSpan(
|
|
20
|
+
diagnosticsChannel.tracingChannel(channelName),
|
|
21
|
+
(data) => {
|
|
22
|
+
const statement = getQueryText(data.arguments);
|
|
23
|
+
return core.startInactiveSpan({
|
|
24
|
+
name: statement ?? "mysql2.query",
|
|
25
|
+
kind: core.SPAN_KIND.CLIENT,
|
|
26
|
+
attributes: {
|
|
27
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
|
|
28
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: "db",
|
|
29
|
+
// oxlint-disable-next-line typescript/no-deprecated
|
|
30
|
+
[attributes.DB_SYSTEM]: DB_SYSTEM_VALUE_MYSQL,
|
|
31
|
+
...getConnectionAttributes(data.self?.config),
|
|
32
|
+
// oxlint-disable-next-line typescript/no-deprecated
|
|
33
|
+
[attributes.DB_STATEMENT]: statement || void 0
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
{ requiresParentSpan: true }
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
function getQueryText(args) {
|
|
41
|
+
return extractSql(args[0]);
|
|
42
|
+
}
|
|
43
|
+
function extractSql(firstArg) {
|
|
44
|
+
if (typeof firstArg === "string") {
|
|
45
|
+
return firstArg;
|
|
46
|
+
}
|
|
47
|
+
if (core.isObjectLike(firstArg) && "sql" in firstArg) {
|
|
48
|
+
const sql = firstArg.sql;
|
|
49
|
+
return typeof sql === "string" ? sql : void 0;
|
|
50
|
+
}
|
|
51
|
+
return void 0;
|
|
52
|
+
}
|
|
53
|
+
function getConnectionAttributes(config) {
|
|
54
|
+
const { host, port, database, user } = config?.connectionConfig ?? config ?? {};
|
|
55
|
+
const portNumber = typeof port === "string" ? parseInt(port, 10) : port;
|
|
56
|
+
const portIsNumber = typeof portNumber === "number" && !isNaN(portNumber);
|
|
57
|
+
return {
|
|
58
|
+
// oxlint-disable-next-line typescript/no-deprecated
|
|
59
|
+
[attributes.DB_NAME]: database || void 0,
|
|
60
|
+
[attributes.DB_USER]: user || void 0,
|
|
61
|
+
// oxlint-disable-next-line typescript/no-deprecated
|
|
62
|
+
[attributes.NET_PEER_NAME]: host || void 0,
|
|
63
|
+
// oxlint-disable-next-line typescript/no-deprecated
|
|
64
|
+
[attributes.NET_PEER_PORT]: portIsNumber ? portNumber : void 0
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
const _mysql2ChannelIntegration = (() => {
|
|
68
|
+
return {
|
|
69
|
+
name: INTEGRATION_NAME,
|
|
70
|
+
setupOnce() {
|
|
71
|
+
if (!diagnosticsChannel.tracingChannel) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
core.waitForTracingChannelBinding(() => {
|
|
75
|
+
instrumentMysql2();
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
const mysql2ChannelIntegration = core.defineIntegration(_mysql2ChannelIntegration);
|
|
81
|
+
|
|
82
|
+
exports.mysql2ChannelIntegration = mysql2ChannelIntegration;
|
|
83
|
+
//# sourceMappingURL=mysql2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mysql2.js","sources":["../../../../src/integrations/tracing-channel/mysql2.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { IntegrationFn, SpanAttributes } from '@sentry/core';\nimport {\n defineIntegration,\n isObjectLike,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_KIND,\n startInactiveSpan,\n waitForTracingChannelBinding,\n} from '@sentry/core';\nimport { subscribeMysql2DiagnosticChannels } from '../../mysql2/mysql2-dc-subscriber';\nimport type { ChannelName } from '../../orchestrion/channels';\nimport { CHANNELS } from '../../orchestrion/channels';\nimport { bindTracingChannelToSpan } from '../../tracing-channel';\nimport {\n DB_NAME,\n DB_STATEMENT,\n DB_SYSTEM,\n DB_USER,\n NET_PEER_NAME,\n NET_PEER_PORT,\n} from '@sentry/conventions/attributes';\n\nconst INTEGRATION_NAME = 'Mysql2' as const;\nconst ORIGIN = 'auto.db.orchestrion.mysql2';\nconst DB_SYSTEM_VALUE_MYSQL = 'mysql';\n\n/**\n * The shape orchestrion's transform attaches to the tracing-channel `context` object. Documented here\n * rather than imported because orchestrion's runtime doesn't export it.\n */\ninterface Mysql2QueryChannelContext {\n // The live args array passed to the wrapped `query`/`execute` call: `arguments[0]` is the SQL (a\n // string, `Query`, or `{ sql, values }`), `arguments[1]` is the values array or a callback.\n arguments: unknown[];\n self?: Mysql2Connection;\n result?: unknown;\n error?: unknown;\n}\n\ninterface Mysql2ConnectionConfig {\n host?: string;\n port?: number | string;\n database?: string;\n user?: string;\n // Pool connections nest the real config one level deeper.\n connectionConfig?: Mysql2ConnectionConfig;\n}\n\ninterface Mysql2Connection {\n config?: Mysql2ConnectionConfig;\n}\n\n/**\n * Orchestrion-driven mysql2 integration.\n *\n * Subscribes to:\n * - the `orchestrion:mysql2:query`/`:execute` channels the code transform injects into mysql2's\n * `query`/`execute` (mysql2 `< 3.20.0`), and\n * - mysql2's native `node:diagnostics_channel` tracing channels (mysql2 `>= 3.20.0`), which the\n * transform intentionally leaves alone.\n *\n * The two version ranges never overlap, so no query is double-counted. Requires the orchestrion\n * runtime hook or bundler plugin to be active — wire that up via\n * `experimentalUseDiagnosticsChannelInjection`.\n */\nfunction instrumentMysql2(): void {\n // mysql2 >= 3.20.0: native diagnostics_channel path (inert on older versions, which never publish).\n subscribeMysql2DiagnosticChannels(diagnosticsChannel.tracingChannel);\n\n // mysql2 < 3.20.0: orchestrion-injected channels (inert on >= 3.20.0, which we don't transform).\n subscribeQueryChannel(CHANNELS.MYSQL2_QUERY);\n subscribeQueryChannel(CHANNELS.MYSQL2_EXECUTE);\n}\n\nfunction subscribeQueryChannel(channelName: ChannelName): void {\n bindTracingChannelToSpan(\n diagnosticsChannel.tracingChannel<Mysql2QueryChannelContext>(channelName),\n data => {\n const statement = getQueryText(data.arguments);\n\n return startInactiveSpan({\n name: statement ?? 'mysql2.query',\n kind: SPAN_KIND.CLIENT,\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db',\n // oxlint-disable-next-line typescript/no-deprecated\n [DB_SYSTEM]: DB_SYSTEM_VALUE_MYSQL,\n ...getConnectionAttributes(data.self?.config),\n // oxlint-disable-next-line typescript/no-deprecated\n [DB_STATEMENT]: statement || undefined,\n },\n });\n },\n { requiresParentSpan: true },\n );\n}\n\n/**\n * Render the `db.statement` from the wrapped call's first argument.\n */\nfunction getQueryText(args: unknown[]): string | undefined {\n return extractSql(args[0]);\n}\n\nfunction extractSql(firstArg: unknown): string | undefined {\n if (typeof firstArg === 'string') {\n return firstArg;\n }\n if (isObjectLike(firstArg) && 'sql' in firstArg) {\n const sql = (firstArg as { sql?: unknown }).sql;\n return typeof sql === 'string' ? sql : undefined;\n }\n return undefined;\n}\n\nfunction getConnectionAttributes(config: Mysql2ConnectionConfig | undefined): SpanAttributes {\n // Pool connections nest the real config under `.connectionConfig`; single connections expose it\n // directly. Matches `@opentelemetry/instrumentation-mysql2`.\n const { host, port, database, user } = config?.connectionConfig ?? config ?? {};\n const portNumber = typeof port === 'string' ? parseInt(port, 10) : port;\n const portIsNumber = typeof portNumber === 'number' && !isNaN(portNumber);\n\n return {\n // oxlint-disable-next-line typescript/no-deprecated\n [DB_NAME]: database || undefined,\n [DB_USER]: user || undefined,\n // oxlint-disable-next-line typescript/no-deprecated\n [NET_PEER_NAME]: host || undefined,\n // oxlint-disable-next-line typescript/no-deprecated\n [NET_PEER_PORT]: portIsNumber ? portNumber : undefined,\n };\n}\n\nconst _mysql2ChannelIntegration = (() => {\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 waitForTracingChannelBinding(() => {\n instrumentMysql2();\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Orchestrion-driven mysql2 integration.\n *\n * Adds Sentry tracing instrumentation for the [mysql2](https://www.npmjs.com/package/mysql2) library\n * via diagnostics-channel injection. See {@link instrumentMysql2} for how the two mysql2 version\n * ranges are covered.\n *\n * Known limitation vs. the OTel integration it replaces: the callback-less streaming form\n * (`connection.query(sql).on('result', ...)`) is not traced — see the `mysql2` orchestrion config for\n * why. The callback and promise forms (the common case) are fully instrumented.\n */\nexport const mysql2ChannelIntegration = defineIntegration(_mysql2ChannelIntegration);\n"],"names":["subscribeMysql2DiagnosticChannels","CHANNELS","bindTracingChannelToSpan","startInactiveSpan","SPAN_KIND","SEMANTI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yB;;;;"}
|
|
@@ -0,0 +1,81 @@
|
|
|
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 tracingChannel = require('../../tracing-channel.js');
|
|
8
|
+
|
|
9
|
+
const INTEGRATION_NAME = "OpenAI";
|
|
10
|
+
const ORIGIN = "auto.ai.orchestrion.openai";
|
|
11
|
+
const INSTRUMENTED_CHANNELS = [
|
|
12
|
+
{ channel: channels.CHANNELS.OPENAI_CHAT, operation: "chat" },
|
|
13
|
+
{ channel: channels.CHANNELS.OPENAI_EMBEDDINGS, operation: "embeddings" }
|
|
14
|
+
];
|
|
15
|
+
let subscribed = false;
|
|
16
|
+
const _openaiChannelIntegration = ((options = {}) => {
|
|
17
|
+
return {
|
|
18
|
+
name: INTEGRATION_NAME,
|
|
19
|
+
setupOnce() {
|
|
20
|
+
if (!diagnosticsChannel.tracingChannel || subscribed) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
subscribed = true;
|
|
24
|
+
core.waitForTracingChannelBinding(() => {
|
|
25
|
+
for (const { channel, operation } of INSTRUMENTED_CHANNELS) {
|
|
26
|
+
debugBuild.DEBUG_BUILD && core.debug.log(`[orchestrion:openai] subscribing to channel "${channel}"`);
|
|
27
|
+
tracingChannel.bindTracingChannelToSpan(
|
|
28
|
+
diagnosticsChannel.tracingChannel(channel),
|
|
29
|
+
(data) => createGenAiSpan(data, operation, options),
|
|
30
|
+
{
|
|
31
|
+
beforeSpanEnd: (span, data) => {
|
|
32
|
+
core.addOpenAiResponseAttributes(span, data.result, core.resolveAIRecordingOptions(options).recordOutputs);
|
|
33
|
+
},
|
|
34
|
+
// Streaming: the result is a `Stream` consumed later, so instrument it and let it end the span.
|
|
35
|
+
deferSpanEnd: ({ span, data }) => wrapStreamResult(span, data, options)
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
function createGenAiSpan(data, operation, options) {
|
|
44
|
+
if (core._INTERNAL_shouldSkipAiProviderWrapping(INTEGRATION_NAME)) {
|
|
45
|
+
return void 0;
|
|
46
|
+
}
|
|
47
|
+
const args = data.arguments ?? [];
|
|
48
|
+
const params = args[0];
|
|
49
|
+
const { recordInputs } = core.resolveAIRecordingOptions(options);
|
|
50
|
+
const enableTruncation = core.shouldEnableTruncation(options.enableTruncation);
|
|
51
|
+
const attributes = core.extractOpenAiRequestAttributes(args, operation);
|
|
52
|
+
attributes[core.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = ORIGIN;
|
|
53
|
+
const model = params?.model || "unknown";
|
|
54
|
+
const span = core.startInactiveSpan({
|
|
55
|
+
name: `${operation} ${model}`,
|
|
56
|
+
op: `gen_ai.${operation}`,
|
|
57
|
+
attributes
|
|
58
|
+
});
|
|
59
|
+
if (recordInputs && params) {
|
|
60
|
+
core.addOpenAiRequestAttributes(span, params, operation, enableTruncation);
|
|
61
|
+
}
|
|
62
|
+
return span;
|
|
63
|
+
}
|
|
64
|
+
function isAsyncIterable(value) {
|
|
65
|
+
return !!value && typeof value[Symbol.asyncIterator] === "function";
|
|
66
|
+
}
|
|
67
|
+
function wrapStreamResult(span, data, options) {
|
|
68
|
+
const result = data.result;
|
|
69
|
+
if (!isAsyncIterable(result)) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
const { recordOutputs } = core.resolveAIRecordingOptions(options);
|
|
73
|
+
const iterate = result[Symbol.asyncIterator].bind(result);
|
|
74
|
+
const instrumented = core.instrumentOpenAiStream({ [Symbol.asyncIterator]: iterate }, span, recordOutputs ?? false);
|
|
75
|
+
result[Symbol.asyncIterator] = () => instrumented;
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
const openaiChannelIntegration = core.defineIntegration(_openaiChannelIntegration);
|
|
79
|
+
|
|
80
|
+
exports.openaiChannelIntegration = openaiChannelIntegration;
|
|
81
|
+
//# sourceMappingURL=openai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai.js","sources":["../../../../src/integrations/tracing-channel/openai.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { IntegrationFn, OpenAiOptions, Span, SpanAttributeValue } from '@sentry/core';\nimport {\n _INTERNAL_shouldSkipAiProviderWrapping,\n addOpenAiRequestAttributes,\n addOpenAiResponseAttributes,\n debug,\n defineIntegration,\n extractOpenAiRequestAttributes,\n instrumentOpenAiStream,\n resolveAIRecordingOptions,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n shouldEnableTruncation,\n startInactiveSpan,\n waitForTracingChannelBinding,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { CHANNELS } from '../../orchestrion/channels';\nimport { bindTracingChannelToSpan } from '../../tracing-channel';\n\n// Same name as the OTel integration by design: when enabled, the OTel 'OpenAI'\n// integration is dropped from the default set (see the Node opt-in loader).\nconst INTEGRATION_NAME = 'OpenAI' as const;\n\n// Distinct from the proxy's `auto.ai.openai` so spans from the orchestrion path\n// are attributable separately from the OTel/proxy one.\nconst ORIGIN = 'auto.ai.orchestrion.openai';\n\n// Each instrumented `create` method maps to the gen_ai operation its span reports.\nconst INSTRUMENTED_CHANNELS = [\n { channel: CHANNELS.OPENAI_CHAT, operation: 'chat' },\n { channel: CHANNELS.OPENAI_EMBEDDINGS, operation: 'embeddings' },\n] as const;\n\n/**\n * The context object orchestrion shares across the tracing-channel lifecycle hooks: `arguments` is the\n * live args array passed to `Completions.create(body, options)`, and Node's `tracingChannel` attaches\n * `result` when the returned promise settles.\n */\ninterface OpenAiChatChannelContext {\n arguments: unknown[];\n result?: unknown;\n}\n\nlet subscribed = false;\n\nconst _openaiChannelIntegration = ((options: OpenAiOptions = {}) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n // `tracingChannel` is unavailable before Node 18.19, and a second `init()` would double-subscribe.\n if (!diagnosticsChannel.tracingChannel || subscribed) {\n return;\n }\n subscribed = true;\n\n // `bindTracingChannelToSpan` needs the async-context binding that `initOpenTelemetry()` registers\n // after `setupOnce` runs, so wait for it before subscribing.\n waitForTracingChannelBinding(() => {\n for (const { channel, operation } of INSTRUMENTED_CHANNELS) {\n DEBUG_BUILD && debug.log(`[orchestrion:openai] subscribing to channel \"${channel}\"`);\n bindTracingChannelToSpan(\n diagnosticsChannel.tracingChannel<OpenAiChatChannelContext>(channel),\n data => createGenAiSpan(data, operation, options),\n {\n beforeSpanEnd: (span, data) => {\n addOpenAiResponseAttributes(span, data.result, resolveAIRecordingOptions(options).recordOutputs);\n },\n // Streaming: the result is a `Stream` consumed later, so instrument it and let it end the span.\n deferSpanEnd: ({ span, data }) => wrapStreamResult(span, data, options),\n },\n );\n }\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Build the span for an instrumented `create` call.\n * Returning `undefined` opts the payload out so no span is opened.\n */\nfunction createGenAiSpan(data: OpenAiChatChannelContext, operation: string, options: OpenAiOptions): Span | undefined {\n // When another provider (e.g. LangChain) is driving the SDK, it records the spans itself and marks this\n // provider as skipped; skip here to avoid double spans.\n if (_INTERNAL_shouldSkipAiProviderWrapping(INTEGRATION_NAME)) {\n return undefined;\n }\n\n const args = data.arguments ?? [];\n const params = args[0] as Record<string, unknown> | undefined;\n\n const { recordInputs } = resolveAIRecordingOptions(options);\n const enableTruncation = shouldEnableTruncation(options.enableTruncation);\n\n const attributes = extractOpenAiRequestAttributes(args, operation);\n attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = ORIGIN;\n const model = (params?.model as string) || 'unknown';\n\n const span = startInactiveSpan({\n name: `${operation} ${model}`,\n op: `gen_ai.${operation}`,\n attributes: attributes as Record<string, SpanAttributeValue>,\n });\n\n if (recordInputs && params) {\n addOpenAiRequestAttributes(span, params, operation, enableTruncation);\n }\n\n return span;\n}\n\ntype AsyncIterableStream = { [Symbol.asyncIterator]: () => AsyncIterator<unknown> };\n\nfunction isAsyncIterable(value: unknown): value is AsyncIterableStream {\n return !!value && typeof (value as AsyncIterableStream)[Symbol.asyncIterator] === 'function';\n}\n\n/**\n * For a streaming `create({ stream: true })` the result is a `Stream` the caller consumes later. We can't\n * swap what `create` returns, but the `Stream` in `data.result` is the same instance the caller holds and\n * `asyncEnd` fires before the caller iterates — so we patch its async iterator in place to run through\n * `instrumentOpenAiStream`, which accumulates the streamed attributes and ends the span when iteration finishes.\n * Only a streaming call resolves to an async-iterable, so that check alone distinguishes it. Returns `true`\n * to hand span-ending ownership to `instrumentOpenAiStream`; `false` for non-streaming/errored results, which end\n * via the normal `beforeSpanEnd` path.\n */\nfunction wrapStreamResult(span: Span, data: OpenAiChatChannelContext, options: OpenAiOptions): boolean {\n const result = data.result;\n if (!isAsyncIterable(result)) {\n return false;\n }\n\n const { recordOutputs } = resolveAIRecordingOptions(options);\n const iterate = result[Symbol.asyncIterator].bind(result);\n const instrumented = instrumentOpenAiStream({ [Symbol.asyncIterator]: iterate }, span, recordOutputs ?? false);\n result[Symbol.asyncIterator] = () => instrumented;\n\n return true;\n}\n\n/**\n * EXPERIMENTAL — orchestrion-driven OpenAI integration. Subscribes to the `orchestrion:openai:*`\n * diagnostics_channels injected into `openai`'s `create` methods (chat completions, responses, embeddings,\n * conversations), so it requires the orchestrion runtime hook or bundler plugin.\n */\nexport const openaiChannelIntegration = defineIntegration(_openaiChannelIntegration);\n"],"names":["CHANNELS","waitForTracingChannelBinding","DEBUG_BUILD","debug","bindTracingChannelToSpan","addOpenAiResponseAttributes","resolveAIRecordingOptions","_INTERNAL_shouldSkipAiProviderWrapping","shouldEnableTruncation","extractOpenAiRequestAttributes","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","startInactiveSpan","addOpenAiRequestAttribut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