@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":"instrumentation.js","sources":["../../../../../src/integrations/tracing-channel/fastify/instrumentation.ts"],"sourcesContent":["/*\n * Copyright (c) 2024-present The Fastify team <https://github.com/fastify/fastify#team>\n * SPDX-License-Identifier: MIT\n *\n * NOTICE from the Sentry authors:\n * - Based on: https://github.com/fastify/otel/tree/bae80d6caef4287e7f01ff3c8dc753243706ea86 (@fastify/otel@0.18.1)\n * - Streamlined to the Sentry SDK's needs: dropped the `InstrumentationBase` wrapper, the unused\n * request/lifecycle hooks, `ignorePaths`/`minimatch` support and the OpenTelemetry tracer/context\n * APIs in favor of the Sentry span API.\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-this-alias */\n/* eslint-disable max-lines */\n\nimport * as diagnosticsChannel from 'node:diagnostics_channel';\nimport { HTTP_REQUEST_METHOD, HTTP_RESPONSE_STATUS_CODE, HTTP_ROUTE, URL_PATH } from '@sentry/conventions/attributes';\nimport type { Span } from '@sentry/core';\nimport {\n isObjectLike,\n debug,\n getActiveSpan,\n getIsolationScope,\n getRootSpan,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_STATUS_ERROR,\n spanToJSON,\n startInactiveSpan,\n startSpan,\n withActiveSpan,\n} from '@sentry/core';\nimport type { FastifyInstance, FastifyRequest } from './types';\nimport { DEBUG_BUILD } from '../../../debug-build';\n\nconst PACKAGE_NAME = '@sentry/instrumentation-fastify';\nconst SUPPORTED_VERSIONS = '>=3.21.0 <6';\n\nconst ORIGIN = 'auto.http.otel.fastify';\nconst HOOK_OP = 'hook.fastify';\nconst REQUEST_HANDLER_OP = 'request_handler.fastify';\n\nconst FASTIFY_HOOKS = [\n 'onRequest',\n 'preParsing',\n 'preValidation',\n 'preHandler',\n 'preSerialization',\n 'onSend',\n 'onResponse',\n 'onError',\n];\nconst ATTRIBUTE_HOOK_NAME = 'hook.name' as const;\nconst ATTRIBUTE_FASTIFY_TYPE = 'fastify.type' as const;\nconst ATTRIBUTE_HOOK_CALLBACK_NAME = 'hook.callback.name' as const;\nconst ATTRIBUTE_FASTIFY_ROOT = 'fastify.root' as const;\n\nconst HOOK_TYPE_ROUTE = 'route-hook' as const;\nconst HOOK_TYPE_INSTANCE = 'hook' as const;\nconst HOOK_TYPE_HANDLER = 'request-handler' as const;\nconst ANONYMOUS_FUNCTION_NAME = 'anonymous';\n\nconst kRequestSpan = Symbol('sentry fastify request span');\nconst kAddHookOriginal = Symbol('sentry fastify addHook original');\nconst kSetNotFoundOriginal = Symbol('sentry fastify setNotFoundHandler original');\n\ntype AnyFn = (...args: any[]) => any;\n\n/**\n * Read the matched route URL off a request. Fastify >=4 exposes it on `request.routeOptions.url`,\n * while v3 only has the (since-removed-in-v5) `request.routerPath`.\n */\nfunction getRequestRouteUrl(request: any): string | undefined {\n return request.routeOptions?.url ?? request.routerPath;\n}\n\n/**\n * Read the per-route config off a request. Fastify >=4 exposes it on `request.routeOptions.config`,\n * while v3 uses `request.routeConfig`. Used to honor the `{ config: { otel: false } }` opt-out.\n */\nfunction getRequestRouteConfig(request: any): { otel?: boolean } | undefined {\n return request.routeOptions?.config ?? request.routeConfig;\n}\n\n/**\n * Detect whether one of a wrapped handler's arguments is the Fastify request. We can't rely on a\n * single property since the route metadata moved from `routerPath` (v3) to `routeOptions` (>=4),\n * so we accept either shape.\n */\nfunction isFastifyRequest(arg: any): boolean {\n return isObjectLike(arg) && !!arg.method && !!arg.url && (!!arg.routeOptions || 'routerPath' in arg);\n}\n\n/**\n * The Fastify plugin that wires up the request/hook/handler spans. It is registered on every Fastify\n * instance via the `fastify.initialization` diagnostics channel.\n */\nfunction fastifyOtelPlugin(this: unknown, instance: any, _opts: unknown, done: () => void): void {\n instance.decorate(kAddHookOriginal, instance.addHook);\n instance.decorate(kSetNotFoundOriginal, instance.setNotFoundHandler);\n instance.decorateRequest('opentelemetry', function opentelemetry(this: any) {\n return { span: this[kRequestSpan] as Span | null };\n });\n instance.decorateRequest(kRequestSpan, null);\n\n instance.addHook('onRoute', otelWireRoute);\n instance.addHook('onRequest', startRequestSpanHook);\n instance.addHook('onResponse', finalizeNotFoundSpanHook);\n\n instance.addHook = addHookPatched;\n instance.setNotFoundHandler = setNotFoundHandlerPatched;\n\n done();\n}\n\nconst pluginSymbols = fastifyOtelPlugin as unknown as Record<symbol, unknown>;\npluginSymbols[Symbol.for('skip-override')] = true;\npluginSymbols[Symbol.for('fastify.display-name')] = PACKAGE_NAME;\npluginSymbols[Symbol.for('plugin-meta')] = {\n fastify: SUPPORTED_VERSIONS,\n name: PACKAGE_NAME,\n};\n\nfunction otelWireRoute(this: any, routeOptions: any): void {\n if (routeOptions.config?.otel === false) {\n return;\n }\n\n for (const hook of FASTIFY_HOOKS) {\n const handlerLike = routeOptions[hook];\n\n if (typeof handlerLike === 'function') {\n routeOptions[hook] = handlerWrapper(\n handlerLike,\n hook,\n routeHookAttributes(this.pluginName, hook, handlerLike, routeOptions.url),\n );\n } else if (Array.isArray(handlerLike)) {\n routeOptions[hook] = handlerLike.map((handler: AnyFn) =>\n handlerWrapper(handler, hook, routeHookAttributes(this.pluginName, hook, handler, routeOptions.url)),\n );\n }\n }\n\n routeOptions.onSend = appendRouteHook(routeOptions.onSend, finalizeResponseSpanHook);\n routeOptions.onError = appendRouteHook(routeOptions.onError, recordErrorInSpanHook);\n\n routeOptions.handler = handlerWrapper(routeOptions.handler, 'handler', {\n [ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - route-handler`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_HANDLER,\n [HTTP_ROUTE]: routeOptions.url,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]:\n routeOptions.handler.name.length > 0 ? routeOptions.handler.name : ANONYMOUS_FUNCTION_NAME,\n });\n}\n\nfunction routeHookAttributes(pluginName: string, hook: string, handler: AnyFn, url: string): Record<string, string> {\n return {\n [ATTRIBUTE_HOOK_NAME]: `${pluginName} - route -> ${hook}`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_ROUTE,\n [HTTP_ROUTE]: url,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]: handler.name?.length > 0 ? handler.name : ANONYMOUS_FUNCTION_NAME,\n };\n}\n\nfunction appendRouteHook(existing: AnyFn | AnyFn[] | undefined, hook: AnyFn): AnyFn | AnyFn[] {\n if (existing == null) {\n return hook;\n }\n return Array.isArray(existing) ? [...existing, hook] : [existing, hook];\n}\n\nfunction startRequestSpanHook(this: any, request: any, _reply: any, hookDone: () => void): void {\n if (getRequestRouteConfig(request)?.otel === false) {\n return hookDone();\n }\n\n const attributes: Record<string, string> = {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [ATTRIBUTE_FASTIFY_ROOT]: PACKAGE_NAME,\n [HTTP_REQUEST_METHOD]: request.method,\n [URL_PATH]: request.url,\n };\n\n const route = getRequestRouteUrl(request);\n if (route != null) {\n attributes[HTTP_ROUTE] = route;\n\n // Update the route of the request on the root span, if it is a http.server span\n const activeSpan = getActiveSpan();\n const rootSpan = activeSpan && getRootSpan(activeSpan);\n if (rootSpan && spanToJSON(rootSpan).data[SEMANTIC_ATTRIBUTE_SENTRY_OP] === 'http.server') {\n rootSpan.setAttribute(HTTP_ROUTE, route);\n }\n }\n\n const requestSpan = startInactiveSpan({ name: 'request', op: REQUEST_HANDLER_OP, attributes });\n request[kRequestSpan] = requestSpan;\n\n // Set the request span as the active span for the remainder of the request lifecycle, so that\n // downstream hooks/handlers as well as errors captured via the error diagnostics channel are\n // parented to it (otherwise they would attach to the root `http.server` span instead).\n withActiveSpan(requestSpan, () => {\n hookDone();\n });\n}\n\nfunction finalizeNotFoundSpanHook(request: any, reply: any, hookDone: () => void): void {\n const span = request[kRequestSpan] as Span | null;\n\n if (span != null) {\n span.setAttributes({ [HTTP_RESPONSE_STATUS_CODE]: reply.statusCode });\n span.end();\n }\n\n request[kRequestSpan] = null;\n\n hookDone();\n}\n\nfunction finalizeResponseSpanHook(\n request: any,\n reply: any,\n payload: any,\n hookDone: (err: null, payload: any) => void,\n): void {\n const span = request[kRequestSpan] as Span | null;\n\n if (span != null) {\n if (reply.statusCode >= 500) {\n span.setStatus({ code: SPAN_STATUS_ERROR });\n }\n span.setAttributes({ [HTTP_RESPONSE_STATUS_CODE]: reply.statusCode });\n span.end();\n }\n\n request[kRequestSpan] = null;\n\n hookDone(null, payload);\n}\n\nfunction recordErrorInSpanHook(request: any, _reply: any, error: any, hookDone: () => void): void {\n const span = request[kRequestSpan] as Span | null;\n\n if (span != null) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: error.message });\n }\n\n hookDone();\n}\n\nfunction addHookPatched(this: any, name: string, hook: AnyFn): unknown {\n const addHookOriginal = this[kAddHookOriginal];\n\n if (FASTIFY_HOOKS.includes(name)) {\n return addHookOriginal.call(\n this,\n name,\n handlerWrapper(hook, name, {\n [ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - ${name}`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_INSTANCE,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]: hook.name?.length > 0 ? hook.name : ANONYMOUS_FUNCTION_NAME,\n }),\n );\n }\n\n return addHookOriginal.call(this, name, hook);\n}\n\nfunction setNotFoundHandlerPatched(this: any, hooks: any, handler?: any): void {\n const setNotFoundHandlerOriginal = this[kSetNotFoundOriginal];\n\n if (typeof hooks === 'function') {\n setNotFoundHandlerOriginal.call(\n this,\n handlerWrapper(hooks, 'notFoundHandler', {\n [ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - not-found-handler`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_INSTANCE,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]: hooks.name?.length > 0 ? hooks.name : ANONYMOUS_FUNCTION_NAME,\n }),\n );\n return;\n }\n\n if (hooks.preValidation != null) {\n hooks.preValidation = handlerWrapper(hooks.preValidation, 'notFoundHandler - preValidation', {\n [ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - not-found-handler - preValidation`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_INSTANCE,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]:\n hooks.preValidation.name?.length > 0 ? hooks.preValidation.name : ANONYMOUS_FUNCTION_NAME,\n });\n }\n\n if (hooks.preHandler != null) {\n hooks.preHandler = handlerWrapper(hooks.preHandler, 'notFoundHandler - preHandler', {\n [ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - not-found-handler - preHandler`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_INSTANCE,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]:\n hooks.preHandler.name?.length > 0 ? hooks.preHandler.name : ANONYMOUS_FUNCTION_NAME,\n });\n }\n\n // Fastify allows `setNotFoundHandler(opts)` without a handler, falling back to its built-in 404\n // handler. Forward the (already-wrapped) hooks unchanged so that fallback still applies.\n if (handler == null) {\n setNotFoundHandlerOriginal.call(this, hooks);\n return;\n }\n\n setNotFoundHandlerOriginal.call(\n this,\n hooks,\n handlerWrapper(handler, 'notFoundHandler', {\n [ATTRIBUTE_HOOK_NAME]: `${this.pluginName} - not-found-handler`,\n [ATTRIBUTE_FASTIFY_TYPE]: HOOK_TYPE_INSTANCE,\n [ATTRIBUTE_HOOK_CALLBACK_NAME]: handler.name?.length > 0 ? handler.name : ANONYMOUS_FUNCTION_NAME,\n }),\n );\n}\n\nfunction getRequestFromArgs(args: any[]): any | null {\n for (const arg of args) {\n if (isFastifyRequest(arg)) {\n return arg;\n }\n }\n return null;\n}\n\nfunction handlerWrapper(handler: AnyFn, hookName: string, spanAttributes: Record<string, string> = {}): AnyFn {\n return function handlerWrapped(this: any, ...args: any[]) {\n const request = getRequestFromArgs(args);\n\n if (request === null || getRequestRouteConfig(request)?.otel === false) {\n return handler.call(this, ...args);\n }\n\n const parentSpan = (request[kRequestSpan] as Span | null) ?? undefined;\n const handlerName = handler.name?.length > 0 ? handler.name : (this.pluginName ?? ANONYMOUS_FUNCTION_NAME);\n\n const hookType = spanAttributes[ATTRIBUTE_FASTIFY_TYPE];\n const op =\n hookType === HOOK_TYPE_INSTANCE ? HOOK_OP : hookType === HOOK_TYPE_HANDLER ? REQUEST_HANDLER_OP : undefined;\n\n const name = op ? stripFastifyPrefix(spanAttributes[ATTRIBUTE_HOOK_NAME]) : `${hookName} - ${handlerName}`;\n\n return startSpan(\n {\n name,\n op,\n attributes: {\n ...spanAttributes,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n },\n parentSpan,\n },\n () => handler.call(this, ...args),\n );\n };\n}\n\n/**\n * Strip the framework/plugin prefixes from a Fastify `hook.name` to derive a readable span name.\n * This is a bit of a hack and does not always work for all spans, but it's the best we can do without a proper API.\n */\nfunction stripFastifyPrefix(hookName = ''): string {\n return hookName\n .replace(/^fastify -> /, '')\n .replace(/^@fastify\\/otel -> /, '')\n .replace(/^@sentry\\/instrumentation-fastify -> /, '');\n}\n\nfunction instrumentOnRequest(fastify: FastifyInstance): void {\n fastify.addHook('onRequest', async (request: FastifyRequest, _reply) => {\n const routeName = getRequestRouteUrl(request);\n const method = request.method || 'GET';\n\n getIsolationScope().setTransactionName(`${method} ${routeName}`);\n });\n}\n\nlet _isInstrumented = false;\n\n/**\n * Set up the Fastify (>= 3.21.0 < 6) instrumentation by subscribing to the `fastify.initialization`\n * diagnostics channel and registering the span-creating plugin on every Fastify instance.\n *\n * Idempotent and exposes an `id` so it can participate in the OpenTelemetry preload list.\n */\nexport const instrumentFastify = Object.assign(\n function instrumentFastify(): void {\n if (_isInstrumented) {\n return;\n }\n _isInstrumented = true;\n\n diagnosticsChannel.subscribe('fastify.initialization', message => {\n const fastifyInstance = (message as { fastify?: FastifyInstance }).fastify;\n\n fastifyInstance?.register(fastifyOtelPlugin).after(err => {\n if (err) {\n DEBUG_BUILD && debug.error('Failed to setup Fastify instrumentation', err);\n } else if (fastifyInstance) {\n instrumentOnRequest(fastifyInstance);\n }\n });\n });\n },\n { id: 'Fastify.v5' },\n);\n"],"names":["instrumentFastify"],"mappings":";;;;;AAoCA,MAAM,YAAA,GAAe,iCAAA;AACrB,MAAM,kBAAA,GAAqB,aAAA;AAE3B,MAAM,MAAA,GAAS,wBAAA;AACf,MAAM,OAAA,GAAU,cAAA;AAChB,MAAM,kBAAA,GAAqB,yBAAA;AAE3B,MAAM,aAAA,GAAgB;AAAA,EACpB,WAAA;AAAA,EACA,YAAA;AAAA,EACA,eAAA;AAAA,EACA,YAAA;AAAA,EACA,kBAAA;AAAA,EACA,QAAA;AAAA,EACA,YAAA;AAAA,EACA;AACF,CAAA;AACA,MAAM,mBAAA,GAAsB,WAAA;AAC5B,MAAM,sBAAA,GAAyB,cAAA;AAC/B,MAAM,4BAAA,GAA+B,oBAAA;AACrC,MAAM,sBAAA,GAAyB,cAAA;AAE/B,MAAM,eAAA,GAAk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,CAAQ,WAAA,EAAa,OAAO,OAAA,EAAyB,MAAA,KAAW;AACtE,IAAA,MAAM,SAAA,GAAY,mBAAmB,OAAO,CAAA;AAC5C,IAAA,MAAM,MAAA,GAAS,QAAQ,MAAA,IAAU,KAAA;AAEjC,IAAA,iBAAA,GAAoB,kBAAA,CAAmB,CAAA,EAAG,MAAM,CAAA,CAAA,EAAI,SAAS,CAAA,CAAE,CAAA;AAAA,EACjE,CAAC,CAAA;AACH;AAEA,IAAI,eAAA,GAAkB,KAAA;AAQf,MAAM,oBAAoB,MAAA,CAAO,MAAA;AAAA,EACtC,SAASA,kBAAAA,GAA0B;AACjC,IAAA,IAAI,eAAA,EAAiB;AACnB,MAAA;AAAA,IACF;AACA,IAAA,eAAA,GAAkB,IAAA;AAElB,IAAA,kBAAA,CAAmB,SAAA,CAAU,0BAA0B,CAAA,OAAA,KAAW;AAChE,MAAA,MAAM,kBAAmB,OAAA,CAA0C,OAAA;AAEnE,MAAA,eAAA,EAAiB,QAAA,CAAS,iBAAiB,CAAA,CAAE,KAAA,CAAM,CAAA,GAAA,KAAO;AACxD,QAAA,IAAI,GAAA,EAAK;AACP,UAAA,WAAA,IAAe,KAAA,CAAM,KAAA,CAAM,yCAAA,EAA2C,GAAG,CAAA;AAAA,QAC3E,WAAW,eAAA,EAAiB;AAC1B,UAAA,mBAAA,CAAoB,eAAe,CAAA;AAAA,QACrC;AAAA,MACF,CAAC,CAAA;AAAA,IACH,CAAC,CAAA;AAAA,EACH,CAAA;AAAA,EACA,EAAE,IAAI,YAAA;AACR;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const INTEGRATION_NAME = "Fastify";
|
|
2
|
+
function defaultShouldHandleError(_error, _request, reply) {
|
|
3
|
+
const statusCode = reply.statusCode;
|
|
4
|
+
return statusCode >= 500 || statusCode <= 299;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export { INTEGRATION_NAME, defaultShouldHandleError };
|
|
8
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../src/integrations/tracing-channel/fastify/utils.ts"],"sourcesContent":["import type { FastifyReply, FastifyRequest } from './types';\n\nexport const INTEGRATION_NAME = 'Fastify';\n\n/**\n * Default function to determine if an error should be sent to Sentry\n *\n * 3xx and 4xx errors are not sent by default.\n */\nexport function defaultShouldHandleError(_error: Error, _request: FastifyRequest, reply: FastifyReply): boolean {\n const statusCode = reply.statusCode;\n // 3xx and 4xx errors are not sent by default.\n return statusCode >= 500 || statusCode <= 299;\n}\n"],"names":[],"mappings":"AAEO,MAAM,gBAAA,GAAmB;AAOzB,SAAS,wBAAA,CAAyB,MAAA,EAAe,QAAA,EAA0B,KAAA,EAA8B;AAC9G,EAAA,MAAM,aAAa,KAAA,CAAM,UAAA;AAEzB,EAAA,OAAO,UAAA,IAAc,OAAO,UAAA,IAAc,GAAA;AAC5C;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as diagnosticsChannel from 'node:diagnostics_channel';
|
|
2
|
+
import { defineIntegration, waitForTracingChannelBinding, startInactiveSpan, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
|
|
3
|
+
import { CHANNELS } from '../../orchestrion/channels.js';
|
|
4
|
+
import { bindTracingChannelToSpan } from '../../tracing-channel.js';
|
|
5
|
+
|
|
6
|
+
const INTEGRATION_NAME = "GenericPool";
|
|
7
|
+
const _genericPoolChannelIntegration = (() => {
|
|
8
|
+
return {
|
|
9
|
+
name: INTEGRATION_NAME,
|
|
10
|
+
setupOnce() {
|
|
11
|
+
if (!diagnosticsChannel.tracingChannel) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
waitForTracingChannelBinding(() => instrumentGenericPool());
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
const genericPoolChannelIntegration = defineIntegration(_genericPoolChannelIntegration);
|
|
19
|
+
function instrumentGenericPool() {
|
|
20
|
+
bindTracingChannelToSpan(
|
|
21
|
+
diagnosticsChannel.tracingChannel(CHANNELS.GENERIC_POOL_ACQUIRE),
|
|
22
|
+
() => startInactiveSpan({
|
|
23
|
+
name: "generic-pool.acquire",
|
|
24
|
+
attributes: {
|
|
25
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "auto.db.orchestrion.generic_pool"
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { genericPoolChannelIntegration };
|
|
32
|
+
//# sourceMappingURL=generic-pool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generic-pool.js","sources":["../../../../src/integrations/tracing-channel/generic-pool.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { IntegrationFn } from '@sentry/core';\nimport {\n defineIntegration,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n startInactiveSpan,\n waitForTracingChannelBinding,\n} from '@sentry/core';\nimport { CHANNELS } from '../../orchestrion/channels';\nimport { bindTracingChannelToSpan } from '../../tracing-channel';\n\n// Same name as the OTel integration by design — when enabled, the OTel\n// 'GenericPool' integration is omitted from the default set.\nconst INTEGRATION_NAME = 'GenericPool' as const;\n\ninterface GenericPoolAcquireContext {\n arguments: unknown[];\n}\n\nconst _genericPoolChannelIntegration = (() => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n // `tracingChannel` is unavailable before Node 18.19 so do nothing in that case.\n if (!diagnosticsChannel.tracingChannel) {\n return;\n }\n\n waitForTracingChannelBinding(() => instrumentGenericPool());\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * EXPERIMENTAL — orchestrion-driven generic-pool integration. Subscribes to\n * `orchestrion:generic-pool:acquire` (injected into `generic-pool/lib/Pool.js`'s\n * `Pool.prototype.acquire`). Creates a `generic-pool.acquire` span for each\n * acquisition. Requires the orchestrion runtime hook or bundler plugin.\n */\nexport const genericPoolChannelIntegration = defineIntegration(_genericPoolChannelIntegration);\n\nfunction instrumentGenericPool(): void {\n bindTracingChannelToSpan(\n diagnosticsChannel.tracingChannel<GenericPoolAcquireContext>(CHANNELS.GENERIC_POOL_ACQUIRE),\n () =>\n startInactiveSpan({\n name: 'generic-pool.acquire',\n attributes: {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.orchestrion.generic_pool',\n },\n }),\n );\n}\n"],"names":[],"mappings":";;;;;AAaA,MAAM,gBAAA,GAAmB,aAAA;AAMzB,MAAM,kCAAkC,MAAM;AAC5C,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AAEV,MAAA,IAAI,CAAC,mBAAmB,cAAA,EAAgB;AACtC,QAAA;AAAA,MACF;AAEA,MAAA,4BAAA,CAA6B,MAAM,uBAAuB,CAAA;AAAA,IAC5D;AAAA,GACF;AACF,CAAA,CAAA;AAQO,MAAM,6BAAA,GAAgC,kBAAkB,8BAA8B;AAE7F,SAAS,qBAAA,GAA8B;AACrC,EAAA,wBAAA;AAAA,IACE,kBAAA,CAAmB,cAAA,CAA0C,QAAA,CAAS,oBAAoB,CAAA;AAAA,IAC1F,MACE,iBAAA,CAAkB;AAAA,MAChB,IAAA,EAAM,sBAAA;AAAA,MACN,UAAA,EAAY;AAAA,QACV,CAAC,gCAAgC,GAAG;AAAA;AACtC,KACD;AAAA,GACL;AACF;;;;"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import * as diagnosticsChannel from 'node:diagnostics_channel';
|
|
2
|
+
import { defineIntegration, waitForTracingChannelBinding, debug, addGoogleGenAIResponseAttributes, resolveAIRecordingOptions, instrumentGoogleGenAIStream, _INTERNAL_shouldSkipAiProviderWrapping, getActiveSpan, spanToJSON, shouldEnableTruncation, extractGoogleGenAIRequestAttributes, GEN_AI_REQUEST_MODEL_ATTRIBUTE, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, startInactiveSpan, addGoogleGenAIRequestAttributes } from '@sentry/core';
|
|
3
|
+
import { DEBUG_BUILD } from '../../debug-build.js';
|
|
4
|
+
import { CHANNELS } from '../../orchestrion/channels.js';
|
|
5
|
+
import { bindTracingChannelToSpan } from '../../tracing-channel.js';
|
|
6
|
+
|
|
7
|
+
const INTEGRATION_NAME = "Google_GenAI";
|
|
8
|
+
const ORIGIN = "auto.ai.orchestrion.google_genai";
|
|
9
|
+
const INSTRUMENTED_CHANNELS = [
|
|
10
|
+
{ channel: CHANNELS.GOOGLE_GENAI_GENERATE_CONTENT, operation: "generate_content" },
|
|
11
|
+
{ channel: CHANNELS.GOOGLE_GENAI_EMBED_CONTENT, operation: "embeddings" },
|
|
12
|
+
{ channel: CHANNELS.GOOGLE_GENAI_CHAT, operation: "chat" }
|
|
13
|
+
];
|
|
14
|
+
let subscribed = false;
|
|
15
|
+
const _googleGenAIChannelIntegration = ((options = {}) => {
|
|
16
|
+
return {
|
|
17
|
+
name: INTEGRATION_NAME,
|
|
18
|
+
setupOnce() {
|
|
19
|
+
if (!diagnosticsChannel.tracingChannel || subscribed) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
subscribed = true;
|
|
23
|
+
waitForTracingChannelBinding(() => {
|
|
24
|
+
for (const { channel, operation } of INSTRUMENTED_CHANNELS) {
|
|
25
|
+
DEBUG_BUILD && debug.log(`[orchestrion:google-genai] subscribing to channel "${channel}"`);
|
|
26
|
+
bindTracingChannelToSpan(
|
|
27
|
+
diagnosticsChannel.tracingChannel(channel),
|
|
28
|
+
(data) => createGenAiSpan(data, operation, options),
|
|
29
|
+
{
|
|
30
|
+
beforeSpanEnd: (span, data) => {
|
|
31
|
+
if (operation !== "embeddings") {
|
|
32
|
+
addGoogleGenAIResponseAttributes(
|
|
33
|
+
span,
|
|
34
|
+
data.result,
|
|
35
|
+
resolveAIRecordingOptions(options).recordOutputs
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
deferSpanEnd: ({ span, data }) => wrapStreamResult(span, data, options)
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
function createGenAiSpan(data, operation, options) {
|
|
48
|
+
if (_INTERNAL_shouldSkipAiProviderWrapping(INTEGRATION_NAME)) {
|
|
49
|
+
return void 0;
|
|
50
|
+
}
|
|
51
|
+
if (operation !== "chat") {
|
|
52
|
+
const activeSpan = getActiveSpan();
|
|
53
|
+
if (activeSpan) {
|
|
54
|
+
const { op, origin } = spanToJSON(activeSpan);
|
|
55
|
+
if (origin === ORIGIN && op === "gen_ai.chat") {
|
|
56
|
+
return void 0;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const args = data.arguments ?? [];
|
|
61
|
+
const params = args[0];
|
|
62
|
+
const { recordInputs } = resolveAIRecordingOptions(options);
|
|
63
|
+
const enableTruncation = shouldEnableTruncation(options.enableTruncation);
|
|
64
|
+
const attributes = extractGoogleGenAIRequestAttributes(operation, params, data.self);
|
|
65
|
+
const model = attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE] || "unknown";
|
|
66
|
+
attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = ORIGIN;
|
|
67
|
+
const span = startInactiveSpan({
|
|
68
|
+
name: `${operation} ${model}`,
|
|
69
|
+
op: `gen_ai.${operation}`,
|
|
70
|
+
attributes
|
|
71
|
+
});
|
|
72
|
+
if (recordInputs && params) {
|
|
73
|
+
addGoogleGenAIRequestAttributes(span, params, operation, enableTruncation);
|
|
74
|
+
}
|
|
75
|
+
return span;
|
|
76
|
+
}
|
|
77
|
+
function isAsyncIterable(value) {
|
|
78
|
+
return !!value && typeof value[Symbol.asyncIterator] === "function";
|
|
79
|
+
}
|
|
80
|
+
function wrapStreamResult(span, data, options) {
|
|
81
|
+
const result = data.result;
|
|
82
|
+
if (!isAsyncIterable(result)) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
const { recordOutputs } = resolveAIRecordingOptions(options);
|
|
86
|
+
const iterate = result[Symbol.asyncIterator].bind(result);
|
|
87
|
+
const instrumented = instrumentGoogleGenAIStream({ [Symbol.asyncIterator]: iterate }, span, recordOutputs ?? false);
|
|
88
|
+
result[Symbol.asyncIterator] = () => instrumented;
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
const googleGenAIChannelIntegration = defineIntegration(_googleGenAIChannelIntegration);
|
|
92
|
+
|
|
93
|
+
export { googleGenAIChannelIntegration };
|
|
94
|
+
//# sourceMappingURL=google-genai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google-genai.js","sources":["../../../../src/integrations/tracing-channel/google-genai.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { GoogleGenAIOptions, GoogleGenAIResponse, IntegrationFn, Span } from '@sentry/core';\nimport {\n _INTERNAL_shouldSkipAiProviderWrapping,\n addGoogleGenAIRequestAttributes,\n addGoogleGenAIResponseAttributes,\n debug,\n defineIntegration,\n extractGoogleGenAIRequestAttributes,\n GEN_AI_REQUEST_MODEL_ATTRIBUTE,\n getActiveSpan,\n instrumentGoogleGenAIStream,\n resolveAIRecordingOptions,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n shouldEnableTruncation,\n spanToJSON,\n startInactiveSpan,\n waitForTracingChannelBinding,\n} from '@sentry/core';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { CHANNELS } from '../../orchestrion/channels';\nimport { bindTracingChannelToSpan } from '../../tracing-channel';\n\n// Same name as the OTel integration by design: when enabled, the OTel 'Google_GenAI'\n// integration is dropped from the default set (see the Node opt-in loader).\nconst INTEGRATION_NAME = 'Google_GenAI' as const;\n\n// Distinct from the proxy's `auto.ai.google_genai` so spans from the orchestrion path\n// are attributable separately from the OTel/proxy one.\nconst ORIGIN = 'auto.ai.orchestrion.google_genai';\n\n// Each instrumented method maps to the gen_ai operation its span reports.\nconst INSTRUMENTED_CHANNELS = [\n { channel: CHANNELS.GOOGLE_GENAI_GENERATE_CONTENT, operation: 'generate_content' },\n { channel: CHANNELS.GOOGLE_GENAI_EMBED_CONTENT, operation: 'embeddings' },\n { channel: CHANNELS.GOOGLE_GENAI_CHAT, operation: 'chat' },\n] as const;\n\ninterface GoogleGenAIChannelContext {\n arguments: unknown[];\n // The transform stashes the call's `this` here, which chat methods need since the model lives on\n // the `Chat` instance (`this.model`/`this.modelVersion`), not in the call arguments.\n self?: unknown;\n result?: unknown;\n}\n\nlet subscribed = false;\n\nconst _googleGenAIChannelIntegration = ((options: GoogleGenAIOptions = {}) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n // `tracingChannel` is unavailable before Node 18.19, and a second `init()` would double-subscribe.\n if (!diagnosticsChannel.tracingChannel || subscribed) {\n return;\n }\n subscribed = true;\n\n // `bindTracingChannelToSpan` needs the async-context binding that `initOpenTelemetry()` registers\n // after `setupOnce` runs, so wait for it before subscribing.\n waitForTracingChannelBinding(() => {\n for (const { channel, operation } of INSTRUMENTED_CHANNELS) {\n DEBUG_BUILD && debug.log(`[orchestrion:google-genai] subscribing to channel \"${channel}\"`);\n bindTracingChannelToSpan(\n diagnosticsChannel.tracingChannel<GoogleGenAIChannelContext>(channel),\n data => createGenAiSpan(data, operation, options),\n {\n beforeSpanEnd: (span, data) => {\n // Embeddings responses carry no content attributes.\n if (operation !== 'embeddings') {\n addGoogleGenAIResponseAttributes(\n span,\n data.result as GoogleGenAIResponse,\n resolveAIRecordingOptions(options).recordOutputs,\n );\n }\n },\n deferSpanEnd: ({ span, data }) => wrapStreamResult(span, data, options),\n },\n );\n }\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Build the span for an instrumented call.\n * Returning `undefined` opts the payload out so no span is opened.\n */\nfunction createGenAiSpan(\n data: GoogleGenAIChannelContext,\n operation: string,\n options: GoogleGenAIOptions,\n): Span | undefined {\n // When another provider (e.g. LangChain) is driving the SDK, it records the spans itself and marks this\n // provider as skipped; skip here to avoid double spans.\n if (_INTERNAL_shouldSkipAiProviderWrapping(INTEGRATION_NAME)) {\n return undefined;\n }\n\n // `chat.sendMessage()`/`sendMessageStream()` internally call `Models.generateContent(Stream)`, which\n // publishes the `generate-content` channel while the chat span is active. Skip that nested event so a\n // chat call yields a single `gen_ai.chat` span instead of a chat span wrapping a generate_content one.\n if (operation !== 'chat') {\n const activeSpan = getActiveSpan();\n if (activeSpan) {\n const { op, origin } = spanToJSON(activeSpan);\n if (origin === ORIGIN && op === 'gen_ai.chat') {\n return undefined;\n }\n }\n }\n\n const args = data.arguments ?? [];\n const params = args[0] as Record<string, unknown> | undefined;\n\n const { recordInputs } = resolveAIRecordingOptions(options);\n const enableTruncation = shouldEnableTruncation(options.enableTruncation);\n\n const attributes = extractGoogleGenAIRequestAttributes(operation, params, data.self);\n const model = (attributes[GEN_AI_REQUEST_MODEL_ATTRIBUTE] as string) || 'unknown';\n attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN] = ORIGIN;\n\n const span = startInactiveSpan({\n name: `${operation} ${model}`,\n op: `gen_ai.${operation}`,\n attributes,\n });\n\n if (recordInputs && params) {\n addGoogleGenAIRequestAttributes(span, params, operation, enableTruncation);\n }\n\n return span;\n}\n\ntype AsyncIterableStream = { [Symbol.asyncIterator]: () => AsyncIterator<unknown> };\n\nfunction isAsyncIterable(value: unknown): value is AsyncIterableStream {\n return !!value && typeof (value as AsyncIterableStream)[Symbol.asyncIterator] === 'function';\n}\n\n/**\n * Only the streaming methods (`generateContentStream`/`sendMessageStream`) resolve to an async iterable.\n * For a stream we patch `result[Symbol.asyncIterator]` in place so `instrumentGoogleGenAIStream` ends the\n * span when iteration finishes.\n */\nfunction wrapStreamResult(span: Span, data: GoogleGenAIChannelContext, options: GoogleGenAIOptions): boolean {\n const result = data.result;\n if (!isAsyncIterable(result)) {\n return false;\n }\n\n const { recordOutputs } = resolveAIRecordingOptions(options);\n const iterate = result[Symbol.asyncIterator].bind(result);\n const instrumented = instrumentGoogleGenAIStream({ [Symbol.asyncIterator]: iterate }, span, recordOutputs ?? false);\n result[Symbol.asyncIterator] = () => instrumented;\n\n return true;\n}\n\n/**\n * EXPERIMENTAL — orchestrion-driven Google GenAI integration. Subscribes to the\n * `orchestrion:@google/genai:*` diagnostics_channels injected into the SDK's `Models`\n * (`generateContent`/`generateContentStream`/`embedContent`) and `Chat`\n * (`sendMessage`/`sendMessageStream`) methods, so it requires the orchestrion runtime hook or\n * bundler plugin.\n */\nexport const googleGenAIChannelIntegration = defineIntegration(_googleGenAIChannelIntegration);\n"],"names":[],"mappings":";;;;;;AAyBA,MAAM,gBAAA,GAAmB,cAAA;AAIzB,MAAM,MAAA,GAAS,kCAAA;AAGf,MAAM,qBAAA,GAAwB;AAAA,EAC5B,EAAE,OAAA,EAAS,QAAA,CAAS,6BAAA,EAA+B,WAAW,kBAAA,EAAmB;AAAA,EACjF,EAAE,OAAA,EAAS,QAAA,CAAS,0BAAA,EAA4B,WAAW,YAAA,EAAa;AAAA,EACxE,EAAE,OAAA,EAAS,QAAA,CAAS,iBAAA,EAAmB,WAAW,MAAA;AACpD,CAAA;AAUA,IAAI,UAAA,GAAa,KAAA;AAEjB,MAAM,8BAAA,IAAkC,CAAC,OAAA,GAA8B,EAAC,KAAM;AAC5E,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AAEV,MAAA,IAAI,CAAC,kBAAA,CAAmB,cAAA,IAAkB,UAAA,EAAY;AACpD,QAAA;AAAA,MACF;AACA,MAAA,UAAA,GAAa,IAAA;AAIb,MAAA,4BAAA,CAA6B,MAAM;AACjC,QAAA,KAAA,MAAW,EAAE,OAAA,EAAS,SAAA,EAAU,IAAK,qBAAA,EAAuB;AAC1D,UAAA,WAAA,IAAe,KAAA,CAAM,GAAA,CAAI,CAAA,mDAAA,EAAsD,OAAO,CAAA,CAAA,C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IAAA,EAAM,aAAA,IAAiB,KAAK,CAAA;AAClH,EAAA,MAAA,CAAO,MAAA,CAAO,aAAa,CAAA,GAAI,MAAM,YAAA;AAErC,EAAA,OAAO,IAAA;AACT;AASO,MAAM,6BAAA,GAAgC,kBAAkB,8BAA8B;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const ORIGIN = "auto.graphql.diagnostic_channel";
|
|
2
|
+
const SPAN_NAME_PARSE = "graphql.parse";
|
|
3
|
+
const SPAN_NAME_VALIDATE = "graphql.validate";
|
|
4
|
+
const SPAN_NAME_EXECUTE = "graphql.execute";
|
|
5
|
+
const SPAN_NAME_RESOLVE = "graphql.resolve";
|
|
6
|
+
const GRAPHQL_FIELD_NAME = "graphql.field.name";
|
|
7
|
+
const GRAPHQL_FIELD_PATH = "graphql.field.path";
|
|
8
|
+
const GRAPHQL_FIELD_TYPE = "graphql.field.type";
|
|
9
|
+
const GRAPHQL_PARENT_NAME = "graphql.parent.name";
|
|
10
|
+
const GRAPHQL_DATA_SYMBOL = /* @__PURE__ */ Symbol.for("opentelemetry.graphql_data");
|
|
11
|
+
const GRAPHQL_PATCHED_SYMBOL = /* @__PURE__ */ Symbol.for("opentelemetry.patched");
|
|
12
|
+
|
|
13
|
+
export { GRAPHQL_DATA_SYMBOL, GRAPHQL_FIELD_NAME, GRAPHQL_FIELD_PATH, GRAPHQL_FIELD_TYPE, GRAPHQL_PARENT_NAME, GRAPHQL_PATCHED_SYMBOL, ORIGIN, SPAN_NAME_EXECUTE, SPAN_NAME_PARSE, SPAN_NAME_RESOLVE, SPAN_NAME_VALIDATE };
|
|
14
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../../src/integrations/tracing-channel/graphql/constants.ts"],"sourcesContent":["/*\n * These mirror the constants in `@sentry/server-utils`'s native graphql subscriber\n * (`src/graphql/graphql-dc-subscriber.ts`) so the orchestrion path (graphql v14–16) and the native\n * `diagnostics_channel` path (graphql >= 17) emit identical spans — same origin, span names and\n * field-attribute keys. `graphql.document`/`graphql.operation.*` and the span `op` come from\n * `@sentry/conventions` directly and are imported where used.\n */\n\nexport const ORIGIN = 'auto.graphql.diagnostic_channel';\n\nexport const SPAN_NAME_PARSE = 'graphql.parse';\nexport const SPAN_NAME_VALIDATE = 'graphql.validate';\nexport const SPAN_NAME_EXECUTE = 'graphql.execute';\nexport const SPAN_NAME_RESOLVE = 'graphql.resolve';\n\n// Field-level resolver-span attributes; not in `@sentry/conventions`.\nexport const GRAPHQL_FIELD_NAME = 'graphql.field.name';\nexport const GRAPHQL_FIELD_PATH = 'graphql.field.path';\nexport const GRAPHQL_FIELD_TYPE = 'graphql.field.type';\nexport const GRAPHQL_PARENT_NAME = 'graphql.parent.name';\n\n// `Symbol.for` keys shared with any co-resident OTel graphql instrumentation on purpose: the paths are\n// mutually exclusive at runtime, and reusing the key keeps nested-execute detection and resolver\n// parenting consistent if both ever load.\nexport const GRAPHQL_DATA_SYMBOL = Symbol.for('opentelemetry.graphql_data');\nexport const GRAPHQL_PATCHED_SYMBOL = Symbol.for('opentelemetry.patched');\n"],"names":[],"mappings":"AAQO,MAAM,MAAA,GAAS;AAEf,MAAM,eAAA,GAAkB;AACxB,MAAM,kBAAA,GAAqB;AAC3B,MAAM,iBAAA,GAAoB;AAC1B,MAAM,iBAAA,GAAoB;AAG1B,MAAM,kBAAA,GAAqB;AAC3B,MAAM,kBAAA,GAAqB;AAC3B,MAAM,kBAAA,GAAqB;AAC3B,MAAM,mBAAA,GAAsB;AAK5B,MAAM,mBAAA,mBAAsB,MAAA,CAAO,GAAA,CAAI,4BAA4B;AACnE,MAAM,sBAAA,mBAAyB,MAAA,CAAO,GAAA,CAAI,uBAAuB;;;;"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as diagnosticsChannel from 'node:diagnostics_channel';
|
|
2
|
+
import { defineIntegration, waitForTracingChannelBinding, debug, extendIntegration } from '@sentry/core';
|
|
3
|
+
import { DEBUG_BUILD } from '../../../debug-build.js';
|
|
4
|
+
import { graphqlIntegration } from '../../../graphql/index.js';
|
|
5
|
+
import { CHANNELS } from '../../../orchestrion/channels.js';
|
|
6
|
+
import { bindTracingChannelToSpan } from '../../../tracing-channel.js';
|
|
7
|
+
import { startParseSpan, finalizeValidateSpan, startValidateSpan, finalizeExecuteSpan, startExecuteSpan } from './spans.js';
|
|
8
|
+
|
|
9
|
+
const INTEGRATION_NAME = "Graphql";
|
|
10
|
+
function getOptionsWithDefaults(options) {
|
|
11
|
+
return {
|
|
12
|
+
ignoreResolveSpans: options.ignoreResolveSpans !== false,
|
|
13
|
+
ignoreTrivialResolveSpans: options.ignoreTrivialResolveSpans !== false,
|
|
14
|
+
useOperationNameForRootSpan: options.useOperationNameForRootSpan !== false
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function safe(fn) {
|
|
18
|
+
try {
|
|
19
|
+
return fn();
|
|
20
|
+
} catch (error) {
|
|
21
|
+
DEBUG_BUILD && debug.warn("[orchestrion:graphql] error building span", error);
|
|
22
|
+
return void 0;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const _graphqlChannelIntegration = ((options = {}) => {
|
|
26
|
+
const config = getOptionsWithDefaults(options);
|
|
27
|
+
const getConfig = () => config;
|
|
28
|
+
return {
|
|
29
|
+
name: INTEGRATION_NAME,
|
|
30
|
+
setupOnce() {
|
|
31
|
+
if (!diagnosticsChannel.tracingChannel) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
waitForTracingChannelBinding(() => {
|
|
35
|
+
bindTracingChannelToSpan(
|
|
36
|
+
diagnosticsChannel.tracingChannel(CHANNELS.GRAPHQL_PARSE),
|
|
37
|
+
() => safe(() => startParseSpan())
|
|
38
|
+
);
|
|
39
|
+
bindTracingChannelToSpan(
|
|
40
|
+
diagnosticsChannel.tracingChannel(CHANNELS.GRAPHQL_VALIDATE),
|
|
41
|
+
(data) => safe(() => startValidateSpan(data.arguments[1])),
|
|
42
|
+
{ beforeSpanEnd: (span, data) => void safe(() => finalizeValidateSpan(span, data.result)) }
|
|
43
|
+
);
|
|
44
|
+
bindTracingChannelToSpan(
|
|
45
|
+
diagnosticsChannel.tracingChannel(CHANNELS.GRAPHQL_EXECUTE),
|
|
46
|
+
(data) => safe(() => startExecuteSpan(data.arguments, data.self, config, getConfig)),
|
|
47
|
+
{ beforeSpanEnd: (span, data) => void safe(() => finalizeExecuteSpan(span, data.result)) }
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
const graphqlChannelIntegration = defineIntegration(_graphqlChannelIntegration);
|
|
54
|
+
const graphqlDiagnosticsChannelIntegration = (options) => {
|
|
55
|
+
const orchestrion = graphqlChannelIntegration(options);
|
|
56
|
+
return extendIntegration(graphqlIntegration(options), {
|
|
57
|
+
name: INTEGRATION_NAME,
|
|
58
|
+
setupOnce: () => orchestrion.setupOnce?.()
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export { graphqlChannelIntegration, graphqlDiagnosticsChannelIntegration };
|
|
63
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/integrations/tracing-channel/graphql/index.ts"],"sourcesContent":["import * as diagnosticsChannel from 'node:diagnostics_channel';\nimport type { IntegrationFn } from '@sentry/core';\nimport { debug, defineIntegration, extendIntegration, waitForTracingChannelBinding } from '@sentry/core';\nimport { DEBUG_BUILD } from '../../../debug-build';\nimport { graphqlIntegration as graphqlNativeIntegration } from '../../../graphql';\nimport type { GraphqlDiagnosticChannelsOptions } from '../../../graphql/graphql-dc-subscriber';\nimport { CHANNELS } from '../../../orchestrion/channels';\nimport { bindTracingChannelToSpan } from '../../../tracing-channel';\nimport {\n finalizeExecuteSpan,\n finalizeValidateSpan,\n startExecuteSpan,\n startParseSpan,\n startValidateSpan,\n} from './spans';\nimport type { GraphqlResolvedConfig } from './types';\n\n// Same name as the OTel/native integration by design, so enabling injection swaps this in for it.\nconst INTEGRATION_NAME = 'Graphql' as const;\n\n// The context orchestrion's transform attaches to each channel: `arguments` is the live args of the\n// wrapped call, `result` the settled return value.\ninterface GraphqlChannelContext {\n arguments: unknown[];\n self?: unknown;\n result?: unknown;\n error?: unknown;\n}\n\nfunction getOptionsWithDefaults(options: GraphqlDiagnosticChannelsOptions): GraphqlResolvedConfig {\n return {\n ignoreResolveSpans: options.ignoreResolveSpans !== false,\n ignoreTrivialResolveSpans: options.ignoreTrivialResolveSpans !== false,\n useOperationNameForRootSpan: options.useOperationNameForRootSpan !== false,\n };\n}\n\n/**\n * Runs a span-building callback so a throw inside it can never break the user's graphql call: these\n * run inside the `tracingChannel(...).trace*` machinery wrapping the real function (as the `getSpan`\n * producer / `beforeSpanEnd` handler), where an unguarded throw would propagate into the traced call.\n */\nfunction safe<T>(fn: () => T): T | undefined {\n try {\n return fn();\n } catch (error) {\n DEBUG_BUILD && debug.warn('[orchestrion:graphql] error building span', error);\n return undefined;\n }\n}\n\nconst _graphqlChannelIntegration = ((options: GraphqlDiagnosticChannelsOptions = {}) => {\n const config = getOptionsWithDefaults(options);\n const getConfig = (): GraphqlResolvedConfig => config;\n\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n if (!diagnosticsChannel.tracingChannel) {\n return;\n }\n\n waitForTracingChannelBinding(() => {\n bindTracingChannelToSpan(diagnosticsChannel.tracingChannel<GraphqlChannelContext>(CHANNELS.GRAPHQL_PARSE), () =>\n safe(() => startParseSpan()),\n );\n\n bindTracingChannelToSpan(\n diagnosticsChannel.tracingChannel<GraphqlChannelContext>(CHANNELS.GRAPHQL_VALIDATE),\n data => safe(() => startValidateSpan(data.arguments[1])),\n { beforeSpanEnd: (span, data) => void safe(() => finalizeValidateSpan(span, data.result)) },\n );\n\n bindTracingChannelToSpan(\n diagnosticsChannel.tracingChannel<GraphqlChannelContext>(CHANNELS.GRAPHQL_EXECUTE),\n data => safe(() => startExecuteSpan(data.arguments, data.self, config, getConfig)),\n { beforeSpanEnd: (span, data) => void safe(() => finalizeExecuteSpan(span, data.result)) },\n );\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * EXPERIMENTAL — orchestrion-driven graphql integration for graphql v14–16 (v17 publishes native\n * `diagnostics_channel` events handled by `@sentry/server-utils`'s graphql integration instead).\n *\n * Subscribes to the `orchestrion:graphql:{parse,validate,execute}` channels the orchestrion code\n * transform injects into `graphql`'s `language/parser.js`, `validation/validate.js` and\n * `execution/execute.js`, emitting spans identical to the native path. Requires the orchestrion\n * runtime hook or bundler plugin — wire it up via `experimentalUseDiagnosticsChannelInjection()`.\n *\n * @experimental\n */\nexport const graphqlChannelIntegration = defineIntegration(_graphqlChannelIntegration);\n\n/**\n * The complete graphql diagnostics-channel integration: the native subscriber (graphql v17) composed\n * with the orchestrion subscriber (v14–16), so opting into injection instruments every supported\n * version via diagnostics channels without the OTel patcher. Reuses the OTel `Graphql` name so\n * enabling injection swaps this in for it.\n */\nexport const graphqlDiagnosticsChannelIntegration = (options?: GraphqlDiagnosticChannelsOptions) => {\n const orchestrion = graphqlChannelIntegration(options);\n return extendIntegration(graphqlNativeIntegration(options), {\n name: INTEGRATION_NAME,\n setupOnce: () => orchestrion.setupOnce?.(),\n });\n};\n"],"names":["graphqlNativeIntegration"],"mappings":";;;;;;;;AAkBA,MAAM,gBAAA,GAAmB,SAAA;AAWzB,SAAS,uBAAuB,OAAA,EAAkE;AAChG,EAAA,OAAO;AAAA,IACL,kBAAA,EAAoB,QAAQ,kBAAA,KAAuB,KAAA;AAAA,IACnD,yBAAA,EAA2B,QAAQ,yBAAA,KAA8B,KAAA;AAAA,IACjE,2BAAA,EAA6B,QAAQ,2BAAA,KAAgC;AAAA,GACvE;AACF;AAOA,SAAS,KAAQ,EAAA,EAA4B;AAC3C,EAAA,IAAI;AACF,IAAA,OAAO,EAAA,EAAG;AAAA,EACZ,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,MAAM,mBAAA,CAAoB,IAAA,EAAM,IAAA,CAAK,MAAM,CAAC,CAAA;AAAE,SAC3F;AAAA,MACF,CAAC,CAAA;AAAA,IACH;AAAA,GACF;AACF,CAAA,CAAA;AAaO,MAAM,yBAAA,GAA4B,kBAAkB,0BAA0B;AAQ9E,MAAM,oCAAA,GAAuC,CAAC,OAAA,KAA+C;AAClG,EAAA,MAAM,WAAA,GAAc,0BAA0B,OAAO,CAAA;AACrD,EAAA,OAAO,iBAAA,CAAkBA,kBAAA,CAAyB,OAAO,CAAA,EAAG;AAAA,IAC1D,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,EAAW,MAAM,WAAA,CAAY,SAAA;AAAY,GAC1C,CAAA;AACH;;;;"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { WEB_SERVER_GRAPHQL_SPAN_OP } from '@sentry/conventions/op';
|
|
2
|
+
import { isObjectLike, withActiveSpan, SPAN_STATUS_ERROR, startInactiveSpan, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
|
|
3
|
+
import { GRAPHQL_PATCHED_SYMBOL, GRAPHQL_DATA_SYMBOL, GRAPHQL_PARENT_NAME, GRAPHQL_FIELD_TYPE, GRAPHQL_FIELD_PATH, GRAPHQL_FIELD_NAME, ORIGIN, SPAN_NAME_RESOLVE } from './constants.js';
|
|
4
|
+
|
|
5
|
+
function isPromise(value) {
|
|
6
|
+
return typeof value?.then === "function";
|
|
7
|
+
}
|
|
8
|
+
function wrapFields(type, getConfig) {
|
|
9
|
+
if (!type || type[GRAPHQL_PATCHED_SYMBOL]) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
type[GRAPHQL_PATCHED_SYMBOL] = true;
|
|
13
|
+
const fields = type.getFields();
|
|
14
|
+
Object.keys(fields).forEach((key) => {
|
|
15
|
+
const field = fields[key];
|
|
16
|
+
if (!field) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (field.resolve) {
|
|
20
|
+
field.resolve = wrapFieldResolver(getConfig, field.resolve);
|
|
21
|
+
}
|
|
22
|
+
if (field.type) {
|
|
23
|
+
for (const unwrappedType of unwrapType(field.type)) {
|
|
24
|
+
wrapFields(unwrappedType, getConfig);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function wrapFieldResolver(getConfig, fieldResolver, isDefaultResolver = false) {
|
|
30
|
+
if (typeof fieldResolver !== "function" || fieldResolver[GRAPHQL_PATCHED_SYMBOL]) {
|
|
31
|
+
return fieldResolver;
|
|
32
|
+
}
|
|
33
|
+
function wrappedFieldResolver(source, args, rawContextValue, info) {
|
|
34
|
+
if (!fieldResolver) {
|
|
35
|
+
return void 0;
|
|
36
|
+
}
|
|
37
|
+
const contextValue = rawContextValue ?? {};
|
|
38
|
+
const config = getConfig();
|
|
39
|
+
if (config.ignoreTrivialResolveSpans && isDefaultResolver && (isObjectLike(source) || typeof source === "function")) {
|
|
40
|
+
const property = source[info.fieldName];
|
|
41
|
+
if (typeof property !== "function") {
|
|
42
|
+
return fieldResolver.call(this, source, args, contextValue, info);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (!contextValue[GRAPHQL_DATA_SYMBOL]) {
|
|
46
|
+
return fieldResolver.call(this, source, args, contextValue, info);
|
|
47
|
+
}
|
|
48
|
+
const path = pathToArray(info.path);
|
|
49
|
+
const { field, spanAdded } = createFieldIfNotExists(contextValue, info, path);
|
|
50
|
+
const span = field.span;
|
|
51
|
+
return withActiveSpan(span, () => {
|
|
52
|
+
try {
|
|
53
|
+
const res = fieldResolver.call(this, source, args, contextValue, info);
|
|
54
|
+
if (isPromise(res)) {
|
|
55
|
+
return res.then(
|
|
56
|
+
(r) => {
|
|
57
|
+
endResolveSpan(span, spanAdded);
|
|
58
|
+
return r;
|
|
59
|
+
},
|
|
60
|
+
(err) => {
|
|
61
|
+
endResolveSpan(span, spanAdded, err);
|
|
62
|
+
throw err;
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
endResolveSpan(span, spanAdded);
|
|
67
|
+
return res;
|
|
68
|
+
} catch (err) {
|
|
69
|
+
endResolveSpan(span, spanAdded, err);
|
|
70
|
+
throw err;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
wrappedFieldResolver[GRAPHQL_PATCHED_SYMBOL] = true;
|
|
75
|
+
return wrappedFieldResolver;
|
|
76
|
+
}
|
|
77
|
+
function endResolveSpan(span, shouldEndSpan, error) {
|
|
78
|
+
if (!shouldEndSpan) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (error) {
|
|
82
|
+
span.setStatus({ code: SPAN_STATUS_ERROR, message: error.message });
|
|
83
|
+
}
|
|
84
|
+
span.end();
|
|
85
|
+
}
|
|
86
|
+
function createFieldIfNotExists(contextValue, info, path) {
|
|
87
|
+
const existing = getField(contextValue, path);
|
|
88
|
+
if (existing) {
|
|
89
|
+
return { field: existing, spanAdded: false };
|
|
90
|
+
}
|
|
91
|
+
const field = { span: createResolverSpan(info, path, getParentFieldSpan(contextValue, path)) };
|
|
92
|
+
addField(contextValue, path, field);
|
|
93
|
+
return { field, spanAdded: true };
|
|
94
|
+
}
|
|
95
|
+
function createResolverSpan(info, path, parentSpan) {
|
|
96
|
+
const attributes = {
|
|
97
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
|
|
98
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: WEB_SERVER_GRAPHQL_SPAN_OP,
|
|
99
|
+
[GRAPHQL_FIELD_NAME]: info.fieldName,
|
|
100
|
+
[GRAPHQL_FIELD_PATH]: path.join("."),
|
|
101
|
+
[GRAPHQL_FIELD_TYPE]: info.returnType.toString(),
|
|
102
|
+
[GRAPHQL_PARENT_NAME]: info.parentType.name
|
|
103
|
+
};
|
|
104
|
+
return startInactiveSpan({ name: `${SPAN_NAME_RESOLVE} ${path.join(".")}`, attributes, parentSpan });
|
|
105
|
+
}
|
|
106
|
+
function addField(contextValue, path, field) {
|
|
107
|
+
const data = contextValue[GRAPHQL_DATA_SYMBOL];
|
|
108
|
+
if (data) {
|
|
109
|
+
data.fields[path.join(".")] = field;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function getField(contextValue, path) {
|
|
113
|
+
return contextValue[GRAPHQL_DATA_SYMBOL]?.fields[path.join(".")];
|
|
114
|
+
}
|
|
115
|
+
function getParentFieldSpan(contextValue, path) {
|
|
116
|
+
for (let i = path.length - 1; i > 0; i--) {
|
|
117
|
+
const field = getField(contextValue, path.slice(0, i));
|
|
118
|
+
if (field) {
|
|
119
|
+
return field.span;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return contextValue[GRAPHQL_DATA_SYMBOL]?.span;
|
|
123
|
+
}
|
|
124
|
+
function pathToArray(path) {
|
|
125
|
+
const flattened = [];
|
|
126
|
+
let curr = path;
|
|
127
|
+
while (curr) {
|
|
128
|
+
flattened.push(String(curr.key));
|
|
129
|
+
curr = curr.prev;
|
|
130
|
+
}
|
|
131
|
+
return flattened.reverse();
|
|
132
|
+
}
|
|
133
|
+
function unwrapType(type) {
|
|
134
|
+
if ("ofType" in type && type.ofType) {
|
|
135
|
+
return unwrapType(type.ofType);
|
|
136
|
+
}
|
|
137
|
+
if (isGraphQLUnionType(type)) {
|
|
138
|
+
return type.getTypes();
|
|
139
|
+
}
|
|
140
|
+
if (isGraphQLObjectType(type)) {
|
|
141
|
+
return [type];
|
|
142
|
+
}
|
|
143
|
+
return [];
|
|
144
|
+
}
|
|
145
|
+
function isGraphQLUnionType(type) {
|
|
146
|
+
return "getTypes" in type && typeof type.getTypes === "function";
|
|
147
|
+
}
|
|
148
|
+
function isGraphQLObjectType(type) {
|
|
149
|
+
return "getFields" in type && typeof type.getFields === "function";
|
|
150
|
+
}
|
|
151
|
+
function getOperation(document, operationName) {
|
|
152
|
+
const definitions = document?.definitions;
|
|
153
|
+
if (!definitions || !Array.isArray(definitions)) {
|
|
154
|
+
return void 0;
|
|
155
|
+
}
|
|
156
|
+
const isOperation = (def) => !!def?.operation && ["query", "mutation", "subscription"].indexOf(def.operation) !== -1;
|
|
157
|
+
if (operationName) {
|
|
158
|
+
return definitions.filter(isOperation).find((def) => operationName === def?.name?.value);
|
|
159
|
+
}
|
|
160
|
+
return definitions.find(isOperation);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export { getOperation, wrapFieldResolver, wrapFields };
|
|
164
|
+
//# sourceMappingURL=resolvers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolvers.js","sources":["../../../../../src/integrations/tracing-channel/graphql/resolvers.ts"],"sourcesContent":["/*\n * Resolver-span wrapping for the orchestrion graphql path. graphql v14–16 publishes no per-field\n * `resolve` channel (unlike v17's native one), so the schema's field resolvers are swapped for\n * span-creating proxies under the execute channel's `start` (the \"consumer trick\" — the transform\n * can't target user resolvers, but `execute` receives the schema, so we mutate it before the wrapped\n * call runs). Resolver spans use the same origin/op/field attributes as the native subscriber.\n */\n\nimport { WEB_SERVER_GRAPHQL_SPAN_OP } from '@sentry/conventions/op';\nimport type { Span, SpanAttributes } from '@sentry/core';\nimport {\n isObjectLike,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_STATUS_ERROR,\n startInactiveSpan,\n withActiveSpan,\n} from '@sentry/core';\nimport {\n GRAPHQL_DATA_SYMBOL,\n GRAPHQL_FIELD_NAME,\n GRAPHQL_FIELD_PATH,\n GRAPHQL_FIELD_TYPE,\n GRAPHQL_PARENT_NAME,\n GRAPHQL_PATCHED_SYMBOL,\n ORIGIN,\n SPAN_NAME_RESOLVE,\n} from './constants';\nimport type {\n DefinitionNode,\n DocumentNode,\n GraphQLFieldResolver,\n GraphQLObjectType,\n GraphQLOutputType,\n GraphQLPath,\n GraphQLResolveInfo,\n GraphQLType,\n GraphQLUnionType,\n GraphqlResolvedConfig,\n Maybe,\n ObjectWithGraphQLData,\n Patched,\n} from './types';\n\nfunction isPromise(value: unknown): value is Promise<unknown> {\n return typeof (value as { then?: unknown } | undefined)?.then === 'function';\n}\n\n/**\n * Walks the query/mutation type tree and swaps each field's `resolve` for a span-creating proxy.\n * Idempotent per type via {@link GRAPHQL_PATCHED_SYMBOL}.\n */\nexport function wrapFields(type: Maybe<GraphQLObjectType & Patched>, getConfig: () => GraphqlResolvedConfig): void {\n if (!type || type[GRAPHQL_PATCHED_SYMBOL]) {\n return;\n }\n\n type[GRAPHQL_PATCHED_SYMBOL] = true;\n const fields = type.getFields();\n\n Object.keys(fields).forEach(key => {\n const field = fields[key];\n if (!field) {\n return;\n }\n\n if (field.resolve) {\n field.resolve = wrapFieldResolver(getConfig, field.resolve);\n }\n\n if (field.type) {\n for (const unwrappedType of unwrapType(field.type)) {\n wrapFields(unwrappedType, getConfig);\n }\n }\n });\n}\n\nexport function wrapFieldResolver(\n getConfig: () => GraphqlResolvedConfig,\n fieldResolver: Maybe<GraphQLFieldResolver & Patched>,\n isDefaultResolver = false,\n): GraphQLFieldResolver & Patched {\n // Return the resolver untouched if it isn't a function or is already a wrapped one — the wrapper we\n // return is marked with `GRAPHQL_PATCHED_SYMBOL` below precisely so it can be detected here. (The\n // guard must test the incoming `fieldResolver`, not the freshly-hoisted `wrappedFieldResolver`.)\n if (typeof fieldResolver !== 'function' || fieldResolver[GRAPHQL_PATCHED_SYMBOL]) {\n return fieldResolver as GraphQLFieldResolver;\n }\n\n function wrappedFieldResolver(\n this: unknown,\n source: unknown,\n args: unknown,\n rawContextValue: unknown,\n info: GraphQLResolveInfo,\n ): unknown {\n if (!fieldResolver) {\n return undefined;\n }\n\n const contextValue = (rawContextValue ?? {}) as ObjectWithGraphQLData;\n const config = getConfig();\n\n // Mirror graphql's own \"trivial resolver\" check: a default resolver that just reads a\n // non-function property is not worth a span.\n if (\n config.ignoreTrivialResolveSpans &&\n isDefaultResolver &&\n (isObjectLike(source) || typeof source === 'function')\n ) {\n const property = (source as Record<string, unknown>)[info.fieldName];\n if (typeof property !== 'function') {\n return fieldResolver.call(this, source, args, contextValue, info);\n }\n }\n\n if (!contextValue[GRAPHQL_DATA_SYMBOL]) {\n return fieldResolver.call(this, source, args, contextValue, info);\n }\n\n const path = pathToArray(info.path);\n const { field, spanAdded } = createFieldIfNotExists(contextValue, info, path);\n const span = field.span;\n\n return withActiveSpan(span, () => {\n try {\n const res = fieldResolver.call(this, source, args, contextValue, info);\n if (isPromise(res)) {\n return res.then(\n r => {\n endResolveSpan(span, spanAdded);\n return r;\n },\n (err: Error) => {\n endResolveSpan(span, spanAdded, err);\n throw err;\n },\n );\n }\n endResolveSpan(span, spanAdded);\n return res;\n } catch (err) {\n endResolveSpan(span, spanAdded, err as Error);\n throw err;\n }\n });\n }\n\n (wrappedFieldResolver as Patched)[GRAPHQL_PATCHED_SYMBOL] = true;\n return wrappedFieldResolver;\n}\n\nfunction endResolveSpan(span: Span, shouldEndSpan: boolean, error?: Error): void {\n if (!shouldEndSpan) {\n return;\n }\n if (error) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: error.message });\n }\n span.end();\n}\n\nfunction createFieldIfNotExists(\n contextValue: ObjectWithGraphQLData,\n info: GraphQLResolveInfo,\n path: string[],\n): { field: { span: Span }; spanAdded: boolean } {\n const existing = getField(contextValue, path);\n if (existing) {\n return { field: existing, spanAdded: false };\n }\n\n const field = { span: createResolverSpan(info, path, getParentFieldSpan(contextValue, path)) };\n addField(contextValue, path, field);\n return { field, spanAdded: true };\n}\n\nfunction createResolverSpan(info: GraphQLResolveInfo, path: string[], parentSpan?: Span): Span {\n const attributes: SpanAttributes = {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: WEB_SERVER_GRAPHQL_SPAN_OP,\n [GRAPHQL_FIELD_NAME]: info.fieldName,\n [GRAPHQL_FIELD_PATH]: path.join('.'),\n [GRAPHQL_FIELD_TYPE]: info.returnType.toString(),\n [GRAPHQL_PARENT_NAME]: info.parentType.name,\n };\n\n return startInactiveSpan({ name: `${SPAN_NAME_RESOLVE} ${path.join('.')}`, attributes, parentSpan });\n}\n\nfunction addField(contextValue: ObjectWithGraphQLData, path: string[], field: { span: Span }): void {\n const data = contextValue[GRAPHQL_DATA_SYMBOL];\n if (data) {\n data.fields[path.join('.')] = field;\n }\n}\n\nfunction getField(contextValue: ObjectWithGraphQLData, path: string[]): { span: Span } | undefined {\n return contextValue[GRAPHQL_DATA_SYMBOL]?.fields[path.join('.')];\n}\n\nfunction getParentFieldSpan(contextValue: ObjectWithGraphQLData, path: string[]): Span | undefined {\n for (let i = path.length - 1; i > 0; i--) {\n const field = getField(contextValue, path.slice(0, i));\n if (field) {\n return field.span;\n }\n }\n return contextValue[GRAPHQL_DATA_SYMBOL]?.span;\n}\n\nfunction pathToArray(path: GraphQLPath): string[] {\n const flattened: string[] = [];\n let curr: GraphQLPath | undefined = path;\n while (curr) {\n flattened.push(String(curr.key));\n curr = curr.prev;\n }\n return flattened.reverse();\n}\n\nfunction unwrapType(type: GraphQLOutputType): readonly (GraphQLObjectType & Patched)[] {\n // The structural index signature widens `ofType` to `unknown`, so narrow it back explicitly.\n if ('ofType' in type && type.ofType) {\n return unwrapType(type.ofType as GraphQLOutputType);\n }\n if (isGraphQLUnionType(type)) {\n return type.getTypes();\n }\n if (isGraphQLObjectType(type)) {\n return [type];\n }\n return [];\n}\n\nfunction isGraphQLUnionType(type: GraphQLType): type is GraphQLUnionType {\n return 'getTypes' in type && typeof type.getTypes === 'function';\n}\n\nfunction isGraphQLObjectType(type: GraphQLType): type is GraphQLObjectType {\n return 'getFields' in type && typeof (type as GraphQLObjectType).getFields === 'function';\n}\n\n/**\n * Returns the operation definition for `operationName` (or the first operation) from a parsed\n * document, or `undefined` for schema documents / when no operation is present.\n */\nexport function getOperation(document: DocumentNode, operationName?: Maybe<string>): DefinitionNode | undefined {\n const definitions: readonly DefinitionNode[] | undefined = document?.definitions;\n if (!definitions || !Array.isArray(definitions)) {\n return undefined;\n }\n\n const isOperation = (def: DefinitionNode): boolean =>\n !!def?.operation && ['query', 'mutation', 'subscription'].indexOf(def.operation) !== -1;\n\n if (operationName) {\n return definitions.filter(isOperation).find((def: DefinitionNode) => operationName === def?.name?.value);\n }\n return definitions.find(isOperation);\n}\n"],"names":[],"mappings":";;;;AA4CA,SAAS,UAAU,KAAA,EAA2C;AAC5D,EAAA,OAAO,OAAQ,OAA0C,IAAA,KAAS,UAAA;AACpE;AAMO,SAAS,UAAA,CAAW,MAA0C,SAAA,EAA8C;AACjH,EAAA,IAAI,CAAC,IAAA,IAAQ,IAAA,CAAK,sBAAsB,CAAA,EAAG;AACzC,IAAA;AAAA,EACF;AAEA,EAAA,IAAA,CAAK,sBAAsB,CAAA,GAAI,IAAA;AAC/B,EAAA,MAAM,MAAA,GAAS,KAAK,SAAA,EAAU;AAE9B,EAAA,MAAA,CAAO,IAAA,CAAK,MAAM,CAAA,CAAE,OAAA,CAAQ,CAAA,GAAA,KAAO;AACjC,IAAA,MAAM,KAAA,GAAQ,OAAO,GAAG,CAAA;AACxB,IAAA,IAAI,CAAC,KAAA,EAAO;AACV,MAAA;AAAA,IACF;AAEA,IAAA,IAAI,MAAM,OAAA,EAAS;AACjB,MAAA,KAAA,CAAM,OAAA,GAAU,iBAAA,CAAkB,SAAA,EAAW,KAAA,CAAM,OAAO,CAAA;AAAA,IAC5D;AAEA,IAAA,IAAI,MAAM,IAAA,EAAM;AACd,MAAA,KAAA,MAAW,aAAA,IAAiB,UAAA,CAAW,KAAA,CAAM,IAAI,CAAA,EAAG;AAClD,QAAA,UAAA,CAAW,eAAe,SAAS,CAAA;AAAA,MACrC;AAAA,IACF;AAAA,EACF,CAAC,CAAA;AACH;AAEO,SAAS,iBAAA,CACd,SAAA,EACA,aAAA,EACA,iBAAA,GAAoB,KAAA,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AA,KAAc,UAAA;AACjF;AAMO,SAAS,YAAA,CAAa,UAAwB,aAAA,EAA2D;AAC9G,EAAA,MAAM,cAAqD,QAAA,EAAU,WAAA;AACrE,EAAA,IAAI,CAAC,WAAA,IAAe,CAAC,KAAA,CAAM,OAAA,CAAQ,WAAW,CAAA,EAAG;AAC/C,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,MAAM,WAAA,GAAc,CAAC,GAAA,KACnB,CAAC,CAAC,GAAA,EAAK,SAAA,IAAa,CAAC,OAAA,EAAS,YAAY,cAAc,CAAA,CAAE,OAAA,CAAQ,GAAA,CAAI,SAAS,CAAA,KAAM,EAAA;AAEvF,EAAA,IAAI,aAAA,EAAe;AACjB,IAAA,OAAO,WAAA,CAAY,MAAA,CAAO,WAAW,CAAA,CAAE,IAAA,CAAK,CAAC,GAAA,KAAwB,aAAA,KAAkB,GAAA,EAAK,IAAA,EAAM,KAAK,CAAA;AAAA,EACzG;AACA,EAAA,OAAO,WAAA,CAAY,KAAK,WAAW,CAAA;AACrC;;;;"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { GRAPHQL_DOCUMENT, GRAPHQL_OPERATION_NAME, GRAPHQL_OPERATION_TYPE } from '@sentry/conventions/attributes';
|
|
2
|
+
import { WEB_SERVER_GRAPHQL_SPAN_OP } from '@sentry/conventions/op';
|
|
3
|
+
import { startInactiveSpan, SPAN_STATUS_ERROR, SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
|
|
4
|
+
import { collectGraphqlDocument, hasResultErrors, getOperationSpanName, renameRootSpanWithOperation } from '../../../graphql/utils.js';
|
|
5
|
+
import { ORIGIN, SPAN_NAME_PARSE, SPAN_NAME_VALIDATE, GRAPHQL_DATA_SYMBOL, SPAN_NAME_EXECUTE } from './constants.js';
|
|
6
|
+
import { wrapFieldResolver, wrapFields, getOperation } from './resolvers.js';
|
|
7
|
+
|
|
8
|
+
const BASE_ATTRIBUTES = {
|
|
9
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: ORIGIN,
|
|
10
|
+
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: WEB_SERVER_GRAPHQL_SPAN_OP
|
|
11
|
+
};
|
|
12
|
+
function startParseSpan() {
|
|
13
|
+
return startInactiveSpan({ name: SPAN_NAME_PARSE, attributes: { ...BASE_ATTRIBUTES } });
|
|
14
|
+
}
|
|
15
|
+
function startValidateSpan(documentAST) {
|
|
16
|
+
return startInactiveSpan({
|
|
17
|
+
name: SPAN_NAME_VALIDATE,
|
|
18
|
+
attributes: { ...BASE_ATTRIBUTES, [GRAPHQL_DOCUMENT]: collectGraphqlDocument(documentAST) }
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function finalizeValidateSpan(span, result) {
|
|
22
|
+
if (Array.isArray(result) && result.length > 0) {
|
|
23
|
+
span.setStatus({ code: SPAN_STATUS_ERROR, message: "invalid_argument" });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function normalizeExecuteArgs(argsArray) {
|
|
27
|
+
if (argsArray.length >= 2) {
|
|
28
|
+
return {
|
|
29
|
+
schema: argsArray[0 /* SCHEMA */],
|
|
30
|
+
document: argsArray[1 /* DOCUMENT */],
|
|
31
|
+
contextValue: argsArray[3 /* CONTEXT_VALUE */] ?? {},
|
|
32
|
+
operationName: argsArray[5 /* OPERATION_NAME */],
|
|
33
|
+
fieldResolver: argsArray[6 /* FIELD_RESOLVER */],
|
|
34
|
+
writeBack: (contextValue, fieldResolver) => {
|
|
35
|
+
argsArray[3 /* CONTEXT_VALUE */] = contextValue;
|
|
36
|
+
argsArray[6 /* FIELD_RESOLVER */] = fieldResolver;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const obj = argsArray[0] ?? {};
|
|
41
|
+
return {
|
|
42
|
+
schema: obj.schema,
|
|
43
|
+
document: obj.document,
|
|
44
|
+
contextValue: obj.contextValue ?? {},
|
|
45
|
+
operationName: obj.operationName,
|
|
46
|
+
fieldResolver: obj.fieldResolver,
|
|
47
|
+
writeBack: (contextValue, fieldResolver) => {
|
|
48
|
+
obj.contextValue = contextValue;
|
|
49
|
+
obj.fieldResolver = fieldResolver;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function startExecuteSpan(argsArray, self, config, getConfig) {
|
|
54
|
+
const args = normalizeExecuteArgs(argsArray);
|
|
55
|
+
const { schema, document } = args;
|
|
56
|
+
let { contextValue, fieldResolver } = args;
|
|
57
|
+
const alreadyInstrumented = !!contextValue[GRAPHQL_DATA_SYMBOL];
|
|
58
|
+
if (!config.ignoreResolveSpans && !alreadyInstrumented) {
|
|
59
|
+
const isUsingDefaultResolver = fieldResolver == null;
|
|
60
|
+
const defaultFieldResolver = self?.defaultFieldResolver;
|
|
61
|
+
const fieldResolverForExecute = fieldResolver ?? defaultFieldResolver;
|
|
62
|
+
if (fieldResolverForExecute) {
|
|
63
|
+
fieldResolver = wrapFieldResolver(getConfig, fieldResolverForExecute, isUsingDefaultResolver);
|
|
64
|
+
}
|
|
65
|
+
if (schema) {
|
|
66
|
+
wrapFields(schema.getQueryType(), getConfig);
|
|
67
|
+
wrapFields(schema.getMutationType(), getConfig);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const operation = getOperation(document, args.operationName);
|
|
71
|
+
const operationType = operation?.operation;
|
|
72
|
+
const operationName = operation?.name?.value ?? args.operationName ?? void 0;
|
|
73
|
+
const span = startInactiveSpan({
|
|
74
|
+
name: getOperationSpanName(operationType, operationName || void 0, SPAN_NAME_EXECUTE),
|
|
75
|
+
attributes: {
|
|
76
|
+
...BASE_ATTRIBUTES,
|
|
77
|
+
[GRAPHQL_OPERATION_TYPE]: operationType,
|
|
78
|
+
[GRAPHQL_OPERATION_NAME]: operationName || void 0,
|
|
79
|
+
[GRAPHQL_DOCUMENT]: collectGraphqlDocument(document)
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
if (config.useOperationNameForRootSpan && operationType) {
|
|
83
|
+
renameRootSpanWithOperation(span, operationType, operationName || void 0);
|
|
84
|
+
}
|
|
85
|
+
contextValue[GRAPHQL_DATA_SYMBOL] = { source: document, span, fields: {} };
|
|
86
|
+
args.writeBack(contextValue, fieldResolver);
|
|
87
|
+
return span;
|
|
88
|
+
}
|
|
89
|
+
function finalizeExecuteSpan(span, result) {
|
|
90
|
+
if (hasResultErrors(result)) {
|
|
91
|
+
span.setStatus({ code: SPAN_STATUS_ERROR, message: "internal_error" });
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export { finalizeExecuteSpan, finalizeValidateSpan, startExecuteSpan, startParseSpan, startValidateSpan };
|
|
96
|
+
//# sourceMappingURL=spans.js.map
|