@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":"spans.js","sources":["../../../../../src/integrations/tracing-channel/graphql/spans.ts"],"sourcesContent":["/*\n * Span builders for the orchestrion graphql channels (v14–16). They emit the same spans as the native\n * `diagnostics_channel` subscriber (`../../../graphql/graphql-dc-subscriber.ts`, graphql >= 17) by\n * reusing its `utils` and conventions — only the data source differs: here the payloads are the raw\n * arguments of the injected `parse`/`validate`/`execute` calls rather than graphql's native events.\n */\n\nimport { GRAPHQL_DOCUMENT, GRAPHQL_OPERATION_NAME, GRAPHQL_OPERATION_TYPE } from '@sentry/conventions/attributes';\nimport { WEB_SERVER_GRAPHQL_SPAN_OP } from '@sentry/conventions/op';\nimport type { Span } from '@sentry/core';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_STATUS_ERROR,\n startInactiveSpan,\n} from '@sentry/core';\nimport type { GraphqlDocumentNode } from '../../../graphql/utils';\nimport {\n collectGraphqlDocument,\n getOperationSpanName,\n hasResultErrors,\n renameRootSpanWithOperation,\n} from '../../../graphql/utils';\nimport { GRAPHQL_DATA_SYMBOL, ORIGIN, SPAN_NAME_EXECUTE, SPAN_NAME_PARSE, SPAN_NAME_VALIDATE } from './constants';\nimport { getOperation, wrapFields, wrapFieldResolver } from './resolvers';\nimport type {\n DocumentNode,\n GraphQLFieldResolver,\n GraphQLSchema,\n GraphqlResolvedConfig,\n Maybe,\n ObjectWithGraphQLData,\n} from './types';\n\nconst BASE_ATTRIBUTES = {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: WEB_SERVER_GRAPHQL_SPAN_OP,\n} as const;\n\nexport function startParseSpan(): Span {\n return startInactiveSpan({ name: SPAN_NAME_PARSE, attributes: { ...BASE_ATTRIBUTES } });\n}\n\n/** `documentAST` is the 2nd argument to `validate(schema, documentAST, …)`. */\nexport function startValidateSpan(documentAST: unknown): Span {\n return startInactiveSpan({\n name: SPAN_NAME_VALIDATE,\n attributes: { ...BASE_ATTRIBUTES, [GRAPHQL_DOCUMENT]: collectGraphqlDocument(documentAST as GraphqlDocumentNode) },\n });\n}\n\n/** `result` is validation's return value: a (possibly empty) array of errors. */\nexport function finalizeValidateSpan(span: Span, result: unknown): void {\n if (Array.isArray(result) && result.length > 0) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: 'invalid_argument' });\n }\n}\n\n/** Positional slots of a `graphql.execute(schema, document, …)` call (v14/v15 legacy signature). */\nconst enum ExecuteArg {\n SCHEMA = 0,\n DOCUMENT = 1,\n CONTEXT_VALUE = 3,\n OPERATION_NAME = 5,\n FIELD_RESOLVER = 6,\n}\n\ninterface NormalizedExecuteArgs {\n schema?: GraphQLSchema;\n document?: DocumentNode;\n contextValue: ObjectWithGraphQLData;\n operationName?: Maybe<string>;\n fieldResolver?: Maybe<GraphQLFieldResolver>;\n /** Writes `contextValue`/`fieldResolver` mutations back to the live channel `arguments`. */\n writeBack: (contextValue: ObjectWithGraphQLData, fieldResolver: Maybe<GraphQLFieldResolver>) => void;\n}\n\n/**\n * `execute` accepts either a single `ExecutionArgs` object (modern callers, always in v16) or\n * positional args (v14/v15). Both are normalized here; `writeBack` puts mutations onto the correct\n * slot so they reach the real call.\n */\nfunction normalizeExecuteArgs(argsArray: unknown[]): NormalizedExecuteArgs {\n if (argsArray.length >= 2) {\n return {\n schema: argsArray[ExecuteArg.SCHEMA] as GraphQLSchema | undefined,\n document: argsArray[ExecuteArg.DOCUMENT] as DocumentNode | undefined,\n contextValue: (argsArray[ExecuteArg.CONTEXT_VALUE] ?? {}) as ObjectWithGraphQLData,\n operationName: argsArray[ExecuteArg.OPERATION_NAME] as Maybe<string>,\n fieldResolver: argsArray[ExecuteArg.FIELD_RESOLVER] as Maybe<GraphQLFieldResolver>,\n writeBack: (contextValue, fieldResolver) => {\n argsArray[ExecuteArg.CONTEXT_VALUE] = contextValue;\n argsArray[ExecuteArg.FIELD_RESOLVER] = fieldResolver;\n },\n };\n }\n\n const obj = (argsArray[0] ?? {}) as {\n schema?: GraphQLSchema;\n document?: DocumentNode;\n contextValue?: unknown;\n operationName?: Maybe<string>;\n fieldResolver?: Maybe<GraphQLFieldResolver>;\n };\n return {\n schema: obj.schema,\n document: obj.document,\n contextValue: (obj.contextValue ?? {}) as ObjectWithGraphQLData,\n operationName: obj.operationName,\n fieldResolver: obj.fieldResolver,\n writeBack: (contextValue, fieldResolver) => {\n obj.contextValue = contextValue;\n obj.fieldResolver = fieldResolver;\n },\n };\n}\n\n/**\n * Opens the execute span and, unless resolver spans are disabled, swaps the schema's field resolvers\n * (and the default field resolver) for span-creating proxies — mutating the live `arguments` in place\n * so the wrapped `execute` call runs with them. Always returns a span; the caller guards against\n * throws (see `safe` in `index.ts`).\n */\nexport function startExecuteSpan(\n argsArray: unknown[],\n self: unknown,\n config: GraphqlResolvedConfig,\n getConfig: () => GraphqlResolvedConfig,\n): Span {\n const args = normalizeExecuteArgs(argsArray);\n const { schema, document } = args;\n let { contextValue, fieldResolver } = args;\n\n // Skip resolver wrapping when disabled or when a parent execute already set up this context\n // (nested execute reusing the same contextValue).\n const alreadyInstrumented = !!contextValue[GRAPHQL_DATA_SYMBOL];\n if (!config.ignoreResolveSpans && !alreadyInstrumented) {\n const isUsingDefaultResolver = fieldResolver == null;\n const defaultFieldResolver = (self as { defaultFieldResolver?: GraphQLFieldResolver } | undefined)\n ?.defaultFieldResolver;\n const fieldResolverForExecute = fieldResolver ?? defaultFieldResolver;\n if (fieldResolverForExecute) {\n fieldResolver = wrapFieldResolver(getConfig, fieldResolverForExecute, isUsingDefaultResolver);\n }\n\n if (schema) {\n wrapFields(schema.getQueryType(), getConfig);\n wrapFields(schema.getMutationType(), getConfig);\n }\n }\n\n // v14–16 channels carry only the raw args, so derive the operation from the document (native v17\n // provides `operationType`/`operationName` on the event directly).\n const operation = getOperation(document as DocumentNode, args.operationName);\n const operationType = operation?.operation;\n const operationName = operation?.name?.value ?? args.operationName ?? undefined;\n\n const span = startInactiveSpan({\n name: getOperationSpanName(operationType, operationName || undefined, SPAN_NAME_EXECUTE),\n attributes: {\n ...BASE_ATTRIBUTES,\n [GRAPHQL_OPERATION_TYPE]: operationType,\n [GRAPHQL_OPERATION_NAME]: operationName || undefined,\n [GRAPHQL_DOCUMENT]: collectGraphqlDocument(document as GraphqlDocumentNode | undefined),\n },\n });\n\n if (config.useOperationNameForRootSpan && operationType) {\n renameRootSpanWithOperation(span, operationType, operationName || undefined);\n }\n\n // The resolver proxies read the execute span (and their own bookkeeping) off this symbol.\n contextValue[GRAPHQL_DATA_SYMBOL] = { source: document, span, fields: {} };\n args.writeBack(contextValue, fieldResolver);\n\n return span;\n}\n\n/** `result` is the settled `ExecutionResult`; GraphQL errors surface on `result.errors`, not a throw. */\nexport function finalizeExecuteSpan(span: Span, result: unknown): void {\n if (hasResultErrors(result)) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' });\n }\n}\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
|
2
|
+
"onPreAuth",
|
|
3
|
+
"onCredentials",
|
|
4
|
+
"onPostAuth",
|
|
5
|
+
"onPreHandler",
|
|
6
|
+
"onPostHandler",
|
|
7
|
+
"onPreResponse",
|
|
8
|
+
"onRequest"
|
|
9
|
+
];
|
|
10
|
+
const handlerPatched = /* @__PURE__ */ Symbol("hapi-handler-patched");
|
|
11
|
+
const HapiLayerType = {
|
|
12
|
+
ROUTER: "router",
|
|
13
|
+
PLUGIN: "plugin",
|
|
14
|
+
EXT: "server.ext"
|
|
15
|
+
};
|
|
16
|
+
const HapiLifecycleMethodNames = new Set(LIFECYCLE_EXT_POINTS);
|
|
17
|
+
var AttributeNames = /* @__PURE__ */ ((AttributeNames2) => {
|
|
18
|
+
AttributeNames2["HAPI_TYPE"] = "hapi.type";
|
|
19
|
+
AttributeNames2["PLUGIN_NAME"] = "hapi.plugin.name";
|
|
20
|
+
AttributeNames2["EXT_TYPE"] = "server.ext.type";
|
|
21
|
+
return AttributeNames2;
|
|
22
|
+
})(AttributeNames || {});
|
|
23
|
+
|
|
24
|
+
export { AttributeNames, HapiLayerType, HapiLifecycleMethodNames, handlerPatched };
|
|
25
|
+
//# sourceMappingURL=hapi-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hapi-types.js","sources":["../../../../src/integrations/tracing-channel/hapi-types.ts"],"sourcesContent":["/*\n * Structural type definitions and constants ported from the vendored\n * `@opentelemetry/instrumentation-hapi` types, with all `@hapi/*` and\n * `@opentelemetry/*` dependencies removed. Only the shapes actually accessed by\n * the orchestrion hapi subscriber are kept.\n */\n\n// Single source of truth for the request lifecycle extension points, so the\n// `ServerRequestExtType` union and the runtime `HapiLifecycleMethodNames` set\n// below can't drift apart.\nconst LIFECYCLE_EXT_POINTS = [\n 'onPreAuth',\n 'onCredentials',\n 'onPostAuth',\n 'onPreHandler',\n 'onPostHandler',\n 'onPreResponse',\n 'onRequest',\n] as const;\n\nexport type ServerRequestExtType = (typeof LIFECYCLE_EXT_POINTS)[number];\n\nexport type LifecycleMethod = (request: unknown, h: unknown, err?: Error) => unknown;\n\nexport interface ServerRouteOptions {\n handler?: LifecycleMethod | unknown;\n [key: string]: unknown;\n}\n\nexport interface ServerRoute {\n path: string;\n method: string;\n handler?: LifecycleMethod | unknown;\n options?: ((server: unknown) => ServerRouteOptions) | ServerRouteOptions;\n [key: string]: unknown;\n}\n\nexport interface ServerExtEventsObject {\n type: string;\n [key: string]: unknown;\n}\n\nexport interface ServerExtEventsRequestObject {\n type: ServerRequestExtType;\n method: LifecycleMethod;\n [key: string]: unknown;\n}\n\nexport interface ServerExtOptions {\n [key: string]: unknown;\n}\n\n/**\n * This symbol is used to mark a Hapi route handler or server extension handler as\n * already patched, since it's possible to use these handlers multiple times\n * i.e. when allowing multiple versions of one plugin, or when registering a plugin\n * multiple times on different servers.\n */\nexport const handlerPatched: unique symbol = Symbol('hapi-handler-patched');\n\nexport type PatchableServerRoute = ServerRoute & {\n [handlerPatched]?: boolean;\n};\n\nexport type PatchableExtMethod = LifecycleMethod & {\n [handlerPatched]?: boolean;\n};\n\nexport type ServerExtDirectInput = [ServerRequestExtType, LifecycleMethod, (ServerExtOptions | undefined)?];\n\nexport const HapiLayerType = {\n ROUTER: 'router',\n PLUGIN: 'plugin',\n EXT: 'server.ext',\n} as const;\n\nexport const HapiLifecycleMethodNames = new Set<string>(LIFECYCLE_EXT_POINTS);\n\nexport enum AttributeNames {\n HAPI_TYPE = 'hapi.type',\n PLUGIN_NAME = 'hapi.plugin.name',\n EXT_TYPE = 'server.ext.type',\n}\n"],"names":["AttributeNames"],"mappings":"AAUA,MAAM,oBAAA,GAAuB;AAAA,EAC3B,WAAA;AAAA,EACA,eAAA;AAAA,EACA,YAAA;AAAA,EACA,cAAA;AAAA,EACA,eAAA;AAAA,EACA,eAAA;AAAA,EACA;AACF,CAAA;AAwCO,MAAM,cAAA,0BAAuC,sBAAsB;AAYnE,MAAM,aAAA,GAAgB;AAAA,EAC3B,MAAA,EAAQ,QAAA;AAAA,EACR,MAAA,EAAQ,QAAA;AAAA,EACR,GAAA,EAAK;AACP;AAEO,MAAM,wBAAA,GAA2B,IAAI,GAAA,CAAY,oBAAoB;AAErE,IAAK,cAAA,qBAAAA,eAAAA,KAAL;AACL,EAAAA,gBAAA,WAAA,CAAA,GAAY,WAAA;AACZ,EAAAA,gBAAA,aAAA,CAAA,GAAc,kBAAA;AACd,EAAAA,gBAAA,UAAA,CAAA,GAAW,iBAAA;AAHD,EAAA,OAAAA,eAAAA;AAAA,CAAA,EAAA,cAAA,IAAA,EAAA;;;;"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { getActiveSpan, getRootSpan, spanToJSON, SEMANTIC_ATTRIBUTE_SENTRY_OP, startSpan, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
|
|
2
|
+
import { HTTP_ROUTE, HTTP_METHOD } from '@sentry/conventions/attributes';
|
|
3
|
+
import { handlerPatched, HapiLifecycleMethodNames, HapiLayerType, AttributeNames } from './hapi-types.js';
|
|
4
|
+
|
|
5
|
+
function setHttpServerSpanRouteAttribute(route) {
|
|
6
|
+
const activeSpan = getActiveSpan();
|
|
7
|
+
if (!activeSpan) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const rootSpan = getRootSpan(activeSpan);
|
|
11
|
+
if (!rootSpan) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
if (spanToJSON(rootSpan).data[SEMANTIC_ATTRIBUTE_SENTRY_OP] !== "http.server") {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
rootSpan.setAttribute(HTTP_ROUTE, route);
|
|
18
|
+
}
|
|
19
|
+
const isLifecycleExtType = (variableToCheck) => {
|
|
20
|
+
return typeof variableToCheck === "string" && HapiLifecycleMethodNames.has(variableToCheck);
|
|
21
|
+
};
|
|
22
|
+
const isLifecycleExtEventObj = (variableToCheck) => {
|
|
23
|
+
const event = variableToCheck?.type;
|
|
24
|
+
return event !== void 0 && isLifecycleExtType(event);
|
|
25
|
+
};
|
|
26
|
+
const isDirectExtInput = (variableToCheck) => {
|
|
27
|
+
return Array.isArray(variableToCheck) && variableToCheck.length <= 3 && isLifecycleExtType(variableToCheck[0]) && typeof variableToCheck[1] === "function";
|
|
28
|
+
};
|
|
29
|
+
const isPatchableExtMethod = (variableToCheck) => {
|
|
30
|
+
return !Array.isArray(variableToCheck);
|
|
31
|
+
};
|
|
32
|
+
const getRouteMetadata = (route, pluginName) => {
|
|
33
|
+
const attributes = {
|
|
34
|
+
[HTTP_ROUTE]: route.path,
|
|
35
|
+
// eslint-disable-next-line typescript/no-deprecated -- TODO(v11): Replace deprecated attributes
|
|
36
|
+
[HTTP_METHOD]: route.method
|
|
37
|
+
};
|
|
38
|
+
let name;
|
|
39
|
+
if (pluginName) {
|
|
40
|
+
attributes[AttributeNames.HAPI_TYPE] = HapiLayerType.PLUGIN;
|
|
41
|
+
attributes[AttributeNames.PLUGIN_NAME] = pluginName;
|
|
42
|
+
name = `${pluginName}: route - ${route.path}`;
|
|
43
|
+
} else {
|
|
44
|
+
attributes[AttributeNames.HAPI_TYPE] = HapiLayerType.ROUTER;
|
|
45
|
+
name = `route - ${route.path}`;
|
|
46
|
+
}
|
|
47
|
+
return { attributes, name };
|
|
48
|
+
};
|
|
49
|
+
const getExtMetadata = (extPoint, pluginName, methodName) => {
|
|
50
|
+
let baseName = `ext - ${extPoint}`;
|
|
51
|
+
if (methodName && methodName !== "method") {
|
|
52
|
+
baseName = `ext - ${extPoint} - ${methodName}`;
|
|
53
|
+
}
|
|
54
|
+
if (pluginName) {
|
|
55
|
+
return {
|
|
56
|
+
attributes: {
|
|
57
|
+
[AttributeNames.EXT_TYPE]: extPoint,
|
|
58
|
+
[AttributeNames.HAPI_TYPE]: HapiLayerType.EXT,
|
|
59
|
+
[AttributeNames.PLUGIN_NAME]: pluginName
|
|
60
|
+
},
|
|
61
|
+
name: `${pluginName}: ${baseName}`
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
attributes: {
|
|
66
|
+
[AttributeNames.EXT_TYPE]: extPoint,
|
|
67
|
+
[AttributeNames.HAPI_TYPE]: HapiLayerType.EXT
|
|
68
|
+
},
|
|
69
|
+
name: baseName
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
function startMetadataSpan(metadata, original) {
|
|
73
|
+
return startSpan(
|
|
74
|
+
{
|
|
75
|
+
name: metadata.name,
|
|
76
|
+
op: `${metadata.attributes[AttributeNames.HAPI_TYPE]}.hapi`,
|
|
77
|
+
attributes: {
|
|
78
|
+
...metadata.attributes,
|
|
79
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.http.orchestrion.hapi"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
original
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
function wrapRouteHandler(route, pluginName) {
|
|
86
|
+
if (route[handlerPatched] === true) return route;
|
|
87
|
+
route[handlerPatched] = true;
|
|
88
|
+
const wrapHandler = (oldHandler) => {
|
|
89
|
+
return function(...params) {
|
|
90
|
+
if (!getActiveSpan()) {
|
|
91
|
+
return oldHandler.call(this, ...params);
|
|
92
|
+
}
|
|
93
|
+
setHttpServerSpanRouteAttribute(route.path);
|
|
94
|
+
const metadata = getRouteMetadata(route, pluginName);
|
|
95
|
+
return startMetadataSpan(metadata, () => oldHandler.call(this, ...params));
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
if (typeof route.handler === "function") {
|
|
99
|
+
route.handler = wrapHandler(route.handler);
|
|
100
|
+
} else if (typeof route.options === "function") {
|
|
101
|
+
const oldOptions = route.options;
|
|
102
|
+
route.options = function(server) {
|
|
103
|
+
const options = oldOptions(server);
|
|
104
|
+
if (typeof options.handler === "function") {
|
|
105
|
+
options.handler = wrapHandler(options.handler);
|
|
106
|
+
}
|
|
107
|
+
return options;
|
|
108
|
+
};
|
|
109
|
+
} else if (typeof route.options?.handler === "function") {
|
|
110
|
+
route.options.handler = wrapHandler(route.options.handler);
|
|
111
|
+
}
|
|
112
|
+
return route;
|
|
113
|
+
}
|
|
114
|
+
function wrapExtMethods(method, extPoint, pluginName) {
|
|
115
|
+
if (Array.isArray(method)) {
|
|
116
|
+
for (let i = 0; i < method.length; i++) {
|
|
117
|
+
method[i] = wrapExtMethods(method[i], extPoint);
|
|
118
|
+
}
|
|
119
|
+
return method;
|
|
120
|
+
} else if (isPatchableExtMethod(method)) {
|
|
121
|
+
if (method[handlerPatched] === true) return method;
|
|
122
|
+
method[handlerPatched] = true;
|
|
123
|
+
const newHandler = function(...params) {
|
|
124
|
+
if (!getActiveSpan()) {
|
|
125
|
+
return method.apply(this, params);
|
|
126
|
+
}
|
|
127
|
+
const metadata = getExtMetadata(extPoint, pluginName, method.name);
|
|
128
|
+
return startMetadataSpan(metadata, () => method.apply(void 0, params));
|
|
129
|
+
};
|
|
130
|
+
newHandler[handlerPatched] = true;
|
|
131
|
+
return newHandler;
|
|
132
|
+
}
|
|
133
|
+
return method;
|
|
134
|
+
}
|
|
135
|
+
function wrapRouteArguments(args, pluginName) {
|
|
136
|
+
const route = args[0];
|
|
137
|
+
if (Array.isArray(route)) {
|
|
138
|
+
for (let i = 0; i < route.length; i++) {
|
|
139
|
+
route[i] = wrapRouteHandler(route[i], pluginName);
|
|
140
|
+
}
|
|
141
|
+
} else {
|
|
142
|
+
args[0] = wrapRouteHandler(route, pluginName);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function wrapExtArguments(args, pluginName) {
|
|
146
|
+
if (Array.isArray(args[0])) {
|
|
147
|
+
const eventsList = args[0];
|
|
148
|
+
for (let i = 0; i < eventsList.length; i++) {
|
|
149
|
+
const eventObj = eventsList[i];
|
|
150
|
+
if (isLifecycleExtType(eventObj.type)) {
|
|
151
|
+
const lifecycleEventObj = eventObj;
|
|
152
|
+
const handler = wrapExtMethods(lifecycleEventObj.method, eventObj.type, pluginName);
|
|
153
|
+
lifecycleEventObj.method = handler;
|
|
154
|
+
eventsList[i] = lifecycleEventObj;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return;
|
|
158
|
+
} else if (isDirectExtInput(args)) {
|
|
159
|
+
const extInput = args;
|
|
160
|
+
const method = extInput[1];
|
|
161
|
+
const handler = wrapExtMethods(method, extInput[0], pluginName);
|
|
162
|
+
args[1] = handler;
|
|
163
|
+
return;
|
|
164
|
+
} else if (isLifecycleExtEventObj(args[0])) {
|
|
165
|
+
const lifecycleEventObj = args[0];
|
|
166
|
+
const handler = wrapExtMethods(lifecycleEventObj.method, lifecycleEventObj.type, pluginName);
|
|
167
|
+
lifecycleEventObj.method = handler;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export { getExtMetadata, getRouteMetadata, wrapExtArguments, wrapRouteArguments };
|
|
172
|
+
//# sourceMappingURL=hapi-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hapi-utils.js","sources":["../../../../src/integrations/tracing-channel/hapi-utils.ts"],"sourcesContent":["/*\n * OTel-free, `@hapi/*`-free port of the span-building helpers and handler/ext\n * wrap logic from the vendored `@opentelemetry/instrumentation-hapi`\n * (upstream @opentelemetry/instrumentation-hapi@0.64.0). Span output (names,\n * ops, origins, attributes) is kept byte-identical to that instrumentation;\n * span creation goes through the `@sentry/core` API and the OTel active-span\n * guard is replaced with `getActiveSpan()`.\n */\n\nimport {\n getActiveSpan,\n getRootSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n spanToJSON,\n startSpan,\n} from '@sentry/core';\nimport type {\n LifecycleMethod,\n PatchableExtMethod,\n PatchableServerRoute,\n ServerExtDirectInput,\n ServerExtEventsObject,\n ServerExtEventsRequestObject,\n ServerRequestExtType,\n ServerRoute,\n ServerRouteOptions,\n} from './hapi-types';\n// eslint-disable-next-line typescript/no-deprecated -- TODO(v11): Replace deprecated attributes\nimport { HTTP_METHOD, HTTP_ROUTE } from '@sentry/conventions/attributes';\nimport { AttributeNames, handlerPatched, HapiLayerType, HapiLifecycleMethodNames } from './hapi-types';\n\ntype SpanAttributes = Record<string, string | undefined>;\n\ninterface SpanMetadata {\n attributes: SpanAttributes;\n name: string;\n}\n\n/**\n * Set the `http.route` attribute on the root HTTP server span for the current trace.\n *\n * No-op when there is no active span, no root span, or the root span is not an\n * `http.server` span — so framework instrumentations can call this unconditionally\n * without risking attribute pollution on non-HTTP root spans.\n */\nfunction setHttpServerSpanRouteAttribute(route: string): void {\n const activeSpan = getActiveSpan();\n if (!activeSpan) {\n return;\n }\n const rootSpan = getRootSpan(activeSpan);\n if (!rootSpan) {\n return;\n }\n if (spanToJSON(rootSpan).data[SEMANTIC_ATTRIBUTE_SENTRY_OP] !== 'http.server') {\n return;\n }\n rootSpan.setAttribute(HTTP_ROUTE, route);\n}\n\nconst isLifecycleExtType = (variableToCheck: unknown): variableToCheck is ServerRequestExtType => {\n return typeof variableToCheck === 'string' && HapiLifecycleMethodNames.has(variableToCheck);\n};\n\nconst isLifecycleExtEventObj = (variableToCheck: unknown): variableToCheck is ServerExtEventsRequestObject => {\n const event = (variableToCheck as ServerExtEventsRequestObject)?.type;\n return event !== undefined && isLifecycleExtType(event);\n};\n\nconst isDirectExtInput = (variableToCheck: unknown): variableToCheck is ServerExtDirectInput => {\n return (\n Array.isArray(variableToCheck) &&\n variableToCheck.length <= 3 &&\n isLifecycleExtType(variableToCheck[0]) &&\n typeof variableToCheck[1] === 'function'\n );\n};\n\nconst isPatchableExtMethod = (\n variableToCheck: PatchableExtMethod | PatchableExtMethod[],\n): variableToCheck is PatchableExtMethod => {\n return !Array.isArray(variableToCheck);\n};\n\n/** Build the span name and attributes for a Hapi route. */\nexport const getRouteMetadata = (route: ServerRoute, pluginName?: string): SpanMetadata => {\n const attributes: SpanAttributes = {\n [HTTP_ROUTE]: route.path,\n // eslint-disable-next-line typescript/no-deprecated -- TODO(v11): Replace deprecated attributes\n [HTTP_METHOD]: route.method,\n };\n\n let name;\n if (pluginName) {\n attributes[AttributeNames.HAPI_TYPE] = HapiLayerType.PLUGIN;\n attributes[AttributeNames.PLUGIN_NAME] = pluginName;\n name = `${pluginName}: route - ${route.path}`;\n } else {\n attributes[AttributeNames.HAPI_TYPE] = HapiLayerType.ROUTER;\n name = `route - ${route.path}`;\n }\n\n return { attributes, name };\n};\n\n/** Build the span name and attributes for a Hapi server extension. */\nexport const getExtMetadata = (\n extPoint: ServerRequestExtType,\n pluginName?: string,\n methodName?: string,\n): SpanMetadata => {\n let baseName = `ext - ${extPoint}`;\n if (methodName && methodName !== 'method') {\n // `method` is the default name for the extension in the ServerExtEventsObject format.\n baseName = `ext - ${extPoint} - ${methodName}`;\n }\n if (pluginName) {\n return {\n attributes: {\n [AttributeNames.EXT_TYPE]: extPoint,\n [AttributeNames.HAPI_TYPE]: HapiLayerType.EXT,\n [AttributeNames.PLUGIN_NAME]: pluginName,\n },\n name: `${pluginName}: ${baseName}`,\n };\n }\n return {\n attributes: {\n [AttributeNames.EXT_TYPE]: extPoint,\n [AttributeNames.HAPI_TYPE]: HapiLayerType.EXT,\n },\n name: baseName,\n };\n};\n\nfunction startMetadataSpan(metadata: SpanMetadata, original: () => unknown): unknown {\n return startSpan(\n {\n name: metadata.name,\n op: `${metadata.attributes[AttributeNames.HAPI_TYPE]}.hapi`,\n attributes: {\n ...metadata.attributes,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.orchestrion.hapi',\n },\n },\n original,\n );\n}\n\n/**\n * Patches each individual route handler method in order to create the span. It\n * does not create spans when there is no parent span.\n */\nfunction wrapRouteHandler(route: PatchableServerRoute, pluginName?: string): PatchableServerRoute {\n if (route[handlerPatched] === true) return route;\n route[handlerPatched] = true;\n\n const wrapHandler: (oldHandler: LifecycleMethod) => LifecycleMethod = oldHandler => {\n return function (this: unknown, ...params: Parameters<LifecycleMethod>) {\n if (!getActiveSpan()) {\n return oldHandler.call(this, ...params);\n }\n setHttpServerSpanRouteAttribute(route.path);\n const metadata = getRouteMetadata(route, pluginName);\n return startMetadataSpan(metadata, () => oldHandler.call(this, ...params));\n };\n };\n\n if (typeof route.handler === 'function') {\n route.handler = wrapHandler(route.handler as LifecycleMethod);\n } else if (typeof route.options === 'function') {\n const oldOptions = route.options;\n route.options = function (server: unknown): ServerRouteOptions {\n const options = oldOptions(server);\n if (typeof options.handler === 'function') {\n options.handler = wrapHandler(options.handler as LifecycleMethod);\n }\n return options;\n };\n } else if (typeof route.options?.handler === 'function') {\n route.options.handler = wrapHandler(route.options.handler as LifecycleMethod);\n }\n return route;\n}\n\n/**\n * Wraps request extension methods to add instrumentation to each new extension\n * handler. It does not create spans when there is no parent span.\n */\nfunction wrapExtMethods<T extends PatchableExtMethod | PatchableExtMethod[]>(\n method: T,\n extPoint: ServerRequestExtType,\n pluginName?: string,\n): T {\n if (Array.isArray(method)) {\n for (let i = 0; i < method.length; i++) {\n method[i] = wrapExtMethods(method[i]!, extPoint);\n }\n return method;\n } else if (isPatchableExtMethod(method)) {\n if (method[handlerPatched] === true) return method;\n method[handlerPatched] = true;\n\n const newHandler: PatchableExtMethod = function (this: unknown, ...params: Parameters<LifecycleMethod>) {\n if (!getActiveSpan()) {\n return method.apply(this, params);\n }\n const metadata = getExtMetadata(extPoint, pluginName, method.name);\n return startMetadataSpan(metadata, () => method.apply(undefined, params));\n };\n // Mark the wrapper too (not just the original)\n newHandler[handlerPatched] = true;\n return newHandler as T;\n }\n return method;\n}\n\n/**\n * Wrap the route handler(s) in the live `server.route` arguments array, mutating\n * `args[0]` in place. `args[0]` is either a single route options object or an\n * array of them. Idempotent via the `handlerPatched` marker.\n */\nexport function wrapRouteArguments(args: unknown[], pluginName?: string): void {\n const route = args[0] as PatchableServerRoute | PatchableServerRoute[];\n if (Array.isArray(route)) {\n for (let i = 0; i < route.length; i++) {\n route[i] = wrapRouteHandler(route[i]!, pluginName);\n }\n } else {\n args[0] = wrapRouteHandler(route, pluginName);\n }\n}\n\n/**\n * Wrap the extension method(s) in the live `server.ext` arguments array,\n * mutating `args` in place. Handles the three accepted input shapes:\n * `(eventsArray)`, `(lifecycleEventObject)`, and `(extTypeString, method, options)`.\n * Idempotent via the `handlerPatched` marker.\n */\nexport function wrapExtArguments(args: unknown[], pluginName?: string): void {\n if (Array.isArray(args[0])) {\n const eventsList = args[0] as ServerExtEventsObject[] | ServerExtEventsRequestObject[];\n for (let i = 0; i < eventsList.length; i++) {\n const eventObj = eventsList[i]!;\n if (isLifecycleExtType(eventObj.type)) {\n const lifecycleEventObj = eventObj as ServerExtEventsRequestObject;\n const handler = wrapExtMethods(lifecycleEventObj.method, eventObj.type, pluginName);\n lifecycleEventObj.method = handler;\n eventsList[i] = lifecycleEventObj;\n }\n }\n return;\n } else if (isDirectExtInput(args)) {\n const extInput: ServerExtDirectInput = args;\n const method: PatchableExtMethod = extInput[1];\n const handler = wrapExtMethods(method, extInput[0], pluginName);\n args[1] = handler;\n return;\n } else if (isLifecycleExtEventObj(args[0])) {\n const lifecycleEventObj = args[0];\n const handler = wrapExtMethods(lifecycleEventObj.method, lifecycleEventObj.type, pluginName);\n lifecycleEventObj.method = handler;\n }\n}\n"],"names":[],"mappings":";;;;AA8CA,SAAS,gCAAgC,KAAA,EAAqB;AAC5D,EAAA,MAAM,aAAa,aAAA,EAAc;AACjC,EAAA,IAAI,CAAC,UAAA,EAAY;AACf,IAAA;AAAA,EACF;AACA,EAAA,MAAM,QAAA,GAAW,YAAY,UAAU,CAAA;AACvC,EAAA,IAAI,CAAC,QAAA,EAAU;AACb,IAAA;AAAA,EACF;AACA,EAAA,IAAI,WAAW,QAAQ,CAAA,CAAE,IAAA,CAAK,4BAA4B,MAAM,aAAA,EAAe;AAC7E,IAAA;AAAA,EACF;AACA,EAAA,QAAA,CAAS,YAAA,CAAa,YAAY,KAAK,CAAA;AACzC;AAEA,MAAM,kBAAA,GAAqB,CAAC,eAAA,KAAsE;AAChG,EAAA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AQ,QAAA,CAAS,CAAC,GAAG,UAAU,CAAA;AAC9D,IAAA,IAAA,CAAK,CAAC,CAAA,GAAI,OAAA;AACV,IAAA;AAAA,EACF,CAAA,MAAA,IAAW,sBAAA,CAAuB,IAAA,CAAK,CAAC,CAAC,CAAA,EAAG;AAC1C,IAAA,MAAM,iBAAA,GAAoB,KAAK,CAAC,CAAA;AAChC,IAAA,MAAM,UAAU,cAAA,CAAe,iBAAA,CAAkB,MAAA,EAAQ,iBAAA,CAAkB,MAAM,UAAU,CAAA;AAC3F,IAAA,iBAAA,CAAkB,MAAA,GAAS,OAAA;AAAA,EAC7B;AACF;;;;"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as diagnosticsChannel from 'node:diagnostics_channel';
|
|
2
|
+
import { defineIntegration, debug } from '@sentry/core';
|
|
3
|
+
import { DEBUG_BUILD } from '../../debug-build.js';
|
|
4
|
+
import { CHANNELS } from '../../orchestrion/channels.js';
|
|
5
|
+
import { wrapRouteArguments, wrapExtArguments } from './hapi-utils.js';
|
|
6
|
+
|
|
7
|
+
const INTEGRATION_NAME = "Hapi";
|
|
8
|
+
const _hapiChannelIntegration = (() => {
|
|
9
|
+
return {
|
|
10
|
+
name: INTEGRATION_NAME,
|
|
11
|
+
setupOnce() {
|
|
12
|
+
if (!diagnosticsChannel.tracingChannel) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
DEBUG_BUILD && debug.log(`[orchestrion:hapi] subscribing to channels "${CHANNELS.HAPI_ROUTE}" / "${CHANNELS.HAPI_EXT}"`);
|
|
16
|
+
diagnosticsChannel.tracingChannel(CHANNELS.HAPI_ROUTE).subscribe({
|
|
17
|
+
start(rawCtx) {
|
|
18
|
+
const ctx = rawCtx;
|
|
19
|
+
wrapRouteArguments(ctx.arguments, ctx.self?.realm?.plugin);
|
|
20
|
+
},
|
|
21
|
+
end() {
|
|
22
|
+
},
|
|
23
|
+
asyncStart() {
|
|
24
|
+
},
|
|
25
|
+
asyncEnd() {
|
|
26
|
+
},
|
|
27
|
+
error() {
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
diagnosticsChannel.tracingChannel(CHANNELS.HAPI_EXT).subscribe({
|
|
31
|
+
start(rawCtx) {
|
|
32
|
+
const ctx = rawCtx;
|
|
33
|
+
wrapExtArguments(ctx.arguments, ctx.self?.realm?.plugin);
|
|
34
|
+
},
|
|
35
|
+
end() {
|
|
36
|
+
},
|
|
37
|
+
asyncStart() {
|
|
38
|
+
},
|
|
39
|
+
asyncEnd() {
|
|
40
|
+
},
|
|
41
|
+
error() {
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
const hapiChannelIntegration = defineIntegration(_hapiChannelIntegration);
|
|
48
|
+
|
|
49
|
+
export { hapiChannelIntegration };
|
|
50
|
+
//# sourceMappingURL=hapi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hapi.js","sources":["../../../../src/integrations/tracing-channel/hapi.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { IntegrationFn } from '@sentry/core';\nimport { debug, defineIntegration } from '@sentry/core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { CHANNELS } from '../../orchestrion/channels';\nimport { wrapExtArguments, wrapRouteArguments } from './hapi-utils';\n\n// NOTE: same name as the OTel integration by design — when enabled, the OTel\n// 'Hapi' integration is omitted from the default set.\nconst INTEGRATION_NAME = 'Hapi' as const;\n\n/**\n * The shape orchestrion's transform attaches to the `@hapi/hapi` route/ext\n * tracing-channel `context` objects.\n *\n * `arguments` is the *live* args array passed to `server.route` / `server.ext`;\n * we mutate it in place to swap handlers for span-creating proxies. `self` is\n * the hapi server instance: the root server has `self.realm.plugin === undefined`,\n * while a plugin's clone server exposes the registering plugin's name there.\n */\ninterface HapiChannelContext {\n arguments: unknown[];\n self?: { realm?: { plugin?: string } };\n}\n\nconst _hapiChannelIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n if (!diagnosticsChannel.tracingChannel) {\n return;\n }\n\n DEBUG_BUILD &&\n debug.log(`[orchestrion:hapi] subscribing to channels \"${CHANNELS.HAPI_ROUTE}\" / \"${CHANNELS.HAPI_EXT}\"`);\n\n // `subscribe` requires all five lifecycle hooks. We only act on `start`,\n // which orchestrion fires synchronously with the live args array — that's\n // the moment we mutate the handlers in place.\n diagnosticsChannel.tracingChannel(CHANNELS.HAPI_ROUTE).subscribe({\n start(rawCtx) {\n const ctx = rawCtx as HapiChannelContext;\n wrapRouteArguments(ctx.arguments, ctx.self?.realm?.plugin);\n },\n end() {},\n asyncStart() {},\n asyncEnd() {},\n error() {},\n });\n\n diagnosticsChannel.tracingChannel(CHANNELS.HAPI_EXT).subscribe({\n start(rawCtx) {\n const ctx = rawCtx as HapiChannelContext;\n wrapExtArguments(ctx.arguments, ctx.self?.realm?.plugin);\n },\n end() {},\n asyncStart() {},\n asyncEnd() {},\n error() {},\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * EXPERIMENTAL — orchestrion-driven hapi integration. Subscribes to the\n * `orchestrion:@hapi/hapi:route` / `:ext` channels injected into `@hapi/hapi`'s\n * `lib/server.js`. Requires the orchestrion runtime hook or bundler plugin.\n */\nexport const hapiChannelIntegration = defineIntegration(_hapiChannelIntegration);\n"],"names":[],"mappings":";;;;;;AASA,MAAM,gBAAA,GAAmB,MAAA;AAgBzB,MAAM,2BAA2B,MAAM;AACrC,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAA,IAAI,CAAC,mBAAmB,cAAA,EAAgB;AACtC,QAAA;AAAA,MACF;AAEA,MAAA,WAAA,IACE,KAAA,CAAM,IAAI,CAAA,4CAAA,EAA+C,QAAA,CAAS,UAAU,CAAA,KAAA,EAAQ,QAAA,CAAS,QAAQ,CAAA,CAAA,CAAG,CAAA;AAK1G,MAAA,kBAAA,CAAmB,cAAA,CAAe,QAAA,CAAS,UAAU,CAAA,CAAE,SAAA,CAAU;AAAA,QAC/D,MAAM,MAAA,EAAQ;AACZ,UAAA,MAAM,GAAA,GAAM,MAAA;AACZ,UAAA,kBAAA,CAAmB,GAAA,CAAI,SAAA,EAAW,GAAA,CAAI,IAAA,EAAM,OAAO,MAAM,CAAA;AAAA,QAC3D,CAAA;AAAA,QACA,GAAA,GAAM;AAAA,QAAC,CAAA;AAAA,QACP,UAAA,GAAa;AAAA,QAAC,CAAA;AAAA,QACd,QAAA,GAAW;AAAA,QAAC,CAAA;AAAA,QACZ,KAAA,GAAQ;AAAA,QAAC;AAAA,OACV,CAAA;AAED,MAAA,kBAAA,CAAmB,cAAA,CAAe,QAAA,CAAS,QAAQ,CAAA,CAAE,SAAA,CAAU;AAAA,QAC7D,MAAM,MAAA,EAAQ;AACZ,UAAA,MAAM,GAAA,GAAM,MAAA;AACZ,UAAA,gBAAA,CAAiB,GAAA,CAAI,SAAA,EAAW,GAAA,CAAI,IAAA,EAAM,OAAO,MAAM,CAAA;AAAA,QACzD,CAAA;AAAA,QACA,GAAA,GAAM;AAAA,QAAC,CAAA;AAAA,QACP,UAAA,GAAa;AAAA,QAAC,CAAA;AAAA,QACd,QAAA,GAAW;AAAA,QAAC,CAAA;AAAA,QACZ,KAAA,GAAQ;AAAA,QAAC;AAAA,OACV,CAAA;AAAA,IACH;AAAA,GACF;AACF,CAAA,CAAA;AAOO,MAAM,sBAAA,GAAyB,kBAAkB,uBAAuB;;;;"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import * as diagnosticsChannel from 'node:diagnostics_channel';
|
|
2
|
+
import { DB_STATEMENT, NET_PEER_PORT, NET_PEER_NAME, DB_SYSTEM } from '@sentry/conventions/attributes';
|
|
3
|
+
import { defineIntegration, debug, waitForTracingChannelBinding, startInactiveSpan, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
|
|
4
|
+
import { DEBUG_BUILD } from '../../debug-build.js';
|
|
5
|
+
import { CHANNELS } from '../../orchestrion/channels.js';
|
|
6
|
+
import { defaultDbStatementSerializer } from '../../redis/redis-statement-serializer.js';
|
|
7
|
+
import { bindTracingChannelToSpan } from '../../tracing-channel.js';
|
|
8
|
+
|
|
9
|
+
const INTEGRATION_NAME = "IORedis";
|
|
10
|
+
const ORIGIN = "auto.db.orchestrion.redis";
|
|
11
|
+
const ATTR_DB_CONNECTION_STRING = "db.connection_string";
|
|
12
|
+
function getConnectionOptions(self) {
|
|
13
|
+
return { host: self?.options?.host, port: self?.options?.port };
|
|
14
|
+
}
|
|
15
|
+
function connectionAttributes(host, port) {
|
|
16
|
+
return {
|
|
17
|
+
[DB_SYSTEM]: "redis",
|
|
18
|
+
[ATTR_DB_CONNECTION_STRING]: `redis://${host}:${port}`,
|
|
19
|
+
[NET_PEER_NAME]: host,
|
|
20
|
+
[NET_PEER_PORT]: port,
|
|
21
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const tracedCommands = /* @__PURE__ */ new WeakSet();
|
|
25
|
+
function startIORedisCommandSpan(data) {
|
|
26
|
+
const command = data.arguments?.[0];
|
|
27
|
+
if (!command || typeof command !== "object") {
|
|
28
|
+
return void 0;
|
|
29
|
+
}
|
|
30
|
+
if (tracedCommands.has(command)) {
|
|
31
|
+
return void 0;
|
|
32
|
+
}
|
|
33
|
+
tracedCommands.add(command);
|
|
34
|
+
const { host, port } = getConnectionOptions(data.self);
|
|
35
|
+
const statement = defaultDbStatementSerializer(command.name, command.args ?? []);
|
|
36
|
+
return startInactiveSpan({
|
|
37
|
+
name: statement,
|
|
38
|
+
op: "db",
|
|
39
|
+
attributes: { ...connectionAttributes(host, port), [DB_STATEMENT]: statement }
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
const _ioredisChannelIntegration = ((options = {}) => {
|
|
43
|
+
const responseHook = options.responseHook;
|
|
44
|
+
return {
|
|
45
|
+
name: INTEGRATION_NAME,
|
|
46
|
+
setupOnce() {
|
|
47
|
+
if (!diagnosticsChannel.tracingChannel) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
DEBUG_BUILD && debug.log(`[orchestrion:ioredis] subscribing to "${CHANNELS.IOREDIS_COMMAND}"/"${CHANNELS.IOREDIS_CONNECT}"`);
|
|
51
|
+
const commandChannel = diagnosticsChannel.tracingChannel(
|
|
52
|
+
CHANNELS.IOREDIS_COMMAND
|
|
53
|
+
);
|
|
54
|
+
const connectChannel = diagnosticsChannel.tracingChannel(
|
|
55
|
+
CHANNELS.IOREDIS_CONNECT
|
|
56
|
+
);
|
|
57
|
+
waitForTracingChannelBinding(() => {
|
|
58
|
+
bindTracingChannelToSpan(commandChannel, startIORedisCommandSpan, {
|
|
59
|
+
// ioredis' `requireParentSpan` default: only create a span under an active span.
|
|
60
|
+
requiresParentSpan: true,
|
|
61
|
+
beforeSpanEnd(span, data) {
|
|
62
|
+
if ("error" in data || !responseHook) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const command = data.arguments?.[0];
|
|
66
|
+
if (command) {
|
|
67
|
+
runResponseHook(responseHook, span, command, data.result);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
bindTracingChannelToSpan(
|
|
72
|
+
connectChannel,
|
|
73
|
+
(data) => {
|
|
74
|
+
const { host, port } = getConnectionOptions(data.self);
|
|
75
|
+
return startInactiveSpan({
|
|
76
|
+
name: "connect",
|
|
77
|
+
op: "db",
|
|
78
|
+
attributes: { ...connectionAttributes(host, port), [DB_STATEMENT]: "connect" }
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
{ requiresParentSpan: true }
|
|
82
|
+
);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
function runResponseHook(hook, span, command, result) {
|
|
88
|
+
try {
|
|
89
|
+
hook(span, command.name, command.args, result);
|
|
90
|
+
} catch {
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const ioredisChannelIntegration = defineIntegration(_ioredisChannelIntegration);
|
|
94
|
+
|
|
95
|
+
export { ioredisChannelIntegration, startIORedisCommandSpan };
|
|
96
|
+
//# sourceMappingURL=ioredis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ioredis.js","sources":["../../../../src/integrations/tracing-channel/ioredis.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-deprecated -- we intentionally emit the OLD db/net semconv\n to match `@opentelemetry/instrumentation-ioredis` (and Sentry's `inferDbSpanData`, which keys off\n `db.statement`). TODO(v11): switch to the non-deprecated `db.system.name`/`db.query.text`/\n `server.address`/`server.port` conventions and drop this disable. */\nimport * as diagnosticsChannel from 'node:diagnostics_channel';\nimport { DB_STATEMENT, DB_SYSTEM, NET_PEER_NAME, NET_PEER_PORT } from '@sentry/conventions/attributes';\nimport type { IntegrationFn, Span } from '@sentry/core';\nimport {\n debug,\n defineIntegration,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n startInactiveSpan,\n waitForTracingChannelBinding,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { CHANNELS } from '../../orchestrion/channels';\nimport { defaultDbStatementSerializer } from '../../redis/redis-statement-serializer';\nimport { bindTracingChannelToSpan } from '../../tracing-channel';\n\n// Distinct from the OTel `Redis` integration, which is composite (node-redis +\n// ioredis + the >=5.11.0 diagnostics_channel subscriber) and stays in the set;\n// only its ioredis monkey-patch is gated off in the node SDK when this is active.\nconst INTEGRATION_NAME = 'IORedis' as const;\n\nconst ORIGIN = 'auto.db.orchestrion.redis';\n\n// todo(v11): Let's drop this as this is already covered with host and port\nconst ATTR_DB_CONNECTION_STRING = 'db.connection_string';\n\n/** Mirrors `@opentelemetry/instrumentation-ioredis`' response hook. Not called for failed commands. */\nexport type IORedisResponseHook = (span: Span, command: string, args: Array<string | Buffer>, result: unknown) => void;\n\nexport interface IORedisChannelIntegrationOptions {\n responseHook?: IORedisResponseHook;\n}\n\n/** Structural type for the command object ioredis passes to `sendCommand`. */\ninterface RedisCommand {\n name: string;\n args: Array<string | Buffer>;\n}\n\ninterface RedisClientLike {\n options?: { host?: string; port?: number };\n}\n\ninterface IORedisCommandContext {\n arguments?: unknown[];\n self?: RedisClientLike;\n result?: unknown;\n error?: unknown;\n}\n\ntype IORedisConnectContext = Omit<IORedisCommandContext, 'arguments'>;\n\nfunction getConnectionOptions(self: RedisClientLike | undefined): { host?: string; port?: number } {\n return { host: self?.options?.host, port: self?.options?.port };\n}\n\nfunction connectionAttributes(host: string | undefined, port: number | undefined): Record<string, unknown> {\n return {\n [DB_SYSTEM]: 'redis',\n [ATTR_DB_CONNECTION_STRING]: `redis://${host}:${port}`,\n [NET_PEER_NAME]: host,\n [NET_PEER_PORT]: port,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n };\n}\n\n// ioredis re-enters `sendCommand` with the same command object when it drains\n// the offline queue on connect which leads to duplicate spans.\n// Track commands we've already traced so each logical command produces one span.\nconst tracedCommands = new WeakSet<object>();\n\n/**\n * Builds the db span for an `orchestrion:ioredis:command` payload, or returns `undefined` to skip\n * it: for a non-command payload, or the offline-queue re-send of an already-traced command.\n *\n * Exported for unit testing.\n */\nexport function startIORedisCommandSpan(data: IORedisCommandContext): Span | undefined {\n const command = data.arguments?.[0] as RedisCommand | undefined;\n if (!command || typeof command !== 'object') {\n return undefined;\n }\n // guard against duplicate spans\n if (tracedCommands.has(command)) {\n return undefined;\n }\n tracedCommands.add(command);\n const { host, port } = getConnectionOptions(data.self);\n const statement = defaultDbStatementSerializer(command.name, command.args ?? []);\n return startInactiveSpan({\n name: statement,\n op: 'db',\n attributes: { ...connectionAttributes(host, port), [DB_STATEMENT]: statement },\n });\n}\n\nconst _ioredisChannelIntegration = ((options: IORedisChannelIntegrationOptions = {}) => {\n const responseHook = options.responseHook;\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n // `tracingChannel` is unavailable before Node 18.19.\n if (!diagnosticsChannel.tracingChannel) {\n return;\n }\n\n DEBUG_BUILD &&\n debug.log(`[orchestrion:ioredis] subscribing to \"${CHANNELS.IOREDIS_COMMAND}\"/\"${CHANNELS.IOREDIS_CONNECT}\"`);\n\n const commandChannel = diagnosticsChannel.tracingChannel<IORedisCommandContext, IORedisCommandContext>(\n CHANNELS.IOREDIS_COMMAND,\n );\n const connectChannel = diagnosticsChannel.tracingChannel<IORedisConnectContext, IORedisConnectContext>(\n CHANNELS.IOREDIS_CONNECT,\n );\n\n // `bindTracingChannelToSpan` uses `bindStore`, which needs the async-context\n // binding that `initOpenTelemetry()` registers after integration `setupOnce` —\n // defer until it's available (matches the native redis diagnostics-channel subscriber).\n waitForTracingChannelBinding(() => {\n bindTracingChannelToSpan(commandChannel, startIORedisCommandSpan, {\n // ioredis' `requireParentSpan` default: only create a span under an active span.\n requiresParentSpan: true,\n beforeSpanEnd(span, data) {\n if ('error' in data || !responseHook) {\n return;\n }\n const command = data.arguments?.[0] as RedisCommand | undefined;\n if (command) {\n runResponseHook(responseHook, span, command, data.result);\n }\n },\n });\n\n bindTracingChannelToSpan(\n connectChannel,\n data => {\n const { host, port } = getConnectionOptions(data.self);\n return startInactiveSpan({\n name: 'connect',\n op: 'db',\n attributes: { ...connectionAttributes(host, port), [DB_STATEMENT]: 'connect' },\n });\n },\n { requiresParentSpan: true },\n );\n });\n },\n };\n}) satisfies IntegrationFn;\n\nfunction runResponseHook(hook: IORedisResponseHook, span: Span, command: RedisCommand, result: unknown): void {\n try {\n hook(span, command.name, command.args, result);\n } catch {\n // never let a user-provided response hook break instrumentation\n }\n}\n\n/**\n * EXPERIMENTAL — orchestrion-driven ioredis integration. Subscribes to\n * `orchestrion:ioredis:command` / `:connect` (injected into ioredis' `<5.11.0`\n * `sendCommand`/`connect`) and creates db spans matching\n * `@opentelemetry/instrumentation-ioredis`. Requires the orchestrion runtime hook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A;AAAA,UACA,CAAA,IAAA,KAAQ;AACN,YAAA,MAAM,EAAE,IAAA,EAAM,IAAA,EAAK,GAAI,oBAAA,CAAqB,KAAK,IAAI,CAAA;AACrD,YAAA,OAAO,iBAAA,CAAkB;AAAA,cACvB,IAAA,EAAM,SAAA;AAAA,cACN,EAAA,EAAI,IAAA;AAAA,cACJ,UAAA,EAAY,EAAE,GAAG,oBAAA,CAAqB,IAAA,EAAM,IAAI,CAAA,EAAG,CAAC,YAAY,GAAG,SAAA;AAAU,aAC9E,CAAA;AAAA,UACH,CAAA;AAAA,UACA,EAAE,oBAAoB,IAAA;AAAK,SAC7B;AAAA,MACF,CAAC,CAAA;AAAA,IACH;AAAA,GACF;AACF,CAAA,CAAA;AAEA,SAAS,eAAA,CAAgB,IAAA,EAA2B,IAAA,EAAY,OAAA,EAAuB,MAAA,EAAuB;AAC5G,EAAA,IAAI;AACF,IAAA,IAAA,CAAK,IAAA,EAAM,OAAA,CAAQ,IAAA,EAAM,OAAA,CAAQ,MAAM,MAAM,CAAA;AAAA,EAC/C,CAAA,CAAA,MAAQ;AAAA,EAER;AACF;AASO,MAAM,yBAAA,GAA4B,kBAAkB,0BAA0B;;;;"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { MESSAGING_BATCH_MESSAGE_COUNT } from '@sentry/conventions/attributes';
|
|
2
|
+
import { continueTrace, withActiveSpan, startNewTrace } from '@sentry/core';
|
|
3
|
+
import { ATTR_MESSAGING_DESTINATION_PARTITION_ID, MESSAGING_OPERATION_TYPE_VALUE_PROCESS, MESSAGING_OPERATION_TYPE_VALUE_RECEIVE } from './semconv.js';
|
|
4
|
+
import { getHeaderAsString, startConsumerSpan, endSpansOnPromise, getLinksFromHeaders } from './spans.js';
|
|
5
|
+
|
|
6
|
+
const consumerCallbackWrapped = /* @__PURE__ */ Symbol("sentry-kafkajs-consumer-callback-wrapped");
|
|
7
|
+
function isWrappedConsumerCallback(fn) {
|
|
8
|
+
return typeof fn === "function" && fn[consumerCallbackWrapped] === true;
|
|
9
|
+
}
|
|
10
|
+
function wrapEachMessage(original) {
|
|
11
|
+
const wrapped = function eachMessage(payload) {
|
|
12
|
+
const sentryTrace = getHeaderAsString(payload.message.headers, "sentry-trace");
|
|
13
|
+
const baggage = getHeaderAsString(payload.message.headers, "baggage");
|
|
14
|
+
return continueTrace({ sentryTrace, baggage }, () => {
|
|
15
|
+
const span = startConsumerSpan({
|
|
16
|
+
topic: payload.topic,
|
|
17
|
+
message: payload.message,
|
|
18
|
+
operationType: MESSAGING_OPERATION_TYPE_VALUE_PROCESS,
|
|
19
|
+
attributes: {
|
|
20
|
+
[ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.partition)
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const promise = withActiveSpan(span, () => original.call(this, payload));
|
|
24
|
+
return endSpansOnPromise([span], promise);
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
wrapped[consumerCallbackWrapped] = true;
|
|
28
|
+
return wrapped;
|
|
29
|
+
}
|
|
30
|
+
function wrapEachBatch(original) {
|
|
31
|
+
const wrapped = function eachBatch(payload) {
|
|
32
|
+
const receivingSpan = startNewTrace(
|
|
33
|
+
() => startConsumerSpan({
|
|
34
|
+
topic: payload.batch.topic,
|
|
35
|
+
message: void 0,
|
|
36
|
+
operationType: MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,
|
|
37
|
+
attributes: {
|
|
38
|
+
[MESSAGING_BATCH_MESSAGE_COUNT]: payload.batch.messages.length,
|
|
39
|
+
[ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition)
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
);
|
|
43
|
+
return withActiveSpan(receivingSpan, () => {
|
|
44
|
+
const spans = [receivingSpan];
|
|
45
|
+
payload.batch.messages.forEach((message) => {
|
|
46
|
+
spans.push(
|
|
47
|
+
startConsumerSpan({
|
|
48
|
+
topic: payload.batch.topic,
|
|
49
|
+
message,
|
|
50
|
+
operationType: MESSAGING_OPERATION_TYPE_VALUE_PROCESS,
|
|
51
|
+
links: getLinksFromHeaders(message.headers),
|
|
52
|
+
attributes: {
|
|
53
|
+
[ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition)
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
);
|
|
57
|
+
});
|
|
58
|
+
const promise = original.call(this, payload);
|
|
59
|
+
return endSpansOnPromise(spans, promise);
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
wrapped[consumerCallbackWrapped] = true;
|
|
63
|
+
return wrapped;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { isWrappedConsumerCallback, wrapEachBatch, wrapEachMessage };
|
|
67
|
+
//# sourceMappingURL=consumer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consumer.js","sources":["../../../../../src/integrations/tracing-channel/kafkajs/consumer.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors, Aspecto\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-kafkajs\n * - Upstream version: @opentelemetry/instrumentation-kafkajs@0.27.0\n * - Span-creating wrappers for the consumer callbacks (`_getConsumerEachMessagePatch`/\n * `_getConsumerEachBatchPatch`), migrated to the `@sentry/core` span API. The `run` channel's `start`\n * subscriber swaps the user's `eachMessage`/`eachBatch` for these before the original runs.\n */\n\nimport { MESSAGING_BATCH_MESSAGE_COUNT } from '@sentry/conventions/attributes';\nimport type { Span } from '@sentry/core';\nimport { continueTrace, startNewTrace, withActiveSpan } from '@sentry/core';\nimport {\n ATTR_MESSAGING_DESTINATION_PARTITION_ID,\n MESSAGING_OPERATION_TYPE_VALUE_PROCESS,\n MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,\n} from './semconv';\nimport { endSpansOnPromise, getHeaderAsString, getLinksFromHeaders, startConsumerSpan } from './spans';\nimport type { EachBatchHandler, EachMessageHandler, KafkaMessage } from './types';\n\n// Marks a callback we've already wrapped. A user can reuse one config object across multiple\n// `consumer.run(config)` calls (e.g. a second consumer); without this guard the second `start` would\n// wrap the wrapper and emit duplicate spans per message.\nconst consumerCallbackWrapped: unique symbol = Symbol('sentry-kafkajs-consumer-callback-wrapped');\n\ntype MaybeWrapped = { [consumerCallbackWrapped]?: true };\n\n/** Whether `fn` is a callback this module already wrapped, so callers skip re-wrapping it. */\nexport function isWrappedConsumerCallback(fn: unknown): boolean {\n return typeof fn === 'function' && (fn as MaybeWrapped)[consumerCallbackWrapped] === true;\n}\n\n/** Wraps `eachMessage` so each processed message becomes a consumer span parented to the message's producer. */\nexport function wrapEachMessage(original: EachMessageHandler): EachMessageHandler {\n const wrapped: EachMessageHandler & MaybeWrapped = function eachMessage(this: unknown, payload) {\n const sentryTrace = getHeaderAsString(payload.message.headers, 'sentry-trace');\n const baggage = getHeaderAsString(payload.message.headers, 'baggage');\n\n // Continue the producer's trace so the consumer span is parented to the message's producer.\n return continueTrace({ sentryTrace, baggage }, () => {\n const span = startConsumerSpan({\n topic: payload.topic,\n message: payload.message,\n operationType: MESSAGING_OPERATION_TYPE_VALUE_PROCESS,\n attributes: {\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.partition),\n },\n });\n\n const promise = withActiveSpan(span, () => original.call(this, payload));\n return endSpansOnPromise([span], promise);\n });\n };\n wrapped[consumerCallbackWrapped] = true;\n return wrapped;\n}\n\n/** Wraps `eachBatch` so the batch pull becomes a fresh-root receiving span with a process span per message. */\nexport function wrapEachBatch(original: EachBatchHandler): EachBatchHandler {\n const wrapped: EachBatchHandler & MaybeWrapped = function eachBatch(this: unknown, payload) {\n // A batch pull aggregates messages from many producers, so the receiving span is a fresh root\n // trace and each processed message links back to its own producer span. Mirrors the OTel messaging\n // semantic conventions for a topic with multiple consumers.\n const receivingSpan = startNewTrace(() =>\n startConsumerSpan({\n topic: payload.batch.topic,\n message: undefined,\n operationType: MESSAGING_OPERATION_TYPE_VALUE_RECEIVE,\n attributes: {\n [MESSAGING_BATCH_MESSAGE_COUNT]: payload.batch.messages.length,\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition),\n },\n }),\n );\n\n return withActiveSpan(receivingSpan, () => {\n const spans: Span[] = [receivingSpan];\n payload.batch.messages.forEach((message: KafkaMessage) => {\n spans.push(\n startConsumerSpan({\n topic: payload.batch.topic,\n message,\n operationType: MESSAGING_OPERATION_TYPE_VALUE_PROCESS,\n links: getLinksFromHeaders(message.headers),\n attributes: {\n [ATTR_MESSAGING_DESTINATION_PARTITION_ID]: String(payload.batch.partition),\n },\n }),\n );\n });\n const promise = original.call(this, payload);\n return endSpansOnPromise(spans, promise);\n });\n };\n wrapped[consumerCallbackWrapped] = true;\n return wrapped;\n}\n"],"names":[],"mappings":";;;;;AA0BA,MAAM,uBAAA,0BAAgD,0CAA0C,CAAA;AAKzF,SAAS,0BAA0B,EAAA,EAAsB;AAC9D,EAAA,OAAO,OAAO,EAAA,KAAO,UAAA,IAAe,EAAA,CAAoB,uBAAuB,CAAA,KAAM,IAAA;AACvF;AAGO,SAAS,gBAAgB,QAAA,EAAkD;AAChF,EAAA,MAAM,OAAA,GAA6C,SAAS,WAAA,CAA2B,OAAA,EAAS;AAC9F,IAAA,MAAM,WAAA,GAAc,iBAAA,CAAkB,OAAA,CAAQ,OAAA,CAAQ,SAAS,cAAc,CAAA;AAC7E,IAAA,MAAM,OAAA,GAAU,iBAAA,CAAkB,OAAA,CAAQ,OAAA,CAAQ,SAAS,SAAS,CAAA;AAGpE,IAAA,OAAO,aAAA,CAAc,EAAE,WAAA,EAAa,OAAA,IAAW,MAAM;AACnD,MAAA,MAAM,OAAO,iBAAA,CAAkB;AAAA,QAC7B,OAAO,OAAA,CAAQ,KAAA;AAAA,QACf,SAAS,OAAA,CAAQ,OAAA;AAAA,QAC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mBAAA,CAAoB,OAAA,CAAQ,OAAO,CAAA;AAAA,YAC1C,UAAA,EAAY;AAAA,cACV,CAAC,uCAAuC,GAAG,MAAA,CAAO,OAAA,CAAQ,MAAM,SAAS;AAAA;AAC3E,WACD;AAAA,SACH;AAAA,MACF,CAAC,CAAA;AACD,MAAA,MAAM,OAAA,GAAU,QAAA,CAAS,IAAA,CAAK,IAAA,EAAM,OAAO,CAAA;AAC3C,MAAA,OAAO,iBAAA,CAAkB,OAAO,OAAO,CAAA;AAAA,IACzC,CAAC,CAAA;AAAA,EACH,CAAA;AACA,EAAA,OAAA,CAAQ,uBAAuB,CAAA,GAAI,IAAA;AACnC,EAAA,OAAO,OAAA;AACT;;;;"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as diagnosticsChannel from 'node:diagnostics_channel';
|
|
2
|
+
import { defineIntegration, debug } from '@sentry/core';
|
|
3
|
+
import { DEBUG_BUILD } from '../../../debug-build.js';
|
|
4
|
+
import { CHANNELS } from '../../../orchestrion/channels.js';
|
|
5
|
+
import { isWrappedConsumerCallback, wrapEachMessage, wrapEachBatch } from './consumer.js';
|
|
6
|
+
import { applyErrorToSpans, startProducerSpan } from './spans.js';
|
|
7
|
+
|
|
8
|
+
const INTEGRATION_NAME = "Kafka";
|
|
9
|
+
function subscribeToProducer() {
|
|
10
|
+
const channel = diagnosticsChannel.tracingChannel(CHANNELS.KAFKAJS_SEND_BATCH);
|
|
11
|
+
const subscribers = {
|
|
12
|
+
start(ctx) {
|
|
13
|
+
const spans = [];
|
|
14
|
+
(ctx.arguments[0]?.topicMessages ?? []).forEach((topicMessage) => {
|
|
15
|
+
topicMessage.messages.forEach((message) => {
|
|
16
|
+
spans.push(startProducerSpan(topicMessage.topic, message));
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
ctx._sentrySpans = spans;
|
|
20
|
+
},
|
|
21
|
+
error(ctx) {
|
|
22
|
+
if (ctx._sentrySpans) {
|
|
23
|
+
applyErrorToSpans(ctx._sentrySpans, ctx.error);
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
asyncEnd(ctx) {
|
|
27
|
+
ctx._sentrySpans?.forEach((span) => span.end());
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
channel.subscribe(subscribers);
|
|
31
|
+
}
|
|
32
|
+
function subscribeToConsumer() {
|
|
33
|
+
const channel = diagnosticsChannel.tracingChannel(CHANNELS.KAFKAJS_CONSUMER_RUN);
|
|
34
|
+
const subscribers = {
|
|
35
|
+
start(ctx) {
|
|
36
|
+
const config = ctx.arguments[0];
|
|
37
|
+
if (!config || typeof config !== "object") {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (typeof config.eachMessage === "function" && !isWrappedConsumerCallback(config.eachMessage)) {
|
|
41
|
+
config.eachMessage = wrapEachMessage(config.eachMessage);
|
|
42
|
+
}
|
|
43
|
+
if (typeof config.eachBatch === "function" && !isWrappedConsumerCallback(config.eachBatch)) {
|
|
44
|
+
config.eachBatch = wrapEachBatch(config.eachBatch);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
channel.subscribe(subscribers);
|
|
49
|
+
}
|
|
50
|
+
const _kafkajsChannelIntegration = (() => {
|
|
51
|
+
return {
|
|
52
|
+
name: INTEGRATION_NAME,
|
|
53
|
+
setupOnce() {
|
|
54
|
+
if (!diagnosticsChannel.tracingChannel) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
DEBUG_BUILD && debug.log(
|
|
58
|
+
`[orchestrion:kafkajs] subscribing to channels "${CHANNELS.KAFKAJS_SEND_BATCH}", "${CHANNELS.KAFKAJS_CONSUMER_RUN}"`
|
|
59
|
+
);
|
|
60
|
+
subscribeToProducer();
|
|
61
|
+
subscribeToConsumer();
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
const kafkajsChannelIntegration = defineIntegration(_kafkajsChannelIntegration);
|
|
66
|
+
|
|
67
|
+
export { kafkajsChannelIntegration };
|
|
68
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing-channel/kafkajs/index.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { TracingChannelSubscribers } from 'node:diagnostics_channel';\nimport type { IntegrationFn, Span } from '@sentry/core';\nimport { debug, defineIntegration } from '@sentry/core';\nimport { DEBUG_BUILD } from '../../../debug-build';\nimport { CHANNELS } from '../../../orchestrion/channels';\nimport { isWrappedConsumerCallback, wrapEachBatch, wrapEachMessage } from './consumer';\nimport { applyErrorToSpans, startProducerSpan } from './spans';\nimport type { ConsumerRunConfig, ProducerBatch } from './types';\n\n// NOTE: this uses the same name as the OTel `Kafka` integration by design. When enabled, the OTel\n// integration is omitted from the default set (see `experimentalUseDiagnosticsChannelInjection`).\nconst INTEGRATION_NAME = 'Kafka' as const;\n\n/** The tracing-channel context the transform attaches around `messageProducer.js`'s `sendBatch`. */\ninterface SendBatchChannelContext {\n // `arguments[0]` is the `{ topicMessages }` batch (kafkajs normalizes `send` into `sendBatch`).\n arguments: [ProducerBatch?, ...unknown[]];\n error?: unknown;\n // The producer spans opened at `start`, ended on `asyncEnd` (and marked errored on `error`).\n _sentrySpans?: Span[];\n}\n\n/** The tracing-channel context the transform attaches around `consumer/index.js`'s `run`. */\ninterface ConsumerRunChannelContext {\n // `arguments[0]` is the `run(config)` config whose `eachMessage`/`eachBatch` we swap in place.\n arguments: [ConsumerRunConfig?, ...unknown[]];\n}\n\nfunction subscribeToProducer(): void {\n const channel = diagnosticsChannel.tracingChannel<SendBatchChannelContext>(CHANNELS.KAFKAJS_SEND_BATCH);\n // Node types `subscribe` as requiring every lifecycle handler; runtime accepts a partial set, so we\n // pass only the ones we use (matching `bindTracingChannelToSpan`'s handling in `tracing-channel.ts`).\n const subscribers: Partial<TracingChannelSubscribers<SendBatchChannelContext>> = {\n start(ctx) {\n const spans: Span[] = [];\n // `startProducerSpan` mutates each message's headers; doing it at `start` means the mutation\n // reaches the real call, propagating the producer's trace to consumers.\n (ctx.arguments[0]?.topicMessages ?? []).forEach(topicMessage => {\n topicMessage.messages.forEach(message => {\n spans.push(startProducerSpan(topicMessage.topic, message));\n });\n });\n ctx._sentrySpans = spans;\n },\n error(ctx) {\n if (ctx._sentrySpans) {\n applyErrorToSpans(ctx._sentrySpans, ctx.error);\n }\n },\n asyncEnd(ctx) {\n // `asyncEnd` fires on both success and failure; `error` (above) has already set the status.\n ctx._sentrySpans?.forEach(span => span.end());\n },\n };\n channel.subscribe(subscribers as TracingChannelSubscribers<SendBatchChannelContext>);\n}\n\nfunction subscribeToConsumer(): void {\n const channel = diagnosticsChannel.tracingChannel<ConsumerRunChannelContext>(CHANNELS.KAFKAJS_CONSUMER_RUN);\n const subscribers: Partial<TracingChannelSubscribers<ConsumerRunChannelContext>> = {\n start(ctx) {\n const config = ctx.arguments[0];\n if (!config || typeof config !== 'object') {\n return;\n }\n // Swap the user callbacks for span-creating wrappers before `run` destructures its config. The\n // `isWrappedConsumerCallback` guard keeps this idempotent: a config object reused across another\n // `run` (or a second consumer) must not have its wrapper wrapped again, which would double spans.\n if (typeof config.eachMessage === 'function' && !isWrappedConsumerCallback(config.eachMessage)) {\n config.eachMessage = wrapEachMessage(config.eachMessage);\n }\n if (typeof config.eachBatch === 'function' && !isWrappedConsumerCallback(config.eachBatch)) {\n config.eachBatch = wrapEachBatch(config.eachBatch);\n }\n },\n };\n channel.subscribe(subscribers as TracingChannelSubscribers<ConsumerRunChannelContext>);\n}\n\nconst _kafkajsChannelIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n if (!diagnosticsChannel.tracingChannel) {\n return;\n }\n\n DEBUG_BUILD &&\n debug.log(\n `[orchestrion:kafkajs] subscribing to channels \"${CHANNELS.KAFKAJS_SEND_BATCH}\", \"${CHANNELS.KAFKAJS_CONSUMER_RUN}\"`,\n );\n\n subscribeToProducer();\n subscribeToConsumer();\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * EXPERIMENTAL — orchestrion-driven kafkajs integration.\n *\n * Subscribes to the `orchestrion:kafkajs:*` diagnostics_channels that the orchestrion code transform\n * injects into `kafkajs`'s `producer/messageProducer.js` (`sendBatch`) and `consumer/index.js` (`run`).\n * Requires the orchestrion runtime hook or bundler plugin to be active — wire that up via\n * `experimentalUseDiagnosticsChannelInjection`.\n *\n * Known limitation vs. the OTel integration it replaces: the wrapping producer-`transaction` span is\n * not emitted (the transformer can't replace `transaction()`'s return value to patch commit/abort).\n * Transactional `send`/`sendBatch` calls still produce producer spans, since they route through the\n * same instrumented `sendBatch`.\n */\nexport const kafkajsChannelIntegration = defineIntegration(_kafkajsChannelIntegration);\n"],"names":[],"mappings":";;;;;;;AAYA,MAAM,gBAAA,GAAmB,OAAA;AAiBzB,SAAS,mBAAA,GAA4B;AACnC,EAAA,MAAM,OAAA,GAAU,kBAAA,CAAmB,cAAA,CAAwC,QAAA,CAAS,kBAAkB,CAAA;AAGtG,EAAA,MAAM,WAAA,GAA2E;AAAA,IAC/E,MAAM,GAAA,EAAK;AACT,MAAA,MAAM,QAAgB,EAAC;AAGvB,MAAA,CAAC,GAAA,CAAI,UAAU,CAAC,CAAA,EAAG,iBAAiB,EAAC,EAAG,QAAQ,CAAA,YAAA,KAAgB;AAC9D,QAAA,YAAA,CAAa,QAAA,CAAS,QAAQ,CAAA,OAAA,KAAW;AACvC,UAAA,KAAA,CAAM,IAAA,CAAK,iBAAA,CAAkB,YAAA,CAAa,KAAA,EAAO,OAAO,CAAC,CAAA;AAAA,QAC3D,CAAC,CAAA;AAAA,MACH,CAAC,CAAA;AACD,MAAA,GAAA,CAAI,YAAA,GAAe,KAAA;AAAA,IACrB,CAAA;AAAA,IACA,MAAM,GAAA,EAAK;AACT,MAAA,IAAI,IAAI,YAAA,EAAc;AACpB,QAAA,iBAAA,CAAkB,GAAA,CAAI,YAAA,EAAc,GAAA,CAAI,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ACJ,CAAA,+CAAA,EAAkD,QAAA,CAAS,kBAAkB,CAAA,IAAA,EAAO,SAAS,oBAAoB,CAAA,CAAA;AAAA,OACnH;AAEF,MAAA,mBAAA,EAAoB;AACpB,MAAA,mBAAA,EAAoB;AAAA,IACtB;AAAA,GACF;AACF,CAAA,CAAA;AAeO,MAAM,yBAAA,GAA4B,kBAAkB,0BAA0B;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const ATTR_MESSAGING_DESTINATION_PARTITION_ID = "messaging.destination.partition.id";
|
|
2
|
+
const ATTR_MESSAGING_KAFKA_MESSAGE_KEY = "messaging.kafka.message.key";
|
|
3
|
+
const ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE = "messaging.kafka.message.tombstone";
|
|
4
|
+
const ATTR_MESSAGING_KAFKA_OFFSET = "messaging.kafka.offset";
|
|
5
|
+
const MESSAGING_OPERATION_TYPE_VALUE_PROCESS = "process";
|
|
6
|
+
const MESSAGING_OPERATION_TYPE_VALUE_RECEIVE = "receive";
|
|
7
|
+
const MESSAGING_OPERATION_TYPE_VALUE_SEND = "send";
|
|
8
|
+
const MESSAGING_SYSTEM_VALUE_KAFKA = "kafka";
|
|
9
|
+
const ERROR_TYPE_VALUE_OTHER = "_OTHER";
|
|
10
|
+
|
|
11
|
+
export { ATTR_MESSAGING_DESTINATION_PARTITION_ID, ATTR_MESSAGING_KAFKA_MESSAGE_KEY, ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE, ATTR_MESSAGING_KAFKA_OFFSET, ERROR_TYPE_VALUE_OTHER, MESSAGING_OPERATION_TYPE_VALUE_PROCESS, MESSAGING_OPERATION_TYPE_VALUE_RECEIVE, MESSAGING_OPERATION_TYPE_VALUE_SEND, MESSAGING_SYSTEM_VALUE_KAFKA };
|
|
12
|
+
//# sourceMappingURL=semconv.js.map
|